[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71JRA905FXRF7C2B8A9K2K7":3,"skill-same:01M71JRA905FXRF7C2B8A9K2K7":71},{"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":29,"linkOnly":30,"markdownContent":31,"markdownBody":32,"frontMatter":33,"refName":34,"commitSha":35,"skillDirectory":5,"forksCount":36,"repositoryHtmlUrl":37,"repositoryHomepageUrl":38,"ownerHtmlUrl":39,"ownerBlogUrl":40,"ownerDescription":41,"updatedAt":42,"install":43,"resources":56},"01M71JRA905FXRF7C2B8A9K2K7","typescript-best-practices",null,"TypeScript best practices. Use when reading or editing any .ts or .tsx file.","caezium\u002Fskills","caezium","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F113233555?v=4","01M71JB77ZPBAWEK009Y2W8BP7","Henry Zhang","01M71JB792NVXCWSYD27HQ0964",3,"MIT","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Ftypescript-best-practices\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Ftypescript-best-practices\u002FSKILL.md",[],[20,21,22,23,24,25,26,27,28],"typescript best practices","best practices","typescript","reading","tsx","use","when","editing","file","2026-11-10 10:12:30",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 **principle-boundary-discipline**. |\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 **principle-boundary-discipline**. |\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","6ef866230c1ba3459fd08fc65141dfd37fffd41a",0,"https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills","https:\u002F\u002Fskills.henryzh.dev","https:\u002F\u002Fgithub.com\u002Fcaezium","henryzh.dev","quant, data science, full-stack, robotics.\r\nbuilding cool stuff","2026-08-24 19:21:44",{"source":8,"skillName":5,"commands":44,"prompt":54,"zipAvailable":55},[45,48,51],{"tool":46,"command":47},"npx","npx skills add caezium\u002Fskills --skill typescript-best-practices",{"tool":49,"command":50},"bunx","bunx skills add caezium\u002Fskills --skill typescript-best-practices",{"tool":52,"command":53},"pnpm","pnpm dlx skills add caezium\u002Fskills --skill typescript-best-practices","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Ftypescript-best-practices\u002FSKILL.md",true,[57,63,67],{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"agents\u002Fopenai.yaml","REFERENCE","参考文档",116,"https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Ftypescript-best-practices\u002Fagents\u002Fopenai.yaml",{"path":64,"resourceType":64,"resourceTypeDesc":65,"sizeBytes":66,"sourceHtmlUrl":16},"LICENSE","许可证",1067,{"path":68,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":69,"sourceHtmlUrl":70},"references\u002Fpatterns.md",8695,"https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Ftypescript-best-practices\u002Freferences\u002Fpatterns.md",[72,93,120,138,159,181],{"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":6,"sourceHtmlUrl":76,"categories":77,"keywords":88,"publishedAt":29},"01M71JT4RYCAS18RF6003YYR1D","writing-for-agents","Writing documents for agents. Use when creating or editing skills, or modifying AGENTS.md or CLAUDE.md.","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Fwriting-for-agents\u002FSKILL.md",[78,83],{"categoryNo":79,"categoryName":80,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000018","写作与文案","SCENARIO","使用场景",{"categoryNo":84,"categoryName":85,"taxonomyType":86,"taxonomyTypeDesc":87},"01JBSEEDCAT000000000000036","内容创作者","PROFESSION","适用职业",[89,90,91,27,25,92,26],"writing for agents","for","writing","documents",{"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":102,"publishedAt":29},"01M71JT0GES4AZ5ADH8EADNN1Z","wrangler","Cloudflare Workers CLI for deploying, developing, and managing Workers, KV, R2, D1, Vectorize, Hyperdrive, Workers AI, Containers, Queues, Workflows, Pipelines, and Secrets Store. Load before running wrangler commands to ensure correct syntax and best practices. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Fwrangler\u002FSKILL.md",[99],{"categoryNo":100,"categoryName":101,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000010","后端与接口",[95,103,104,105,106,107,108,109,110,111,112,113,114,90,115,116,117,118,21,119],"cloudflare","d1","knowledge","workflows","cli","secrets","commands","syntax","cloudflare workers","r2","queues","running","containers","correct","load","workers","store",{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":29},"01M71JSWX4R203M32K9A18AAW8","workers-best-practices","Reviews and authors Cloudflare Workers code against production best practices. Load when writing new Workers, reviewing Worker code, configuring wrangler.jsonc, or checking for common Workers anti-patterns (streaming, floating promises, global state, secrets, bindings, observability). Biases towards retrieval from Cloudflare docs over pre-trained knowledge.","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Fworkers-best-practices\u002FSKILL.md",[],[127,118,21,128,129,130,90,103,131,105,132,95,91,117,26,133,134,135,136,137],"workers best practices","observability","reviews","promises","worker","new","code","common","streaming","state","anti-patterns",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":144,"publishedAt":29},"01M71JST6P88MXGT2MWDTPJGEG","wizard","Generate an interactive bash wizard that walks a human through steps only they can perform. Use when provisioning infrastructure, setting up credentials or CI secrets, walking an unfamiliar third-party dashboard, or running a one-off migration or cutover. Don't invoke this for steps the agent can perform itself.","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Fwizard\u002FSKILL.md",[],[140,114,145,90,146,147,148,149,25,150,26,151,152,153,154,155,156,157,158,108],"setting","up","ci","provisioning infrastructure","only","invoke","Bash","one","interactive","can","credentials","dashboard","generate","human",{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":163,"sourceHtmlUrl":164,"categories":165,"keywords":166,"publishedAt":29},"01M71JSQ95S7BQ61DAPN95X2W4","why","Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available evidence sources, searches each relevant category, and returns a cited read on decisions and tradeoffs. Use how for runtime behavior.","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Fwhy\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Fwhy\u002FSKILL.md",[],[161,167,168,169,170,90,171,172,25,173,174,175,176,177,178,179,180],"sources","thresholds","evidence","relevant","runtime","design","decisions","work","how","behavior","read","data","rationale","returns",{"skillNo":182,"name":183,"nameZh":6,"description":184,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":185,"categories":186,"keywords":190,"publishedAt":29},"01M71JSMHFVSH8HK8GXN6YAX6J","week-prep","Generate a briefing with calendar, tasks, and attention flags. Use for \"week prep\", \"briefing\", or \"what's on this week\".","https:\u002F\u002Fgithub.com\u002Fcaezium\u002Fskills\u002Fblob\u002Fmain\u002Fweek-prep\u002FSKILL.md",[187],{"categoryNo":188,"categoryName":189,"taxonomyType":81,"taxonomyTypeDesc":82},"01JBSEEDCAT000000000000023","Skill与智能体开发",[191,192,193,194,195,90,196,197,198,199,25,151,200,201,202,157,203,177,204,205],"week prep","prep","deep","attention","get","search","messages","briefing","MCP","tasks","with","slack","calendar","flags","grep"]