[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75R6KSYDTTZQ0XQE7FCBYVX":3,"skill-same:01M75R6KSYDTTZQ0XQE7FCBYVX":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M75R6KSYDTTZQ0XQE7FCBYVX","typescript-best-practices",null,"TypeScript best practices. Use when reading or editing any .ts or .tsx file.","TheDarkSkyXD\u002FSuperDevAgents","TheDarkSkyXD","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F34119991?v=4","01M75491CAR2M915CJW2NKRTE7","01M75R09ATEWYMSRKW981X1EPY",1,"MIT","https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002F.agents\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](..\u002Fsuperdev-mode\u002Freferences\u002Fmuse-tools.md), including its per-skill notes, before following this skill.\n\nRead [the portable runtime contract](..\u002Fsuperdev-mode\u002Freferences\u002Fportable-runtime.md) before following this workflow.\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](..\u002Fsuperdev-mode\u002Freferences\u002Fmuse-tools.md), including its per-skill notes, before following this skill.\n\nRead [the portable runtime contract](..\u002Fsuperdev-mode\u002Freferences\u002Fportable-runtime.md) before following this workflow.\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":23,"description":7},[24,25],"**\u002F*.ts","**\u002F*.tsx","main","5440d26a8d527a55c691e544ae0e4e23e89e7157",".agents\u002Fskills\u002Ftypescript-best-practices",0,"https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents","https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD","2026-11-12 09:54:48",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add TheDarkSkyXD\u002FSuperDevAgents --skill typescript-best-practices",{"tool":39,"command":40},"bunx","bunx skills add TheDarkSkyXD\u002FSuperDevAgents --skill typescript-best-practices",{"tool":42,"command":43},"pnpm","pnpm dlx skills add TheDarkSkyXD\u002FSuperDevAgents --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",true,[47],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Fpatterns.md","REFERENCE","参考文档",9287,"https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Ftypescript-best-practices\u002Freferences\u002Fpatterns.md",[54,61,68,75,82,89],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":58,"categories":59,"keywords":60,"publishedAt":18},"01M75RDJ9BA2E6J9NNCB1N7K56","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\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002Fplugins\u002Fsuperdev\u002Fskills\u002Fwhy\u002FSKILL.md",[],[],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M75RDFHCYADBVWTXG3AAZC09","what-did-i-get-done","Summarize authored commits over a user-specified time period into a concise update","https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002Fplugins\u002Fsuperdev\u002Fskills\u002Fwhat-did-i-get-done\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":18},"01M75RDDK5WRB8PJ8PN7N6EWNZ","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\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002Fplugins\u002Fsuperdev\u002Fskills\u002Fwayfinder\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":18},"01M75RD9SZ9223AT30NA53XJ44","unslop","Cut AI tells from any writing.","https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002Fplugins\u002Fsuperdev\u002Fskills\u002Funslop\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M75RD7H5QRBN7DDGHX76JE4J","universal-architecture","Apply responsibility-based architecture and enforce import boundaries. Use for code placement, architecture reviews, adapters, CLI entry points, platform sharing, and ESLint boundary rules.","https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002Fplugins\u002Fsuperdev\u002Fskills\u002Funiversal-architecture\u002FSKILL.md",[],[],{"skillNo":90,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M75RD5G2WGMRJKS5F7R7EW6N","https:\u002F\u002Fgithub.com\u002FTheDarkSkyXD\u002FSuperDevAgents\u002Fblob\u002Fmain\u002Fplugins\u002Fsuperdev\u002Fskills\u002Ftypescript-best-practices\u002FSKILL.md",[],[]]