[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M750EWQG73FRRSA065D2NMRZ":3,"skill-same:01M750EWQG73FRRSA065D2NMRZ":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":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":33,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M750EWQG73FRRSA065D2NMRZ","typescript-best-practices",null,"TypeScript best practices. Use when reading or editing any .ts or .tsx file.","michael-denyer\u002Fpstack-claude","michael-denyer","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F97485362?v=4","01M7509NWA6PC2Z183SZ6D78FT","Michael Denyer","01M7509NX1YE4AYWW6Y30TCCRV",4309,"MIT","https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: typescript-best-practices\ndescription: TypeScript best practices. Use when reading or editing any .ts or .tsx file.\npaths: [\"**\u002F*.ts\", \"**\u002F*.tsx\"]\n---\n\n# TypeScript best practices\n\nOn Muse, read the [platform mapping](..\u002Fpoteto-mode\u002Freferences\u002Fmuse-tools.md), including its per-skill notes, before following this skill.\n\nApply the **type-system-discipline** principle skill first.\n\n| Rule | Summary |\n|------|---------|\n| Discriminated unions | Model variants with a `kind` literal discriminant so impossible states can't be represented. No optional-field bags. |\n| Branded types | Brand primitives with `& { readonly __brand: \"X\" }` so they can't be mixed up. Validate once at the boundary. A brand comes from a verifying type guard (`input is AgentId`), never from `as`. |\n| Constructive modeling | Build the shape so the illegal value can't be constructed. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, not a wish for refinement types. |\n| Simplest total type | Keep `T[]` while every operation on it stays total. Strengthen to `NonEmpty\u003CT>` only where the loose type forces `!`, a cast, or a \"should never happen\" throw. |\n| `unknown` over `any` | External data is `unknown`. |\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| No `as` casts | Every `as` is a runtime crash waiting. Cast only after validation. |\n| Narrowing hierarchy | Discriminant switch > `in` operator > `typeof`\u002F`instanceof` > user-defined type guard > `as`. |\n| Type guards | Must verify the claim. A lying guard is worse than `as` because the bug hides behind a name that says it's safe. Name them `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` | Validates the value without widening literal types. |\n| Boundary validation | Parse where data crosses in, into a named domain type. `Record\u003Cstring, unknown>` (however spelled) stops at that parse. Trust types inside. See the **boundary-discipline** principle skill. |\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 | Pass objects, not positional, so argument order is self-documenting. Skip on hot paths (per-frame render, tokenizers, parsers). |\n| Real tests | Don't mock what you can run. Prefer the framework's real test primitives with leak\u002Fdisposable checks, and verify UI in a running build. Mock only what you can't run locally. |\n| Structured telemetry | Prefer structured logger diagnostics with enough context to debug from an id. No `console.log` in shipped code. |\n\nExamples: `references\u002Fpatterns.md`.\n","# TypeScript best practices\n\nOn Muse, read the [platform mapping](..\u002Fpoteto-mode\u002Freferences\u002Fmuse-tools.md), including its per-skill notes, before following this skill.\n\nApply the **type-system-discipline** principle skill first.\n\n| Rule | Summary |\n|------|---------|\n| Discriminated unions | Model variants with a `kind` literal discriminant so impossible states can't be represented. No optional-field bags. |\n| Branded types | Brand primitives with `& { readonly __brand: \"X\" }` so they can't be mixed up. Validate once at the boundary. A brand comes from a verifying type guard (`input is AgentId`), never from `as`. |\n| Constructive modeling | Build the shape so the illegal value can't be constructed. `[T, ...T[]]` for non-empty, `[T, T][]` for even length, `start` plus `duration` for a range. Not a runtime guard, not a wish for refinement types. |\n| Simplest total type | Keep `T[]` while every operation on it stays total. Strengthen to `NonEmpty\u003CT>` only where the loose type forces `!`, a cast, or a \"should never happen\" throw. |\n| `unknown` over `any` | External data is `unknown`. |\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| No `as` casts | Every `as` is a runtime crash waiting. Cast only after validation. |\n| Narrowing hierarchy | Discriminant switch > `in` operator > `typeof`\u002F`instanceof` > user-defined type guard > `as`. |\n| Type guards | Must verify the claim. A lying guard is worse than `as` because the bug hides behind a name that says it's safe. Name them `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` | Validates the value without widening literal types. |\n| Boundary validation | Parse where data crosses in, into a named domain type. `Record\u003Cstring, unknown>` (however spelled) stops at that parse. Trust types inside. See the **boundary-discipline** principle skill. |\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 | Pass objects, not positional, so argument order is self-documenting. Skip on hot paths (per-frame render, tokenizers, parsers). |\n| Real tests | Don't mock what you can run. Prefer the framework's real test primitives with leak\u002Fdisposable checks, and verify UI in a running build. Mock only what you can't run locally. |\n| Structured telemetry | Prefer structured logger diagnostics with enough context to debug from an id. No `console.log` in shipped code. |\n\nExamples: `references\u002Fpatterns.md`.\n",{"name":5,"paths":24,"description":7},[25,26],"**\u002F*.ts","**\u002F*.tsx","main","bc09365fe61c725c486ba95157fc4048bf8a0b99","plugins\u002Fpstack\u002Fskills\u002Ftypescript-best-practices",397,"https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude","https:\u002F\u002Fgithub.com\u002Fmichael-denyer","https:\u002F\u002Fwww.wisdompanel.com\u002F","Software Engineer and Bioinformatician","2026-11-13 23:53:05",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add michael-denyer\u002Fpstack-claude --skill typescript-best-practices",{"tool":42,"command":43},"bunx","bunx skills add michael-denyer\u002Fpstack-claude --skill typescript-best-practices",{"tool":45,"command":46},"pnpm","pnpm dlx skills add michael-denyer\u002Fpstack-claude --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",true,[50],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fpatterns.md","REFERENCE","参考文档",9287,"https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Ftypescript-best-practices\u002Freferences\u002Fpatterns.md",[57,64,71,78,85,92],{"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":19},"01M750F31RNVHGK1JVWBJHDGTX","why","Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.","https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Fwhy\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":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M750F17NKT7YCP8ND5675XHN","what-did-i-get-done","Summarize authored commits over a user-specified time period into a concise update","https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Fwhat-did-i-get-done\u002FSKILL.md",[],[],{"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":19},"01M750EYD7DP60DDPQY6GK3TTR","unslop","Cut AI tells from any writing.","https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Funslop\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M750ETTMA3MB36DJQJ1H4QGB","thermos","Launch both thermo-nuclear review subagents in parallel, then synthesize their findings. Use for thermos, double thermo review, or combined bug\u002Fsecurity and code-quality branch audits.","https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Fthermos\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M750EQVQMQSW08KYGM7TG8K0","thermo-nuclear-review","Comprehensive security and correctness audit of a branch's changes. Use for thermo nuclear, thermonuclear, or deep review requests, or branch\u002FPR diff audits focused on bugs, breaking changes, security issues, devex regressions, and feature-gate leaks.","https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Fthermo-nuclear-review\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M750EMSQRV350CZRPH928YSM","thermo-nuclear-code-quality-review","Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review.","https:\u002F\u002Fgithub.com\u002Fmichael-denyer\u002Fpstack-claude\u002Fblob\u002Fmain\u002Fplugins\u002Fpstack\u002Fskills\u002Fthermo-nuclear-code-quality-review\u002FSKILL.md",[],[]]