tsconfig.json Generator Prompt

Generate a version-compatible tsconfig.json from a supplied TypeScript project, runtime, module system, build pipeline, source layout, and validation evidence.

Prompt Template

You are a senior TypeScript tooling engineer generating a tsconfig.json only from the project facts, installed versions, runtime contract, module behavior, source layout, and build ownership I provide. Produce the smallest maintainable configuration compatible with the exact TypeScript version and toolchain. Treat the compiler, runtime, package module mode, bundler, framework, test runner, editor, declaration consumer, and base config as separate compatibility boundaries. Never invent compiler options, defaults, library names, path behavior, emitted-file needs, framework requirements, or successful validation.

Project purpose: [web app, server, library, command-line tool, monorepo package, scripts, other]
Repository structure and config location: [sanitized tree]
Package manager and workspace setup: [details]
Exact TypeScript version: [installed version or unknown]
Runtime and exact versions: [browser targets, Node, edge runtime, other]
Package module mode and file extensions: [ESM, CommonJS, mixed, package.json type, .ts, .mts, .cts, other]
Execution and build pipeline: [tsc emit, noEmit type-check, bundler, runtime loader, framework compiler, other]
Framework, bundler, loader, test runner, and exact versions: [verified list]
Existing tsconfig files, extends chain, and migration goal: [paste sanitized content or none]
Source, test, generated, declaration, asset, and output paths: [details]
Entry points and package exports: [verified details or unknown]
Module and resolution behavior required by the actual runtime or bundler: [evidence]
Language target and required runtime APIs: [verified support matrix]
Strictness and team policy: [details]
JavaScript, JSX, decorators, interop, and import-extension requirements: [details]
Types, global environments, and library declarations: [verified list]
Path aliases and matching runtime or bundler resolver: [details or none]
Emit ownership: [JavaScript, declarations, maps, incremental metadata, build info, noEmit]
Composite projects and references: [graph and ownership or none]
Third-party base config packages and exact versions: [verified list or none]
Current compiler command and exact sanitized errors: [details]
Editor, lint, test, CI, and build commands: [details]
Performance constraints: [repository size, type-check budget, incremental needs]
Validation available: [showConfig, noEmit check, build, tests, package consumer, CI]
Output scope: [single config, base plus variants, migration notes, scripts]

Provide:
1. An assumptions table marking every version, runtime, module rule, path, library, global, compiler option, default, and build responsibility as verified, inferred, or unknown.
2. A recommended config shape: one file, a base with environment-specific variants, or project references, with a reason tied to the supplied repository.
3. Complete JSON-compatible tsconfig content for each justified file, with only version-supported options and no comments when strict JSON is required.
4. An option-by-option table covering purpose, selected value, compatibility evidence, interaction with other options, and owner in the runtime or build chain.
5. Include and exclude patterns tested against the supplied tree, explicitly accounting for tests, generated files, output folders, declarations, scripts, and neighboring packages.
6. A module-resolution trace for representative imports, including extensions, package exports, aliases, and the actual runtime or bundler behavior; remove aliases that have no matching runtime resolver.
7. A migration plan covering old configs, extends chains, package scripts, editor settings, lint and test tools, CI, generated output, downstream consumers, rollback, and staged strictness changes.
8. Version-appropriate validation commands for resolved configuration, type checking, emit when owned by tsc, build, tests, and a package-consumer check, labeling anything that needs official-documentation verification.
9. Test cases for source inclusion, accidental output inclusion, environment globals, module imports, JSX if used, declarations, aliases, project references, editor parity, and clean checkout behavior.
10. A final audit for unknown options, mismatched module settings, unsupported runtime APIs, duplicated emit, broad includes, hidden globals, broken aliases, stale declarations, output recursion, skipped checks, and claims not backed by actual command output.

Do not weaken type safety merely to clear errors, overwrite a framework-owned config without evidence, include proprietary source code in examples, or claim the configuration works without running validation. Ask for missing versions and errors or leave explicit placeholders rather than guessing.

Example Output

Verified Inputs

The supplied project is an ESM server package using an exact TypeScript version. The runtime version, package type, source folder, noEmit type-check command, and bundler ownership are verified. Test globals, path aliases, declaration output, and project references remain unknown.

Proposed Shape

Use one strict tsconfig.json scoped to the verified source folder. Match module and resolution settings to the supplied runtime contract, let the verified bundler own JavaScript output, include only confirmed runtime libraries, and omit aliases, test globals, declarations, and references until their consumers are identified.

Validation Boundary

Inspect the resolved configuration, run a clean no-emit type check, exercise representative imports, run the actual build and tests, and compare editor diagnostics with CI. Configuration parsing alone does not prove runtime import compatibility.

Tips for Best Results

  • ๐Ÿ’กProvide the exact TypeScript, runtime, framework, bundler, loader, test-runner, and package module versions.
  • ๐Ÿ’กState who owns JavaScript and declaration emit so the compiler does not duplicate or contradict the build pipeline.
  • ๐Ÿ’กTest resolved configuration and representative imports in the actual runtime, build, editor, tests, and CI.

Frequently Asked Questions

What is the tsconfig.json Generator Prompt prompt?

Generate a version-compatible tsconfig.json from a supplied TypeScript project, runtime, module system, build pipeline, source layout, and validation evidence. It's a free ChatGPT prompt template from our Coding collection โ€” copy it, fill in the bracketed variables, and paste it into your AI tool.

Which AI tools work with this prompt?

It's written and tested for ChatGPT, Claude and Gemini. Any AI assistant that accepts free-form text prompts will handle it well.

How do I customize this ChatGPT prompt?

Replace the bracketed variables โ€” such as [sanitized tree], [details], [installed version or unknown] โ€” with your own details before running it. Provide the exact TypeScript, runtime, framework, bundler, loader, test-runner, and package module versions.

Is this prompt free to use?

Yes. Every prompt on PromptAtlas is free to copy, customize, and use โ€” no signup required.