[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CP2PR7H94C2GW8SXAB948K":3,"skill-same:01M7CP2PR7H94C2GW8SXAB948K":56},{"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":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M7CP2PR7H94C2GW8SXAB948K","typescript-best-practices",null,"TypeScript guidance. Use when writing or reviewing .ts or .tsx code.","syanga\u002Fastack","syanga","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42523849?v=4","01M7CNYD2SW40HXC8R8CTVJPGE","Alan Yang","01M7CNYD3D0B0EYPA4AGXC1VC8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002FLICENSE-pstack","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: typescript-best-practices\ndescription: TypeScript guidance. Use when writing or reviewing .ts or .tsx code.\n---\n\n# TypeScript best practices\n\nApply [type system discipline](..\u002Fprinciples\u002Ftype-system-discipline.md) first. Follow the repository's compiler settings, schema libraries, and established type conventions. Apply these rules to the requested change.\n\n| Rule | Summary |\n|------|---------|\n| Schemas before guards | Before hand-writing a property-by-property type guard, use the repository's runtime schema library and infer the type from the schema, such as `z.infer`. |\n| Type assertions | Prefer narrowing to assertions. Justify unavoidable assertions with validation or a demonstrated invariant. `as const` preserves literals; it does not validate external data. |\n| Narrowing hierarchy | Discriminant switch > `in` operator > `typeof`\u002F`instanceof` > user-defined type guard > `as`. |\n| Type guards | Verify every property the predicate claims. Name guards `isX` or `hasX`. |\n| Exhaustiveness | Inline `const _exhaustive: never = x;` in default arms so the compiler errors when a new variant is added. |\n| `satisfies` over `as` | Check assignability without replacing the expression's inferred type with the target type. It supplies no runtime validation. |\n| Schema-derived types | Reach for `Pick`\u002F`Omit`\u002F`Parameters`\u002F`ReturnType`\u002F`Awaited`\u002F`typeof` before declaring a new interface. |\n| Object args | Prefer named options where positional arguments are easy to confuse. Keep simple positional APIs and existing conventions when clear. Measure allocation concerns before changing a hot path. |\n\nRead the relevant [patterns](references\u002Fpatterns.md) for examples. The calling workflow owns verification, evidence reuse, and finding disposition. Optional style advice does not expand scope.\n","# TypeScript best practices\n\nApply [type system discipline](..\u002Fprinciples\u002Ftype-system-discipline.md) first. Follow the repository's compiler settings, schema libraries, and established type conventions. Apply these rules to the requested change.\n\n| Rule | Summary |\n|------|---------|\n| Schemas before guards | Before hand-writing a property-by-property type guard, use the repository's runtime schema library and infer the type from the schema, such as `z.infer`. |\n| Type assertions | Prefer narrowing to assertions. Justify unavoidable assertions with validation or a demonstrated invariant. `as const` preserves literals; it does not validate external data. |\n| Narrowing hierarchy | Discriminant switch > `in` operator > `typeof`\u002F`instanceof` > user-defined type guard > `as`. |\n| Type guards | Verify every property the predicate claims. Name guards `isX` or `hasX`. |\n| Exhaustiveness | Inline `const _exhaustive: never = x;` in default arms so the compiler errors when a new variant is added. |\n| `satisfies` over `as` | Check assignability without replacing the expression's inferred type with the target type. It supplies no runtime validation. |\n| Schema-derived types | Reach for `Pick`\u002F`Omit`\u002F`Parameters`\u002F`ReturnType`\u002F`Awaited`\u002F`typeof` before declaring a new interface. |\n| Object args | Prefer named options where positional arguments are easy to confuse. Keep simple positional APIs and existing conventions when clear. Measure allocation concerns before changing a hot path. |\n\nRead the relevant [patterns](references\u002Fpatterns.md) for examples. The calling workflow owns verification, evidence reuse, and finding disposition. Optional style advice does not expand scope.\n",{"name":5,"description":7},"main","ec1ea5dc71f382a2a09360a736d31b7294e5ecc2","skills\u002Ftypescript-best-practices","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack","https:\u002F\u002Fgithub.com\u002Fsyanga","2026-11-14 17:01:29",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add syanga\u002Fastack --skill typescript-best-practices",{"tool":37,"command":38},"bunx","bunx skills add syanga\u002Fastack --skill typescript-best-practices",{"tool":40,"command":41},"pnpm","pnpm dlx skills add syanga\u002Fastack --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",true,[45,50],{"path":46,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":16},"LICENSE-pstack","LICENSE","许可证",1067,{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fpatterns.md","REFERENCE","参考文档",7737,"https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Ftypescript-best-practices\u002Freferences\u002Fpatterns.md",[57,64,72,80,88,96],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":20},"01M7CP39S6D7662SFCC9K286T7","replace-with-skill-name","Replace with when this skill should be reached.","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Ftemplates\u002Fskill\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":68,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":20},"01M7CP37YN62Z7VR6P2J7918ZA","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-for-agents\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-for-agents\u002FSKILL.md",[],[],{"skillNo":73,"name":74,"nameZh":6,"description":75,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":20},"01M7CP353RP2S1M1ZMHFZ0F610","worktree-cleanup","Worktree cleanup. Use for cleanup, resource audits, close this lane, or close out.","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fworktree-cleanup\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fworktree-cleanup\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":84,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":20},"01M7CP32DSVPRTBAFHF1P6NZ1X","wizard","Generate an interactive Bash wizard that walks a human through steps only they can perform. Use when provisioning, credential setup, or a one-off migration needs such steps.","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwizard\u002FLICENSE-mattpocock","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwizard\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":92,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":20},"01M7CP2YE3WABQE9MNY8RQD6MX","why","Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Returns a cited read on decisions and tradeoffs.","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwhy\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwhy\u002FSKILL.md",[],[],{"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":100,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":20},"01M7CP2VP8JA1HYDE8TJX2Y494","wayfinder","Plan a huge chunk of work (more than one agent session can hold) as a shared map of decision tickets on your issue tracker, and resolve them one at a time until the way to the destination is clear.","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwayfinder\u002FLICENSE-mattpocock","https:\u002F\u002Fgithub.com\u002Fsyanga\u002Fastack\u002Fblob\u002Fmain\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[]]