claude/ai-resources-plugin/skills/optimize-tsconfig/SKILL.md
Optimize tsconfig.json for build speed, watch mode, and tsc memory. Use for slow tsc, too many file watchers, or TypeScript performance audits.
npx skillsauth add amhuppert/my-ai-resources optimize-tsconfigInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Audit and optimize TypeScript configuration for faster builds, reduced memory usage, and fewer file watchers. Produces targeted, project-specific recommendations — not a generic checklist.
<target> Use the tsconfig path supplied in the user's invocation, if any. </target>If no path was provided, search the project for **/tsconfig*.json.
Read each tsconfig, including any extended configs (follow extends chains to understand the full effective configuration). Note which settings are inherited vs. overridden.
Run tsc --extendedDiagnostics for each tsconfig to establish a baseline:
npx tsc -p path/to/tsconfig.json --extendedDiagnostics --noEmit
Record key metrics: Files checked, total time, memory used, program size. These are the numbers to improve.
If the concern is watch mode specifically, check the current watchOptions (or lack thereof) and ask the user to provide a file watcher count if available (e.g., from lsof, /proc/PID/fdinfo, or a tool like watchman).
Consult references/tsconfig-performance.md for the full catalog of optimization settings, tradeoffs, and impact rankings.
Evaluate each potential optimization against the project's current config. Categorize recommendations into tiers:
Settings that improve performance with zero functional impact. Apply these unconditionally:
watchOptions.excludeDirectories — Exclude **/node_modules and build output dirs from watch. Typical reduction: 90%+ of file watchers eliminated.watchOptions.watchFile: "useFsEvents" — Use OS-native file events instead of polling.skipLibCheck: true — Skip type-checking .d.ts files. Almost always safe.incremental: true — Cache compiler state for faster rebuilds. Add tsBuildInfoFile pointing to build output dir.Settings with minor tradeoffs that are appropriate for most projects:
isolatedModules: true — Enables fast transpilers (SWC, esbuild). May require removing const enums or namespace merging patterns.exclude patterns — Ensure test files, build output, and hidden directories are excluded from the main program. Consider a separate tsconfig.test.json for test files.watchOptions.fallbackPolling: "dynamicPriorityPolling" — Best fallback when FS events are unavailable.Settings that require deliberate tradeoff decisions — present these with clear context:
types array — Restricting auto-included @types reduces program size but requires manual maintenance when adding dependencies. Recommend only when there's clear evidence of unnecessary types being pulled in.isolatedDeclarations (TS 5.5+) — Enables parallel .d.ts generation but requires explicit annotations on all exports.noCheck (TS 5.6+) — Skips type checking for emit-only builds. Only for split build pipelines.disableReferencedProjectLoad, etc.) — Only for large monorepos where VS Code runs out of memory.strict mode for performance — the impact is negligible and the safety loss is real.@types packages unless they are clearly irrelevant to the project.exclude patterns that might break type resolution.Present the tiered recommendations to the user. For Tier 1, suggest applying immediately. For Tier 2-3, explain the tradeoff and ask for confirmation.
When applying changes:
tsc --noEmit to verify the project still compiles cleanlytsc --watch to pick up the new watchOptionsRe-run tsc --extendedDiagnostics and compare against the Step 2 baseline. Report the before/after metrics.
If watch mode was the concern and the user can measure watcher counts, compare those as well.
references/tsconfig-performance.md — Complete catalog of performance-related tsconfig settings with explanations, tradeoffs, impact rankings, diagnostic commands, and code patterns that affect compiler performancedevelopment
Debug a running web app via the web-debugger SDK: app logs, application state, runtime snapshots, React state, query cache.
development
Thoroughly understand a software development objective before implementation: research, identify ambiguities, ask clarifying questions. Use before starting implementation of a non-trivial or ambiguously specified feature, or when requirements leave open design decisions.
development
Locate the on-disk Claude Code transcript file (.jsonl under ~/.claude/projects/) for the current or a specified conversation.
development
Reflect on codebase navigation effectiveness at end of conversation. Surfaces dead ends, inefficiencies, missing context. Does not write files — pair with /kiro:steering-custom to persist.