typescript-strict
Skill1 starsChanged 6 days agoMITView on GitHub
Enable TypeScript strict mode (strict, noImplicitAny, strictNullChecks, etc.) in a project and fix the resulting errors without weakening types, tests, or runtime behavior. Use when asked to "enable strict mode", "turn on TypeScript strict", "fix strict errors", or migrate a codebase to strict type checking.
- Installs packages
13 other projects use a version of this.
Adopted by
Most recently taken up by
- conjurer-rich/skillstheir own version, first seen Oct 25, 2026
- Greg-Klein/ai-rules-skillstheir own version, first seen Oct 15, 2026
- SkillMedev/engineering-workflowtheir own version, first seen Oct 5, 2026
- aprameyak/coding-skillstheir own version, first seen Oct 2, 2026
- Sagargupta16/claude-code-recipestheir own version, first seen Sep 6, 2026
- ngnthanhdev/claude_template_codetheir own version, first seen Aug 20, 2026
Used with
Projects with it also use react-patterns, api-design and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
xenitV1Skillreact-patterns
Modern React patterns and principles. Hooks, composition, performance, TypeScript best practices.
Also in 3 projects that use this
MicrosoftSkillapi-design
Guide for designing and documenting RESTful APIs. Use when asked to design an API, create endpoints, or document an API.
Also in 5 projects that use this
Microsoft AzureSkillgit-workflow
Squad branching model: dev-first workflow with insiders preview channel
Also in 3 projects that use this
GoogleSkillcode-review
Adversarial systems, concurrency, memory-model, and architecture code review protocol. Use this skill whenever asked to review code, PRs, diffs, or branches in Filament.
Also in 4 projects that use this
Other versions13 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 13
- Sagargupta16/claude-code-recipes★ 8same name
- 0xMassi/claude-skills★ 7same name
- kevinaimonster/skill-hub★ 4same name
- halflength-ampleness75/claude-code-recipes★ 2same name
- aprameyak/coding-skills★ 1same name
- conjurer-rich/skills★ 1same name
- NaviAndrei/AgentFlow-Studio★ 1same name
- theseus-run/theseus★ 1same name
- Greg-Klein/ai-rules-skills★ 0same name
- Nadav011/apex-skills★ 0same name
3 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- typescript-build-referencesSkill
- typescript-project-setupSkill
- typescript-updateSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 8 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 13 edited versions we read keep these.
8
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Read package.json (scripts, packageManager, engines), the lockfile(s), .nvmrc/.node-version, and CI config to learn the authoritative …
- Distinctive: line 16
Run the project's real build, lint, and test commands before changing anything and record the results, so later failures can be attributed …
- Very specific: line 22
Do not add opt-outs to get green: no strict: false, noImplicitAny: false, strictNullChecks: false, skipLibCheck added for convenience, new …
- Very specific: line 23
If the project is large, flags may be enabled incrementally (noImplicitAny, strictNullChecks, strictFunctionTypes, …
- Distinctive: line 28
Prefer these, roughly in order:
- Distinctive: line 30
Add precise annotations: structural interfaces/type aliases, recursive data types, discriminated unions, literal types.
- Very specific: line 34
Use this parameters, overloads, or generics for callback/receiver typing problems.
- Distinctive: line 42
If a diagnostic truly cannot be modeled (e.g.
- Distinctive: line 55
Run the project's original lint (e.g.
- Very specific: line 56
After touching package.json, restore from the lockfile with the frozen install command to confirm it is still consistent.
- Distinctive: line 59
Treat the completion ledger as real: dependencies restored, baseline finished, configs changed, diagnostics fixed, final checks finished.
- Very specific: line 60
After the last semantic edit, audit the full patch, including new/untracked files: any, assertions/casts, !, @ts-* and lint disables, .d.ts …
- Distinctive: line 64
Don't end with an unanswered question or pending work.
- Distinctive: line 65
Never describe remaining compiler errors as warnings or declare success while checks fail.
“Common” is measured: kept by at least 6 in 10 of the 13 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
<!-- prettier-ignore-start -->Your role is to turn on strict type checking and repair the code so the project is genuinely type-safe, without changing runtime behavior or weakening existing verification. Fixing the diagnostics matters; silencing them does not.
1. Establish a baseline first
- Read
package.json(scripts,packageManager,engines), the lockfile(s),.nvmrc/.node-version, and CI config to learn the authoritative package manager, Node version, and build/lint/test commands. - Resolve the declared package manager and workspace first (npm, Yarn incl. PnP, pnpm). Check for the declared compiler without fetching: look for a local
node_modules/.bin/tscor use the manager's local resolution (npm exec --no-install tsc -- -v,yarn tsc -v,pnpm exec tsc -v). Never use bare interactivenpx tscas an availability test: it can offer to install the unrelated npm packagetsc. - If dependencies or the compiler are missing, execute the frozen/immutable restore (
npm ci,yarn install --immutable,pnpm install --frozen-lockfile) before any version, build, lint, or test probe, then confirm the compiler version. A restore failure is a blocker to report separately from compiler diagnostics. Never install anothertsc, and do not switch managers or versions merely to unblock. - Treat a terminal ID, partial output, or prompt as pending, never as passed or completed. Poll the same operation until it finishes and record its exit result. Resolve a blocked terminal before sending dependent checks to it. If you reject a prompt or cancel a command, confirm the shell is usable, run the recovery command immediately, and retry the intended operation; do not end by only promising to.
- Run the project's real build, lint, and test commands before changing anything and record the results, so later failures can be attributed correctly.
- Enumerate every TypeScript config and input:
extendschains,references,tsconfig.*.json(tests, scripts, build, declarations), per-package configs in monorepos, and test runner configs (ts-node/ts-jest/mocha/vitest/jest). Test and secondary configs are in scope, not just the root one.
2. Enable strictness
- Set
"strict": truein each config that type-checks project code (or in the shared base they extend). Do it for test and secondary configs too. - Do not add opt-outs to get green: no
strict: false,noImplicitAny: false,strictNullChecks: false,skipLibCheckadded for convenience, newexcludeentries, narrowerinclude/files,transpileOnly/isolatedModulestest runners, or separate relaxed configs. Preserve original input membership and verification strength. - If the project is large, flags may be enabled incrementally (
noImplicitAny,strictNullChecks,strictFunctionTypes,strictPropertyInitialization,useUnknownInCatchVariables, ...) but the end state must bestrict: true. - This is not a compiler or dependency upgrade. Change tool/dependency versions only if strictness truly requires it (e.g. missing
@types/*), and keep the manifest, lockfile, and package manager in sync.
3. Fix diagnostics by modeling types
Prefer these, roughly in order:
- Add precise annotations: structural interfaces/type aliases, recursive data types, discriminated unions, literal types.
- Narrow at boundaries: type guards,
in/typeof/instanceofchecks, andunknownfor genuinely untyped input (JSON, catch variables, event payloads), validated before use. - Preserve generic relationships. Keep type parameters, mapped, conditional, and indexed-access types connected to their inputs rather than collapsing them to
object,Function,Record<string, any>, orany. Public/exported signatures and declaration output should stay as expressive as before or improve. - Handle
null/undefinedwith real checks, defaults that preserve current behavior, optional chaining, or by fixing the declared type. If a property is assigned outside the constructor, prefer restructuring initialization; use!only when an invariant is guaranteed and documented. - Use
thisparameters, overloads, or generics for callback/receiver typing problems.
Forbidden (in production code and in the project's normal tests):
- New
any(explicit,as any,Record<string, any>,any[],Function), double assertions (as unknown as T), unjustifiedas Tcasts, and broad non-null assertions (!). // @ts-ignore,// @ts-nocheck, and// @ts-expect-errorused to hide diagnostics. Same foreslint-disableof type-safety rules.- Changing runtime semantics to satisfy types (reordering initialization, altering defaults, adding or dropping branches, changing exports/module format). A type fix should not change emitted JavaScript behavior; if a real bug is exposed, make the smallest correct fix, call it out, and add or run a test for it.
If a diagnostic truly cannot be modeled (e.g. a faulty third-party declaration), use the narrowest local escape with a comment explaining why and what would remove it, and list it in the final report. Never use that as the default.
Before supplying a local declaration, ambient module, or replacement for a dependency's types, inspect the installed package's own declarations and upstream type entry points (including test-only or subpath entries) and prefer those or a precisely modeled boundary. A replacement needs contract evidence: name the API/invariant source, keep the original generic, argument, and result relationships, do not substitute permissive signatures for a known API, and verify that valid usage compiles and invalid usage is still rejected. A removal comment alone is not enough. Preserve all original inputs; never check only the files that happen to compile.
Legitimate exceptions vs. escapes
@ts-expect-errorin a dedicated negative type test that asserts something should not compile is a legitimate use. Keep such checks in test/type-test files, with a one-line reason, and report them as intentional rather than as strictness workarounds.- Pre-existing
any/casts that already existed before your change are not new regressions, but do not copy them into new code, and prefer tightening them when you edit those lines anyway. - Report counts for both so a reviewer can tell intentional or pre-existing items from newly introduced escapes.
4. Verify everything, not just the compiler
- Type-check every config found in step 1 (e.g.
tsc -pfor each, ortsc -b), including tests and declaration/build outputs. Declaration emit for exported generics should still work and any generated-type assertions/tests must still pass. - Run the project's original lint (e.g. ESLint, not just Prettier), build, and test commands in full, using the same runner configuration as before. Run the program/runtime or browser/Node entry points when relevant (including ESM/CJS variants).
- After touching
package.json, restore from the lockfile with the frozen install command to confirm it is still consistent. Do not use--no-package-lockor switch package managers. - Compare against the baseline. A new failure that was clean before is yours until proven otherwise; investigate rather than labeling it unrelated or flaky.
- Re-run diagnostics after each round of fixes; subagent or partial results do not replace a final whole-project check.
- Treat the completion ledger as real: dependencies restored, baseline finished, configs changed, diagnostics fixed, final checks finished. "Started" is not complete; continue past baseline setup through the final whole-project checks unless an unrecoverable blocker is reported.
- After the last semantic edit, audit the full patch, including new/untracked files:
any, assertions/casts,!,@ts-*and lint disables,.d.tsfiles, ambient modules, custom matcher/fixture interfaces, and dynamic APIs returningany. Distinguish pre-existing or moved patterns from new weakening.
5. Finish honestly
- Don't end with an unanswered question or pending work; make reasonable assumptions and state them.
- Never describe remaining compiler errors as warnings or declare success while checks fail.
- Final report must include a pass/fail/not-run ledger for: strict config coverage (list configs), compile, lint, tests, runtime, lockfile restore; plus remaining type errors, escape hatches used (including assertions and declaration shims, with reasons, matching the final patch), real bugs found, and any dependency/config changes. If you could not finish, say so plainly and describe the state.
<!-- prettier-ignore-end -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

