[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C3297D129F2R6GZ37PSWTE":3,"skill-same:01M6C3297D129F2R6GZ37PSWTE":69},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":40,"linkOnly":41,"markdownContent":42,"markdownBody":43,"frontMatter":44,"refName":46,"commitSha":47,"skillDirectory":48,"forksCount":49,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":53,"ownerDescription":54,"updatedAt":55,"install":56,"resources":68},"01M6C3297D129F2R6GZ37PSWTE","principle-type-system-discipline","类型系统严谨性准则","Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, refuse to lie to the compiler, exhaust variants, derive from authoritative schemas.","在设计类型、审查函数签名或使用任何静态类型语言编写代码时应用。使非法状态无法表示、为语义基本类型打上品牌标记、在边界处解析外部数据、绝不对编译器撒谎、穷尽所有变体、从权威模式派生。","IgorGanapolsky\u002FRandom-Timer","IgorGanapolsky","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F201209?v=4","01M6C2WB7720K13ERYVB3AJ0SQ","Igor Ganapolsky","01M6C2WBBF0NWVQV4A89FS00Q5",1,"MIT",null,"https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.claude\u002Fskills\u002Fprinciple-type-system-discipline\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8CAAMN19HMY7B3JXN2CBP29","工程实践准则","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39],"principle type system discipline","system","discipline","writing","code","compiler","data","brand","primitives","2026-11-10 10:12:30",false,"---\nname: principle-type-system-discipline\ndescription: \"Apply when designing types, reviewing a function signature, or writing code in any statically-typed language. Make illegal states unrepresentable, brand semantic primitives, parse external data at boundaries, refuse to lie to the compiler, exhaust variants, derive from authoritative schemas.\"\ndisable-model-invocation: true\n---\n\n# Type System Discipline\n\nThe type checker is a proof assistant. Use it to eliminate impossible states, mismatched primitives, and unhandled variants at compile time. A case the types let you ignore becomes a runtime failure the compiler could have stopped. Prefer defining errors and special cases out of existence over proliferating handlers. Unrepresentable states, total functions, and interface redesign (the patterns below) are the tools.\n\nApplies to any typed language. Skills like `typescript-best-practices` ground it in specific syntax.\n\n**The patterns:**\n\n- **Make illegal states unrepresentable.** Model variants as sum types: discriminated unions in TypeScript, enums with payloads in Rust\u002FSwift\u002FKotlin, sealed classes in Scala, ADTs in Haskell\u002FOCaml. Don't model state as a bag of optional fields where contradictory combinations compile. A subtle anti-pattern: `{ completed: boolean; completedAt?: Date }` admits `completed: true; completedAt: undefined`, which is meaningless. Derive the boolean from a single source like `completedAt !== null`, or model the variants explicitly as `{ kind: 'open' } | { kind: 'done'; at: Date }`. If a bug forces the question \"wait, can this combination actually happen?\", the type is too loose.\n- **Types are constructions, not restrictions.** Build the type up from the values you want instead of carving them out of a looser type with checks. The invariant that seems to need a refinement type is usually a construction away. A non-empty list is a head plus a rest, not a list with a length check. A valid time range is a start plus a duration, not two timestamps you must keep ordered. No representation is privileged. A list of pairs is an even-length list if you interpret it that way, so choose the shape that cannot build the illegal value and expose the interface callers need on top.\n- **Brand semantic primitives.** `UserId` and `OrderId` are strings underneath but should not be interchangeable. Newtypes in Rust, opaque types in Swift, value classes in Kotlin, phantom types in Haskell, branded intersections in TypeScript. Validate once at creation, trust the type downstream.\n- **External data is untyped until parsed.** RPC payloads, JSON, IPC messages, CLI args, config files, environment variables, database rows. Have a parse function at every boundary that turns unstructured input into the typed model. See the **boundary-discipline** principle skill for where to put validation.\n- **Don't lie to the type system.** Casts, unsafe coercions, and assertion functions that bypass the compiler are latent runtime crashes. If the compiler can't prove a fact, prove it (validate, narrow, refine the model) or accept that the cast is a hazard.\n- **Exhaustive matching is the compiler's job.** When you match on a sum type, the compiler must fail compilation if a new variant is added without handling. Use the idiom your language provides: `never`-typed binding in TypeScript, unannotated `match` in Rust, `-Wincomplete-patterns` in Haskell, sealed-class match exhaustiveness in Kotlin.\n- **Derive types from authoritative schemas.** When a protocol buffer, OpenAPI spec, GraphQL schema, database migration, or design-system token file defines a shape, derive from it instead of hand-rolling a parallel type. See the **encode-lessons-in-structure** principle skill.\n- **Strengthen a type only where partiality appears.** A runtime assertion, null check, or \"this should never happen\" throw marks the place a type is too weak. Push that check up into the type. Then stop. The type system's job is to track the cases each use site must handle, not to describe the data as precisely as possible. Prefer total functions. `sum` of an empty list is 0, so it takes the plain list. `head` of an empty list has no answer, so it demands the non-empty one.\n\n**The tests:**\n\n- \"Can I write a comment explaining when this combination of fields is valid?\" If yes, the type is too loose. Split it into a sum type.\n- \"Do two of my function arguments share a primitive type but mean different things?\" Brand them.\n- \"Where did this `any`, this `as`, this `assertNotNull` come from?\" Trace it to the boundary and validate there instead.\n- \"If a new variant is added next month, will the compiler tell the next agent where to add a case?\" If no, the match isn't exhaustive.\n- \"Is this type duplicating a shape another file owns?\" Derive instead.\n- \"Am I strengthening this type to keep an operation total, or just to be more precise?\" If nothing would otherwise panic, keep the plain type.\n","# Type System Discipline\n\nThe type checker is a proof assistant. Use it to eliminate impossible states, mismatched primitives, and unhandled variants at compile time. A case the types let you ignore becomes a runtime failure the compiler could have stopped. Prefer defining errors and special cases out of existence over proliferating handlers. Unrepresentable states, total functions, and interface redesign (the patterns below) are the tools.\n\nApplies to any typed language. Skills like `typescript-best-practices` ground it in specific syntax.\n\n**The patterns:**\n\n- **Make illegal states unrepresentable.** Model variants as sum types: discriminated unions in TypeScript, enums with payloads in Rust\u002FSwift\u002FKotlin, sealed classes in Scala, ADTs in Haskell\u002FOCaml. Don't model state as a bag of optional fields where contradictory combinations compile. A subtle anti-pattern: `{ completed: boolean; completedAt?: Date }` admits `completed: true; completedAt: undefined`, which is meaningless. Derive the boolean from a single source like `completedAt !== null`, or model the variants explicitly as `{ kind: 'open' } | { kind: 'done'; at: Date }`. If a bug forces the question \"wait, can this combination actually happen?\", the type is too loose.\n- **Types are constructions, not restrictions.** Build the type up from the values you want instead of carving them out of a looser type with checks. The invariant that seems to need a refinement type is usually a construction away. A non-empty list is a head plus a rest, not a list with a length check. A valid time range is a start plus a duration, not two timestamps you must keep ordered. No representation is privileged. A list of pairs is an even-length list if you interpret it that way, so choose the shape that cannot build the illegal value and expose the interface callers need on top.\n- **Brand semantic primitives.** `UserId` and `OrderId` are strings underneath but should not be interchangeable. Newtypes in Rust, opaque types in Swift, value classes in Kotlin, phantom types in Haskell, branded intersections in TypeScript. Validate once at creation, trust the type downstream.\n- **External data is untyped until parsed.** RPC payloads, JSON, IPC messages, CLI args, config files, environment variables, database rows. Have a parse function at every boundary that turns unstructured input into the typed model. See the **boundary-discipline** principle skill for where to put validation.\n- **Don't lie to the type system.** Casts, unsafe coercions, and assertion functions that bypass the compiler are latent runtime crashes. If the compiler can't prove a fact, prove it (validate, narrow, refine the model) or accept that the cast is a hazard.\n- **Exhaustive matching is the compiler's job.** When you match on a sum type, the compiler must fail compilation if a new variant is added without handling. Use the idiom your language provides: `never`-typed binding in TypeScript, unannotated `match` in Rust, `-Wincomplete-patterns` in Haskell, sealed-class match exhaustiveness in Kotlin.\n- **Derive types from authoritative schemas.** When a protocol buffer, OpenAPI spec, GraphQL schema, database migration, or design-system token file defines a shape, derive from it instead of hand-rolling a parallel type. See the **encode-lessons-in-structure** principle skill.\n- **Strengthen a type only where partiality appears.** A runtime assertion, null check, or \"this should never happen\" throw marks the place a type is too weak. Push that check up into the type. Then stop. The type system's job is to track the cases each use site must handle, not to describe the data as precisely as possible. Prefer total functions. `sum` of an empty list is 0, so it takes the plain list. `head` of an empty list has no answer, so it demands the non-empty one.\n\n**The tests:**\n\n- \"Can I write a comment explaining when this combination of fields is valid?\" If yes, the type is too loose. Split it into a sum type.\n- \"Do two of my function arguments share a primitive type but mean different things?\" Brand them.\n- \"Where did this `any`, this `as`, this `assertNotNull` come from?\" Trace it to the boundary and validate there instead.\n- \"If a new variant is added next month, will the compiler tell the next agent where to add a case?\" If no, the match isn't exhaustive.\n- \"Is this type duplicating a shape another file owns?\" Derive instead.\n- \"Am I strengthening this type to keep an operation total, or just to be more precise?\" If nothing would otherwise panic, keep the plain type.\n",{"name":5,"description":7,"disable-model-invocation":45},true,"develop","4af946ac9a2b3cfbbe9b2e8696cc436f1d16e2e2",".claude\u002Fskills\u002Fprinciple-type-system-discipline",0,"https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer","https:\u002F\u002Fapps.apple.com\u002Fus\u002Fapp\u002Frandom-tactical-timer\u002Fid6758355312","https:\u002F\u002Fgithub.com\u002FIgorGanapolsky","https:\u002F\u002Fwww.igorganapolsky.com","Forward Deploy AI Engineer. Automation specialist.\r\n","2026-11-09 23:14:20",{"source":9,"skillName":5,"commands":57,"prompt":67,"zipAvailable":45},[58,61,64],{"tool":59,"command":60},"npx","npx skills add IgorGanapolsky\u002FRandom-Timer --skill principle-type-system-discipline",{"tool":62,"command":63},"bunx","bunx skills add IgorGanapolsky\u002FRandom-Timer --skill principle-type-system-discipline",{"tool":65,"command":66},"pnpm","pnpm dlx skills add IgorGanapolsky\u002FRandom-Timer --skill principle-type-system-discipline","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.claude\u002Fskills\u002Fprinciple-type-system-discipline\u002FSKILL.md",[],[70,86,109,126,144,163],{"skillNo":71,"name":72,"nameZh":73,"description":74,"descriptionZh":75,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":76,"categories":77,"keywords":82,"publishedAt":40},"01M6C3CEGAENG02BPG636N9WG6","writing-plans","任务实施计划编写","Use when you have a spec or requirements for a multi-step task, before touching code","当你有某个多步骤任务的规格说明或需求时，在动手编写代码之前使用。","https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.cursor\u002Fskills\u002Fwriting-plans\u002FSKILL.md",[78,79],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":80,"categoryName":81,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BTBRTQXJ9T5TABNS7XP1A0","任务规划与分解",[83,34,84,35,85],"writing plans","spec","use",{"skillNo":87,"name":88,"nameZh":89,"description":90,"descriptionZh":91,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":92,"categories":93,"keywords":100,"publishedAt":40},"01M6C3CC40GJBTJQHQ5BF7CQN9","workflow-economics-lite","AI 工作流经济性评估","Escape AI pilot purgatory: require completion-loop workflows with one owner, baseline, economic metric, system-of-record integration, and audit trail. Block orphan chatbots and interest-as-ROI claims.","逃离 AI 试点炼狱：要求构建闭环（completion-loop）工作流，包含单一负责人、基线、经济指标、记录系统（system-of-record）集成和审计轨迹。阻断孤立的聊天机器人以及将“兴趣”当作 ROI 的说法。","https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.cursor\u002Fskills\u002Fworkflow-economics-lite\u002FSKILL.md",[94,97],{"categoryNo":95,"categoryName":96,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C01H2CAMD3MSHYA84VYCAR","业务流程设计与优化",{"categoryNo":98,"categoryName":99,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8C2MZSX0YJXR444XP83VR5N","产品经理",[101,102,103,104,105,106,107,108,32],"workflow economics lite","workflow","loop","roi","workflows","audit","integration","baseline",{"skillNo":110,"name":111,"nameZh":112,"description":113,"descriptionZh":114,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":115,"categories":116,"keywords":121,"publishedAt":40},"01M6C3C9ESBW612NMMMBQDWSWR","verification-before-completion","完成前验证确认","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","当准备声称工作已完成、已修复或已通过时，在提交或创建 PR 之前使用——要求在做出任何成功声明之前先运行验证命令并确认输出；始终遵循“证据先于断言”。","https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.cursor\u002Fskills\u002Fverification-before-completion\u002FSKILL.md",[117,118],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":119,"categoryName":120,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[122,123,85,124,125],"verification before completion","verification","evidence","work",{"skillNo":127,"name":128,"nameZh":129,"description":130,"descriptionZh":131,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":132,"categories":133,"keywords":138,"publishedAt":40},"01M6C3C71DNQHJ6PGV0TN1R99N","value-center-lite","价值中心五问评估","Apply InfoQ Rohrer value-center \u002F VSM five questions (agency + coherence). Use when planning work, shipping releases, or auditing agent autonomy claims. Fail closed on product-only slogans without WQTU\u002Fpaywall value.","应用 InfoQ Rohrer 的价值中心 \u002F VSM 五问法（自主性 + 一致性）。在规划工作、发布版本或审计智能体自主性声明时使用。对于没有 WQTU\u002F付费墙价值的纯产品口号，采取 fail closed（默认拒绝）的严格判定。","https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.cursor\u002Fskills\u002Fvalue-center-lite\u002FSKILL.md",[134,135],{"categoryNo":98,"categoryName":99,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":136,"categoryName":137,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C48JNVH0P83Z0KVKAQ4819","成果验证与价值评估",[139,140,85,125,141,142,143],"value center lite","only","product","shipping","planning",{"skillNo":145,"name":146,"nameZh":147,"description":148,"descriptionZh":149,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":150,"categories":151,"keywords":158,"publishedAt":40},"01M6C3C41Q0R2J49F3Q4CQ004J","using-superpowers","技能发现与调用规范","Use when starting any conversation - establishes how to find and use skills, requiring skill invocation before ANY response including clarifying questions","在每次对话开始时使用——建立如何查找和使用技能的方法，要求在任何回应（包括澄清性问题）之前都必须先调用技能。","https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.cursor\u002Fskills\u002Fusing-superpowers\u002FSKILL.md",[152,155],{"categoryNo":153,"categoryName":154,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0CV1NMDZ5TEJX1GVM29","插件与技能管理",{"categoryNo":156,"categoryName":157,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",[159,160,85,161,162],"superpowers","using superpowers","find","how",{"skillNo":164,"name":165,"nameZh":166,"description":167,"descriptionZh":168,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":169,"categories":170,"keywords":175,"publishedAt":40},"01M6C3C1EBYXRVMNHZZE9N49PN","using-git-worktrees","Git 工作树隔离开发","Use when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallback","在开始需要与当前工作区隔离的功能开发时，或在实施计划执行前使用——通过原生工具或 git worktree 回退机制确保存在隔离的工作区。","https:\u002F\u002Fgithub.com\u002FIgorGanapolsky\u002FRandom-Timer\u002Fblob\u002Fdevelop\u002F.cursor\u002Fskills\u002Fusing-git-worktrees\u002FSKILL.md",[171,172],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":173,"categoryName":174,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BR5V701HCN066VEP7H4812","代码仓库协作管理",[176,177,178,179,180,181,182,125,85],"git","using git worktrees","git worktrees","git worktree","Tools","worktree","workspace"]