[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DDY80JD40DX7FG8DGVMKJC":3,"skill-same:01M7DDY80JD40DX7FG8DGVMKJC":58},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":14,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":34,"install":35,"resources":48},"01M7DDY80JD40DX7FG8DGVMKJC","typescript-best-practices",null,"Applies concrete TypeScript type, boundary, API, and test rules when reading, writing, reviewing, or refactoring .ts and .tsx files. Use to model state honestly, remove unchecked casts, derive types from authoritative schemas, and keep external validation at boundaries.","daanqq\u002F.claude","daanqq","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F57527208?v=4","01M72TZR3C4TYNMFAFGKK77N2K","Danila Andreev","01M7DDTFETAKSFM5D6QAPK2E7J",0,"MIT","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: typescript-best-practices\ndescription: Applies concrete TypeScript type, boundary, API, and test rules when reading, writing, reviewing, or refactoring .ts and .tsx files. Use to model state honestly, remove unchecked casts, derive types from authoritative schemas, and keep external validation at boundaries.\nlicense: LICENSE\nmetadata:\n  source: https:\u002F\u002Fgithub.com\u002Fcursor\u002Fplugins\u002Ftree\u002F57fc467a229cf2853329f19c9e6a9fd83ddc2ea2\u002Fpstack\u002Fskills\u002Ftypescript-best-practices\n  adapted-for: claude-code\n---\n\n# TypeScript best practices\n\nApply these rules with repository conventions and the existing code's real constraints. The aim is fewer invalid states and clearer boundaries, not maximum type cleverness.\n\n| Rule | Decision |\n| --- | --- |\n| Discriminated unions | Model variants with one literal discriminant when optional fields or booleans allow contradictory states. |\n| Constructive modeling | Choose a representation that makes the important illegal value hard to construct. Use `NonEmpty\u003CT>`, pairs, ranges, or branded primitives only when a real caller otherwise needs a cast, assertion, or repeated guard. |\n| Simplest total type | Keep the looser type while all operations remain total. Strengthen inputs or widen outputs only where partiality reaches a caller. |\n| `unknown` at external boundaries | Treat parsed JSON, RPC, IPC, storage, environment, and untyped library data as `unknown`; parse or narrow once where it enters. |\n| Unchecked casts | Remove `as` casts that merely silence the compiler. A boundary cast is acceptable only after the code validates the full claim or a library limitation makes the assertion unavoidable and locally justified. |\n| Narrowing order | Prefer discriminants, `in`, `typeof` or `instanceof`, then an honest type guard. Use an assertion only after those options fail for a concrete reason. |\n| Exhaustiveness | Make variant handling fail the build when a new case is unhandled, usually with an inline `never` assignment. |\n| `satisfies` | Prefer `satisfies` when a value must conform to a type without widening its literals. |\n| Schema-derived types | Derive from generated or authoritative types with `Pick`, `Omit`, `Parameters`, `ReturnType`, `Awaited`, or `typeof` before duplicating a shape. |\n| Object parameters | Prefer an object when positional arguments are easy to swap or the call has several optional settings. Keep positional arguments for small conventional APIs and measured hot paths. |\n| Boundary errors | Parse and translate errors at the system edge. Keep internal domain functions typed and direct instead of revalidating the same shape down the call chain. |\n| Tests | Test behavior through the owning interface with the narrowest real executable path. Use mocks only for boundaries that cannot run locally or are intentionally isolated. |\n| Telemetry | Follow the repository logger and diagnostics conventions. Include stable identifiers and actionable context; do not add ad hoc shipped `console.log` calls. |\n\nRead [`references\u002Fpatterns.md`](references\u002Fpatterns.md) when implementing one of these patterns or judging an exception.\n\n## Review posture\n\n- Match the repository's established discriminant, brand, error, and schema conventions before inventing another.\n- Flag a type issue only when it enables a real invalid state, hides boundary uncertainty, forces assertions, or spreads knowledge across callers.\n- Prefer a small local improvement over a type-system rewrite unrelated to the requested change.\n- Do not weaken a truthful runtime possibility merely to obtain a narrower type.\n- When a framework or generated API forces a cast, keep it at one boundary and explain the non-obvious reason if the code cannot make it evident.\n","# TypeScript best practices\n\nApply these rules with repository conventions and the existing code's real constraints. The aim is fewer invalid states and clearer boundaries, not maximum type cleverness.\n\n| Rule | Decision |\n| --- | --- |\n| Discriminated unions | Model variants with one literal discriminant when optional fields or booleans allow contradictory states. |\n| Constructive modeling | Choose a representation that makes the important illegal value hard to construct. Use `NonEmpty\u003CT>`, pairs, ranges, or branded primitives only when a real caller otherwise needs a cast, assertion, or repeated guard. |\n| Simplest total type | Keep the looser type while all operations remain total. Strengthen inputs or widen outputs only where partiality reaches a caller. |\n| `unknown` at external boundaries | Treat parsed JSON, RPC, IPC, storage, environment, and untyped library data as `unknown`; parse or narrow once where it enters. |\n| Unchecked casts | Remove `as` casts that merely silence the compiler. A boundary cast is acceptable only after the code validates the full claim or a library limitation makes the assertion unavoidable and locally justified. |\n| Narrowing order | Prefer discriminants, `in`, `typeof` or `instanceof`, then an honest type guard. Use an assertion only after those options fail for a concrete reason. |\n| Exhaustiveness | Make variant handling fail the build when a new case is unhandled, usually with an inline `never` assignment. |\n| `satisfies` | Prefer `satisfies` when a value must conform to a type without widening its literals. |\n| Schema-derived types | Derive from generated or authoritative types with `Pick`, `Omit`, `Parameters`, `ReturnType`, `Awaited`, or `typeof` before duplicating a shape. |\n| Object parameters | Prefer an object when positional arguments are easy to swap or the call has several optional settings. Keep positional arguments for small conventional APIs and measured hot paths. |\n| Boundary errors | Parse and translate errors at the system edge. Keep internal domain functions typed and direct instead of revalidating the same shape down the call chain. |\n| Tests | Test behavior through the owning interface with the narrowest real executable path. Use mocks only for boundaries that cannot run locally or are intentionally isolated. |\n| Telemetry | Follow the repository logger and diagnostics conventions. Include stable identifiers and actionable context; do not add ad hoc shipped `console.log` calls. |\n\nRead [`references\u002Fpatterns.md`](references\u002Fpatterns.md) when implementing one of these patterns or judging an exception.\n\n## Review posture\n\n- Match the repository's established discriminant, brand, error, and schema conventions before inventing another.\n- Flag a type issue only when it enables a real invalid state, hides boundary uncertainty, forces assertions, or spreads knowledge across callers.\n- Prefer a small local improvement over a type-system rewrite unrelated to the requested change.\n- Do not weaken a truthful runtime possibility merely to obtain a narrower type.\n- When a framework or generated API forces a cast, keep it at one boundary and explain the non-obvious reason if the code cannot make it evident.\n",{"name":5,"license":25,"metadata":26,"description":7},"LICENSE",{"source":27,"adapted-for":28},"https:\u002F\u002Fgithub.com\u002Fcursor\u002Fplugins\u002Ftree\u002F57fc467a229cf2853329f19c9e6a9fd83ddc2ea2\u002Fpstack\u002Fskills\u002Ftypescript-best-practices","claude-code","main","c17edd5f6f72662431bafdcf586a44119178b8e0","skills\u002Ftypescript-best-practices","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude","https:\u002F\u002Fgithub.com\u002Fdaanqq","2026-09-29 14:24:51",{"source":8,"skillName":5,"commands":36,"prompt":46,"zipAvailable":47},[37,40,43],{"tool":38,"command":39},"npx","npx skills add daanqq\u002F.claude --skill typescript-best-practices",{"tool":41,"command":42},"bunx","bunx skills add daanqq\u002F.claude --skill typescript-best-practices",{"tool":44,"command":45},"pnpm","pnpm dlx skills add daanqq\u002F.claude --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",true,[49,52],{"path":25,"resourceType":25,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":16},"许可证",1067,{"path":53,"resourceType":54,"resourceTypeDesc":55,"sizeBytes":56,"sourceHtmlUrl":57},"references\u002Fpatterns.md","REFERENCE","参考文档",3881,"https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002Freferences\u002Fpatterns.md",[59,67,74,82,90,98],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":63,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":20},"01M7DDYVMG4XK77ZR82GPZYC36","why","Investigates why code, a threshold, guard, workflow, or design decision exists. Use for historical rationale, regressions, postmortems, legacy removal, rejected alternatives, and product or operational constraints. Separates direct evidence from inference and reports unavailable sources. Use how for runtime mechanics.","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fwhy\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fwhy\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":20},"01M7DDYMPWZG2CFJ2SY527S185","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-react-best-practices\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":78,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":20},"01M7DDXP2YPXWSDCDN5KVNP1V4","show-me-your-work","Keeps a compact, reviewable TSV decision trail for long-running, multi-phase, delegated, or unattended work. Use when the user will review the work after a pause, when hypotheses or pivots must remain auditable, or when another skill needs a canonical evidence log.","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fshow-me-your-work\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fshow-me-your-work\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":86,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":20},"01M7DDX9DMT9VSGGH2BQ8PWQ4Y","prove-it-works","Verifies completed work against the real artifact and behavior rather than a build, cached representation, tool summary, or agent self-report. Use before declaring an implementation, fix, migration, generated artifact, configuration change, or delegated task complete.","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fprove-it-works\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fprove-it-works\u002FSKILL.md",[],[],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":94,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":20},"01M7DDW85X8B2MQHNRN6TWQWH5","how","Explains how a subsystem, feature flow, or function works and where its logic belongs. Use for code walkthroughs, runtime traces, ownership and layering questions, onboarding mental models, or architectural critique before changing code. Use historical investigation separately when the question is why the design exists.","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fhow\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fhow\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":102,"sourceHtmlUrl":103,"categories":104,"keywords":105,"publishedAt":20},"01M7DDTK9VVHYY4WSQ4YSTWEG9","blast-radius","Finds behavior outside a diff that a change could break and proves the load-bearing safety fact with the cheapest executable check. Use when asked what a change could break, when reviewing a deceptively small high-risk diff, or before shipping changes to shared state, protocols, lifecycle code, or external boundaries.","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fblast-radius\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fdaanqq\u002F.claude\u002Fblob\u002Fmain\u002Fskills\u002Fblast-radius\u002FSKILL.md",[],[]]