[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71YCB46181WKRBYT52J5GAC":3,"skill-same:01M71YCB46181WKRBYT52J5GAC":59},{"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":28,"linkOnly":29,"markdownContent":30,"markdownBody":31,"frontMatter":32,"refName":33,"commitSha":34,"skillDirectory":35,"forksCount":14,"repositoryHtmlUrl":36,"repositoryHomepageUrl":6,"ownerHtmlUrl":37,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":38,"install":39,"resources":52},"01M71YCB46181WKRBYT52J5GAC","typescript-best-practices",null,"TypeScript best practices. Use when reading or editing any .ts or .tsx file.","nnad3N\u002Fmnemonic","nnad3N","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F58890387?v=4","01M71Y9PXZFWDKNW9Z4FT6J4W5","Damian Struk","01M71Y9PYM2GDNPCQP4FPCTBWT",0,"AGPL-3.0","https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Ftypescript-best-practices\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27],"typescript","best practices","typescript best practices","file","editing","use","tsx","reading","when","2026-11-10 13:45:54",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 **principle-type-system-discipline** 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 **principle-boundary-discipline** 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 **principle-type-system-discipline** 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 **principle-boundary-discipline** 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","3c5f4e345596aaac8d8fb7a6fd35f4a9f9b55a88",".agents\u002Ftypescript-best-practices","https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic","https:\u002F\u002Fgithub.com\u002Fnnad3N","2026-09-09 21:17:30",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add nnad3N\u002Fmnemonic --skill typescript-best-practices",{"tool":45,"command":46},"bunx","bunx skills add nnad3N\u002Fmnemonic --skill typescript-best-practices",{"tool":48,"command":49},"pnpm","pnpm dlx skills add nnad3N\u002Fmnemonic --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Ftypescript-best-practices\u002FSKILL.md",true,[53],{"path":54,"resourceType":55,"resourceTypeDesc":56,"sizeBytes":57,"sourceHtmlUrl":58},"references\u002Fpatterns.md","REFERENCE","参考文档",8695,"https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Ftypescript-best-practices\u002Freferences\u002Fpatterns.md",[60,77,88,93,103,125],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":28},"01M71YCJNJ9B15GG2TJC7QBCB1","verify-in-browser","Open the running app in a browser when asked to browser-test, verify in the browser, or exercise the UI in a real session.","https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fverify-in-browser\u002FSKILL.md",[],[67,68,69,27,70,71,72,73,74,75,76],"verify in browser","browser","verify","running","exercise","app","session","open","test","ui",{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":28},"01M71YCGBC0421BTV8J4466D2Z","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Fwriting-for-agents\u002FSKILL.md",[],[84,85,86,87,23,24,27],"writing","writing for agents","for","documents",{"skillNo":89,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":92,"publishedAt":28},"01M71YCDRA1G40BC5EEKB7KE78","https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Fverify-in-browser\u002FSKILL.md",[],[68,69,67,72,73,74,71,76,75,27,70],{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":28},"01M71YCCPRESPT9X2BBVC2VV2W","unslop","Cut AI tells from any writing. Must always apply.","https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Funslop\u002FSKILL.md",[],[95,100,101,102,84],"ai tells","apply","cut",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":28},"01M71YC84YYGP7C0BQ2Q8K6FM4","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\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Ftechnical-writing\u002FSKILL.md",[],[110,111,84,112,113,114,115,116,117,118,119,24,120,121,122,105,123,86,124,27],"technical","technical writing","layered","pr","google","commit","messages","commit messages","Rules","syntax","structure","english","style","true","standard",{"skillNo":126,"name":127,"nameZh":6,"description":128,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":28},"01M71YC5ZC3APJ2HH5JYPMGAGQ","principle-type-system-discipline","Type system discipline when designing types, reviewing a function signature, or writing statically-typed code. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, refuse to lie to the compiler, exhaust variants, derive from authoritative schemas.","https:\u002F\u002Fgithub.com\u002Fnnad3N\u002Fmnemonic\u002Fblob\u002Fmain\u002F.agents\u002Fprinciple-type-system-discipline\u002FSKILL.md",[],[132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,27,148,149,84],"type system discipline","principle type system discipline","system","type","type system","discipline","code","compiler","data","brand","primitives","types","states","at","variants","parse","schemas","boundaries"]