From harness-claude
Configures tsconfig.json with extends, project references, composite builds, incremental compilation, and separation of concerns for monorepos and build optimization.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:ts-config-patternsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Configure tsconfig with extends, project references, composite builds, and incremental compilation
Configure tsconfig with extends, project references, composite builds, and incremental compilation
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
"incremental": true,
"paths": { "@/*": ["./src/*"] }
},
"include": ["src"],
"exclude": ["node_modules", "dist"]
}
// tsconfig.base.json
{
"compilerOptions": {
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"isolatedModules": true
}
}
// packages/api/tsconfig.json
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "./dist",
"rootDir": "./src"
},
"include": ["src"]
}
// tsconfig.json (root)
{
"references": [
{ "path": "packages/shared" },
{ "path": "packages/api" },
{ "path": "packages/web" }
],
"files": []
}
// packages/shared/tsconfig.json
{
"compilerOptions": {
"composite": true,
"declaration": true,
"outDir": "./dist"
},
"include": ["src"]
}
// packages/api/tsconfig.json
{
"references": [{ "path": "../shared" }],
"compilerOptions": {
"composite": true,
"outDir": "./dist"
}
}
Build with: tsc --build (builds referenced projects in dependency order).
{
"compilerOptions": {
"incremental": true,
"tsBuildInfoFile": ".tsbuildinfo"
}
}
// tsconfig.json — IDE and type checking (no emit)
{
"compilerOptions": { "noEmit": true },
"include": ["src", "tests"]
}
// tsconfig.build.json — production build (emit, no tests)
{
"extends": "./tsconfig.json",
"compilerOptions": { "noEmit": false, "outDir": "dist" },
"include": ["src"],
"exclude": ["**/*.test.ts", "**/*.spec.ts"]
}
Key options explained:
target — JavaScript version to emit. Use ES2022 for Node 18+, ES2021 for broader compatmodule — Module system. ESNext for bundler-based projects, NodeNext for Node.js packagesmoduleResolution — bundler for Vite/webpack/Next.js, NodeNext for Node.js librariesisolatedModules — required for esbuild/swc transpilation (one file at a time)skipLibCheck — skip type checking .d.ts files from dependencies. Almost always enableConfigure for testing:
// vitest needs jsdom types
{
"compilerOptions": {
"types": ["vitest/globals"]
}
}
tsconfig.json controls both the TypeScript compiler and the language service (IDE features). Many projects use TypeScript only for type checking (noEmit: true) while a bundler (Vite, esbuild, Next.js) handles actual compilation.
composite: true requirements:
declaration: true must be setinclude or listed in filesrootDir defaults to the directory containing tsconfig.jsontsc --build mode for dependency-aware compilationmoduleResolution choices:
bundler — best for projects using Vite, webpack, esbuild, Next.js. Allows extensionless imports, index.ts resolution, and package.json exportsNodeNext / Node16 — for pure Node.js packages. Requires .js extensions in imports (even for .ts files). Enforces ESM/CJS boundariesnode (legacy) — Node.js CommonJS resolution. Avoid for new projectspaths vs baseUrl: paths requires baseUrl in older TypeScript versions but since TypeScript 5.0+, paths can be relative to the tsconfig directory without baseUrl.
Trade-offs:
skipLibCheck: true speeds up compilation significantly — but hides type errors in .d.ts files from dependenciesincremental: true speeds up subsequent builds — but creates a .tsbuildinfo file that should be gitignoredisolatedModules is required for fast transpilers — but prevents const enum and namespace merging across fileshttps://typescriptlang.org/tsconfig
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeOptimizes TypeScript compilation speed and type complexity with techniques like incremental builds, skipLibCheck, project references, and simplified generics.
Provides 2025 TypeScript strict mode tsconfig.json recommendations, explains strict flags like noUncheckedIndexedAccess, moduleResolution (Bundler vs NodeNext), verbatimModuleSyntax. Use for new projects or stricter type safety migrations.
Configures and reviews TypeScript project standards: tsconfig strictness, module resolution, path aliases, declaration files, package exports, and type boundaries for apps, libraries, SDKs, CLIs, and monorepos.