[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78D5PN73KA6B88JVHABNTKY":3,"skill-same:01M78D5PN73KA6B88JVHABNTKY":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":30,"updatedAt":31,"install":32,"resources":45},"01M78D5PN73KA6B88JVHABNTKY","typescript-best-practices",null,"TypeScript best practices. Use when reading or editing any .ts or .tsx file.","emo-eth\u002Fskills","emo-eth","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F6371847?v=4","01M78CWE28WS3JH2WXYPRNC26K","James","01M78CWE2YS6Y5883W8J0D60XA",0,"MIT","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Ftypescript-best-practices\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Ftypescript-best-practices\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: typescript-best-practices\ndescription: TypeScript best practices. Use when reading or editing any .ts or .tsx file.\n---\n\n# TypeScript best practices\n\nApply the **type-system-discipline** principle skill first; this skill grounds it in TypeScript syntax.\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 creation. |\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`. `any` disables type checking everywhere it touches. |\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\nApply the **type-system-discipline** principle skill first; this skill grounds it in TypeScript syntax.\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 creation. |\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`. `any` disables type checking everywhere it touches. |\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,"description":7},"main","556c6b2a01f1f75137a940333ffc8bd95cf0756e","skills\u002Fpstack\u002Ftypescript-best-practices","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills","https:\u002F\u002Fgithub.com\u002Femo-eth","I make music and write code","2026-11-13 05:13:04",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add emo-eth\u002Fskills --skill typescript-best-practices",{"tool":38,"command":39},"bunx","bunx skills add emo-eth\u002Fskills --skill typescript-best-practices",{"tool":41,"command":42},"pnpm","pnpm dlx skills add emo-eth\u002Fskills --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Ftypescript-best-practices\u002FSKILL.md",true,[46,50],{"path":47,"resourceType":47,"resourceTypeDesc":48,"sizeBytes":49,"sourceHtmlUrl":16},"LICENSE","许可证",1067,{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"references\u002Fpatterns.md","REFERENCE","参考文档",8695,"https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\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},"01M78D75SMNM5JJXJGN9W6Z304","system-vibe","Personal operating-system contract for the home fleet, sync, SSH, skills, Herdr, and local inference. Use when diagnosing or changing machines, chezmoi, SSH, skill distribution, Windows sleep\u002Fwake, or the local model router. This is the qualitative list of what must stay true; agents invent enforcement from the clauses, not from tribal setup lore.","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fsystem-vibe\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":68,"licenseFileUrl":6,"sourceHtmlUrl":69,"categories":70,"keywords":71,"publishedAt":20},"01M78D65Z8HK3VTSAWKC59TR94","rubber-stamp-travel-field-note","Use for rubber-stamp travel field-note photo posters.","CC-BY-4.0","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Frubber-stamp-travel-field-note\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},"01M78D5VXYSJZVTGETSYGZWQPQ","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\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Fwhy\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Fwhy\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},"01M78D5SMN2NTGT19B2T5WY83T","unslop","Cut AI tells from any writing. Must always apply.","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Funslop\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Funslop\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},"01M78D5JHTG4B6YPZ8TNN18Y6D","technical-writing","Layered technical-writing standard: Diátaxis structure, Google developer style sentences, STE instruction rules, Global English syntax. Use for \u002Ftechnical-writing or when writing or reviewing docs, RFCs, readmes, PR descriptions, or commit messages.","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Ftechnical-writing\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Ftechnical-writing\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},"01M78D5FQEE7FHNNCCM5XW5MD7","swarm","Fan out N parallel workers, drain them, and return one report. Use for \u002Fswarm, 'swarm this', or parallel coverage, races, gauntlets, and exploration.","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Fswarm\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Femo-eth\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fpstack\u002Fswarm\u002FSKILL.md",[],[]]