[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6WZMSDHM7W9Z06X10Y76TTK":3,"skill-same:01M6WZMSDHM7W9Z06X10Y76TTK":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":34,"linkOnly":35,"markdownContent":36,"markdownBody":37,"frontMatter":38,"refName":39,"commitSha":40,"skillDirectory":41,"forksCount":42,"repositoryHtmlUrl":43,"repositoryHomepageUrl":6,"ownerHtmlUrl":44,"ownerBlogUrl":45,"ownerDescription":46,"updatedAt":47,"install":48,"resources":61},"01M6WZMSDHM7W9Z06X10Y76TTK","typescript-strict",null,"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.","microsoft\u002Ftypescript-skills","microsoft","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6154722?v=4","01M698VYDXZ6JW5WH3CRV650R8","Microsoft","01M6WZMFFTDSMABFXBK4RG5787",2,"MIT","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-strict\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33],"typescript","typescript strict","migrate","behavior","fix","use","project","runtime","tests","type","types","errors","mode","codebase","when","2026-11-10 10:12:30",false,"---\nname: typescript-strict\ndescription: 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.\n---\n\n\u003C!-- prettier-ignore-start -->\n\nYour 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.\n\n## 1. Establish a baseline first\n\n- Read `package.json` (scripts, `packageManager`, `engines`), the lockfile(s), `.nvmrc`\u002F`.node-version`, and CI config to learn the authoritative package manager, Node version, and build\u002Flint\u002Ftest commands.\n- 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\u002F.bin\u002Ftsc` or use the manager's local resolution (`npm exec --no-install tsc -- -v`, `yarn tsc -v`, `pnpm exec tsc -v`). Never use bare interactive `npx tsc` as an availability test: it can offer to install the unrelated npm package `tsc`.\n- If dependencies or the compiler are missing, **execute** the frozen\u002Fimmutable 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 another `tsc`, and do not switch managers or versions merely to unblock.\n- 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.\n- Run the project's real build, lint, and test commands before changing anything and record the results, so later failures can be attributed correctly.\n- Enumerate **every** TypeScript config and input: `extends` chains, `references`, `tsconfig.*.json` (tests, scripts, build, declarations), per-package configs in monorepos, and test runner configs (ts-node\u002Fts-jest\u002Fmocha\u002Fvitest\u002Fjest). Test and secondary configs are in scope, not just the root one.\n\n## 2. Enable strictness\n\n- Set `\"strict\": true` in each config that type-checks project code (or in the shared base they extend). Do it for test and secondary configs too.\n- Do not add opt-outs to get green: no `strict: false`, `noImplicitAny: false`, `strictNullChecks: false`, `skipLibCheck` added for convenience, new `exclude` entries, narrower `include`\u002F`files`, `transpileOnly`\u002F`isolatedModules` test runners, or separate relaxed configs. Preserve original input membership and verification strength.\n- If the project is large, flags may be enabled incrementally (`noImplicitAny`, `strictNullChecks`, `strictFunctionTypes`, `strictPropertyInitialization`, `useUnknownInCatchVariables`, ...) but the end state must be `strict: true`.\n- This is not a compiler or dependency upgrade. Change tool\u002Fdependency versions only if strictness truly requires it (e.g. missing `@types\u002F*`), and keep the manifest, lockfile, and package manager in sync.\n\n## 3. Fix diagnostics by modeling types\n\nPrefer these, roughly in order:\n\n- Add precise annotations: structural interfaces\u002Ftype aliases, recursive data types, discriminated unions, literal types.\n- Narrow at boundaries: type guards, `in`\u002F`typeof`\u002F`instanceof` checks, and `unknown` for genuinely untyped input (JSON, catch variables, event payloads), validated before use.\n- Preserve generic relationships. Keep type parameters, mapped, conditional, and indexed-access types connected to their inputs rather than collapsing them to `object`, `Function`, `Record\u003Cstring, any>`, or `any`. Public\u002Fexported signatures and declaration output should stay as expressive as before or improve.\n- Handle `null`\u002F`undefined` with 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.\n- Use `this` parameters, overloads, or generics for callback\u002Freceiver typing problems.\n\nForbidden (in production code and in the project's normal tests):\n\n- New `any` (explicit, `as any`, `Record\u003Cstring, any>`, `any[]`, `Function`), double assertions (`as unknown as T`), unjustified `as T` casts, and broad non-null assertions (`!`).\n- `\u002F\u002F @ts-ignore`, `\u002F\u002F @ts-nocheck`, and `\u002F\u002F @ts-expect-error` used to hide diagnostics. Same for `eslint-disable` of type-safety rules.\n- Changing runtime semantics to satisfy types (reordering initialization, altering defaults, adding or dropping branches, changing exports\u002Fmodule 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.\n\nIf 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.\n\nBefore 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\u002Finvariant 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.\n\n### Legitimate exceptions vs. escapes\n\n- `@ts-expect-error` in a dedicated negative type test that asserts something _should not_ compile is a legitimate use. Keep such checks in test\u002Ftype-test files, with a one-line reason, and report them as intentional rather than as strictness workarounds.\n- Pre-existing `any`\u002Fcasts 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.\n- Report counts for both so a reviewer can tell intentional or pre-existing items from newly introduced escapes.\n\n## 4. Verify everything, not just the compiler\n\n- Type-check every config found in step 1 (e.g. `tsc -p` for each, or `tsc -b`), including tests and declaration\u002Fbuild outputs. Declaration emit for exported generics should still work and any generated-type assertions\u002Ftests must still pass.\n- 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\u002Fruntime or browser\u002FNode entry points when relevant (including ESM\u002FCJS variants).\n- After touching `package.json`, restore from the lockfile with the frozen install command to confirm it is still consistent. Do not use `--no-package-lock` or switch package managers.\n- Compare against the baseline. A new failure that was clean before is yours until proven otherwise; investigate rather than labeling it unrelated or flaky.\n- Re-run diagnostics after each round of fixes; subagent or partial results do not replace a final whole-project check.\n- 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.\n- After the last semantic edit, audit the full patch, including new\u002Funtracked files: `any`, assertions\u002Fcasts, `!`, `@ts-*` and lint disables, `.d.ts` files, ambient modules, custom matcher\u002Ffixture interfaces, and dynamic APIs returning `any`. Distinguish pre-existing or moved patterns from new weakening.\n\n## 5. Finish honestly\n\n- Don't end with an unanswered question or pending work; make reasonable assumptions and state them.\n- Never describe remaining compiler errors as warnings or declare success while checks fail.\n- Final report must include a pass\u002Ffail\u002Fnot-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\u002Fconfig changes. If you could not finish, say so plainly and describe the state.\n\n\u003C!-- prettier-ignore-end -->\n","\u003C!-- prettier-ignore-start -->\n\nYour 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.\n\n## 1. Establish a baseline first\n\n- Read `package.json` (scripts, `packageManager`, `engines`), the lockfile(s), `.nvmrc`\u002F`.node-version`, and CI config to learn the authoritative package manager, Node version, and build\u002Flint\u002Ftest commands.\n- 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\u002F.bin\u002Ftsc` or use the manager's local resolution (`npm exec --no-install tsc -- -v`, `yarn tsc -v`, `pnpm exec tsc -v`). Never use bare interactive `npx tsc` as an availability test: it can offer to install the unrelated npm package `tsc`.\n- If dependencies or the compiler are missing, **execute** the frozen\u002Fimmutable 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 another `tsc`, and do not switch managers or versions merely to unblock.\n- 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.\n- Run the project's real build, lint, and test commands before changing anything and record the results, so later failures can be attributed correctly.\n- Enumerate **every** TypeScript config and input: `extends` chains, `references`, `tsconfig.*.json` (tests, scripts, build, declarations), per-package configs in monorepos, and test runner configs (ts-node\u002Fts-jest\u002Fmocha\u002Fvitest\u002Fjest). Test and secondary configs are in scope, not just the root one.\n\n## 2. Enable strictness\n\n- Set `\"strict\": true` in each config that type-checks project code (or in the shared base they extend). Do it for test and secondary configs too.\n- Do not add opt-outs to get green: no `strict: false`, `noImplicitAny: false`, `strictNullChecks: false`, `skipLibCheck` added for convenience, new `exclude` entries, narrower `include`\u002F`files`, `transpileOnly`\u002F`isolatedModules` test runners, or separate relaxed configs. Preserve original input membership and verification strength.\n- If the project is large, flags may be enabled incrementally (`noImplicitAny`, `strictNullChecks`, `strictFunctionTypes`, `strictPropertyInitialization`, `useUnknownInCatchVariables`, ...) but the end state must be `strict: true`.\n- This is not a compiler or dependency upgrade. Change tool\u002Fdependency versions only if strictness truly requires it (e.g. missing `@types\u002F*`), and keep the manifest, lockfile, and package manager in sync.\n\n## 3. Fix diagnostics by modeling types\n\nPrefer these, roughly in order:\n\n- Add precise annotations: structural interfaces\u002Ftype aliases, recursive data types, discriminated unions, literal types.\n- Narrow at boundaries: type guards, `in`\u002F`typeof`\u002F`instanceof` checks, and `unknown` for genuinely untyped input (JSON, catch variables, event payloads), validated before use.\n- Preserve generic relationships. Keep type parameters, mapped, conditional, and indexed-access types connected to their inputs rather than collapsing them to `object`, `Function`, `Record\u003Cstring, any>`, or `any`. Public\u002Fexported signatures and declaration output should stay as expressive as before or improve.\n- Handle `null`\u002F`undefined` with 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.\n- Use `this` parameters, overloads, or generics for callback\u002Freceiver typing problems.\n\nForbidden (in production code and in the project's normal tests):\n\n- New `any` (explicit, `as any`, `Record\u003Cstring, any>`, `any[]`, `Function`), double assertions (`as unknown as T`), unjustified `as T` casts, and broad non-null assertions (`!`).\n- `\u002F\u002F @ts-ignore`, `\u002F\u002F @ts-nocheck`, and `\u002F\u002F @ts-expect-error` used to hide diagnostics. Same for `eslint-disable` of type-safety rules.\n- Changing runtime semantics to satisfy types (reordering initialization, altering defaults, adding or dropping branches, changing exports\u002Fmodule 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.\n\nIf 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.\n\nBefore 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\u002Finvariant 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.\n\n### Legitimate exceptions vs. escapes\n\n- `@ts-expect-error` in a dedicated negative type test that asserts something _should not_ compile is a legitimate use. Keep such checks in test\u002Ftype-test files, with a one-line reason, and report them as intentional rather than as strictness workarounds.\n- Pre-existing `any`\u002Fcasts 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.\n- Report counts for both so a reviewer can tell intentional or pre-existing items from newly introduced escapes.\n\n## 4. Verify everything, not just the compiler\n\n- Type-check every config found in step 1 (e.g. `tsc -p` for each, or `tsc -b`), including tests and declaration\u002Fbuild outputs. Declaration emit for exported generics should still work and any generated-type assertions\u002Ftests must still pass.\n- 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\u002Fruntime or browser\u002FNode entry points when relevant (including ESM\u002FCJS variants).\n- After touching `package.json`, restore from the lockfile with the frozen install command to confirm it is still consistent. Do not use `--no-package-lock` or switch package managers.\n- Compare against the baseline. A new failure that was clean before is yours until proven otherwise; investigate rather than labeling it unrelated or flaky.\n- Re-run diagnostics after each round of fixes; subagent or partial results do not replace a final whole-project check.\n- 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.\n- After the last semantic edit, audit the full patch, including new\u002Funtracked files: `any`, assertions\u002Fcasts, `!`, `@ts-*` and lint disables, `.d.ts` files, ambient modules, custom matcher\u002Ffixture interfaces, and dynamic APIs returning `any`. Distinguish pre-existing or moved patterns from new weakening.\n\n## 5. Finish honestly\n\n- Don't end with an unanswered question or pending work; make reasonable assumptions and state them.\n- Never describe remaining compiler errors as warnings or declare success while checks fail.\n- Final report must include a pass\u002Ffail\u002Fnot-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\u002Fconfig changes. If you could not finish, say so plainly and describe the state.\n\n\u003C!-- prettier-ignore-end -->\n",{"name":5,"description":7},"main","9cde090939915a885f841aa6bd65a400ed9f0a62","plugins\u002Ftypescript\u002Fskills\u002Ftypescript-strict",1,"https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills","https:\u002F\u002Fgithub.com\u002Fmicrosoft","https:\u002F\u002Fopensource.microsoft.com","Open source projects and samples from Microsoft","2026-11-12 03:28:24",{"source":8,"skillName":5,"commands":49,"prompt":59,"zipAvailable":60},[50,53,56],{"tool":51,"command":52},"npx","npx skills add microsoft\u002Ftypescript-skills --skill typescript-strict",{"tool":54,"command":55},"bunx","bunx skills add microsoft\u002Ftypescript-skills --skill typescript-strict",{"tool":57,"command":58},"pnpm","pnpm dlx skills add microsoft\u002Ftypescript-skills --skill typescript-strict","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-strict\u002FSKILL.md",true,[],[63,71,79,96,110],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":70},"01M766YH7K5M0NJSEZNG76QMVA","typescript-report-issue","Invoke with `\u002Ftypescript-report-issue`. Skill Version 1.0","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-report-issue\u002FSKILL.md",[],[],"2026-11-12 13:55:43",{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":78},"01M747T17SK99AA82CEJ97YTX1","typescript-publish-types","How to publish TypeScript declarations from an npm package so consumers actually resolve them. Use this when asked to add types\u002Ftypings to a package, ship .d.ts files, fix \"Could not find a declaration file for module\", or make a package's published types resolve correctly.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-publish-types\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":34},"01M6WZMXY0XGSDCFPNDSS8XD55","typescript-update","Guidance for updating to the newer versions of TypeScript. Use this when you need to upgrade TypeScript or as part of a larger dependency update process.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-update\u002FSKILL.md",[],[19,86,87,88,89,90,91,24,33,92,93,94,95],"update","typescript update","for","as","dependency update","upgrade","you","dependency","process","guidance",{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":34},"01M6WZMNT6EZNR2A7W527T63E9","typescript-project-setup","How to set up a new TypeScript project","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-project-setup\u002FSKILL.md",[],[19,103,25,104,105,106,107,108,109],"setup","project setup","typescript project setup","how to","how","up","SET",{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":114,"categories":115,"keywords":116,"publishedAt":34},"01M6WZMHKQ6JP3DMJWG4MG90RB","typescript-build-references","Guidance for configuring TypeScript project references and incremental builds (`tsc -b`\u002F`--build`, `composite`, solution-style tsconfigs) and declaration emission (`.d.ts` files) with `isolatedDeclarations` in an existing repo or monorepo. Use this whenever asked to add project references, build mode, incremental builds, declaration files, or isolated declarations, even when the repo already has a working build or bundler.","https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Ftypescript-skills\u002Fblob\u002Fmain\u002Fplugins\u002Ftypescript\u002Fskills\u002Ftypescript-build-references\u002FSKILL.md",[],[117,19,118,119,120,121,88,25,122,31,123,124,125,95,126,127,33,128,24,129],"references","build","typescript build references","existing repo","monorepo","repo","project references","add","bundler","style","with","Existing","files"]