[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6H6CQY2E01KRFVJSQ0SGK2N":3,"skill-same:01M6H6CQY2E01KRFVJSQ0SGK2N":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":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":6,"ownerHtmlUrl":54,"ownerBlogUrl":55,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6H6CQY2E01KRFVJSQ0SGK2N","m05-type-driven",null,"CRITICAL: Use for type-driven design. Triggers: type state, PhantomData, newtype, marker trait, builder pattern, make invalid states unrepresentable, compile-time validation, sealed trait, ZST, 类型状态, 新类型模式, 类型驱动设计","0xharryriddle\u002Fcodex-field-kit","0xharryriddle","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F100945007?v=4","01M6H686JV0QKZYP2RWG6B2B8T","harryriddle","01M6H686PVZ8JGKWEG7B3GM5PD",3,"MIT","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Farchive\u002Fupstream\u002Fchasebuild-agent-skills\u002Frust\u002Fskills\u002Fm05-type-driven\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000015","视觉设计","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"m05 type driven","driven","type","triggers","for","marker","states","make","false","critical","invalid","design","builder pattern","pattern","time","builder","use","compile","state","validation","2026-11-10 10:12:30",false,"---\nname: m05-type-driven\ndescription: \"CRITICAL: Use for type-driven design. Triggers: type state, PhantomData, newtype, marker trait, builder pattern, make invalid states unrepresentable, compile-time validation, sealed trait, ZST, 类型状态, 新类型模式, 类型驱动设计\"\nuser-invocable: false\n---\n\n# Type-Driven Design\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**How can the type system prevent invalid states?**\n\nBefore reaching for runtime checks:\n- Can the compiler catch this error?\n- Can invalid states be unrepresentable?\n- Can the type encode the invariant?\n\n---\n\n## Error → Design Question\n\n| Pattern | Don't Just Say | Ask Instead |\n|---------|----------------|-------------|\n| Primitive obsession | \"It's just a string\" | What does this value represent? |\n| Boolean flags | \"Add an is_valid flag\" | Can states be types? |\n| Optional everywhere | \"Check for None\" | Is absence really possible? |\n| Validation at runtime | \"Return Err if invalid\" | Can we validate at construction? |\n\n---\n\n## Thinking Prompt\n\nBefore adding runtime validation:\n\n1. **Can the type encode the constraint?**\n   - Numeric range → bounded types or newtypes\n   - Valid states → type state pattern\n   - Semantic meaning → newtype\n\n2. **When is validation possible?**\n   - At construction → validated newtype\n   - At state transition → type state\n   - Only at runtime → Result with clear error\n\n3. **Who needs to know the invariant?**\n   - Compiler → type-level encoding\n   - API users → clear type signatures\n   - Runtime only → documentation\n\n---\n\n## Trace Up ↑\n\nWhen type design is unclear:\n\n```\n\"Need to validate email format\"\n    ↑ Ask: Is this a domain value object?\n    ↑ Check: m09-domain (Email as Value Object)\n    ↑ Check: domain-* (validation requirements)\n```\n\n| Situation | Trace To | Question |\n|-----------|----------|----------|\n| What types to create | m09-domain | What's the domain model? |\n| State machine design | m09-domain | What are valid transitions? |\n| Marker trait usage | m04-zero-cost | Static or dynamic dispatch? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need type-safe wrapper for primitives\"\n    ↓ Newtype: struct UserId(u64);\n\n\"Need compile-time state validation\"\n    ↓ Type State: Connection\u003CConnected>\n\n\"Need to track phantom type parameters\"\n    ↓ PhantomData: PhantomData\u003CT>\n\n\"Need capability markers\"\n    ↓ Marker Trait: trait Validated {}\n\n\"Need gradual construction\"\n    ↓ Builder: Builder::new().field(x).build()\n```\n\n---\n\n## Quick Reference\n\n| Pattern | Purpose | Example |\n|---------|---------|---------|\n| Newtype | Type safety | `struct UserId(u64);` |\n| Type State | State machine | `Connection\u003CConnected>` |\n| PhantomData | Variance\u002Flifetime | `PhantomData\u003C&'a T>` |\n| Marker Trait | Capability flag | `trait Validated {}` |\n| Builder | Gradual construction | `Builder::new().name(\"x\").build()` |\n| Sealed Trait | Prevent external impl | `mod private { pub trait Sealed {} }` |\n\n## Pattern Examples\n\n### Newtype\n\n```rust\nstruct Email(String);  \u002F\u002F Not just any string\n\nimpl Email {\n    pub fn new(s: &str) -> Result\u003CSelf, ValidationError> {\n        \u002F\u002F Validate once, trust forever\n        validate_email(s)?;\n        Ok(Self(s.to_string()))\n    }\n}\n```\n\n### Type State\n\n```rust\nstruct Connection\u003CState>(TcpStream, PhantomData\u003CState>);\n\nstruct Disconnected;\nstruct Connected;\nstruct Authenticated;\n\nimpl Connection\u003CDisconnected> {\n    fn connect(self) -> Connection\u003CConnected> { ... }\n}\n\nimpl Connection\u003CConnected> {\n    fn authenticate(self) -> Connection\u003CAuthenticated> { ... }\n}\n```\n\n---\n\n## Decision Guide\n\n| Need | Pattern |\n|------|---------|\n| Type safety for primitives | Newtype |\n| Compile-time state validation | Type State |\n| Lifetime\u002Fvariance markers | PhantomData |\n| Capability flags | Marker Trait |\n| Gradual construction | Builder |\n| Closed set of impls | Sealed Trait |\n| Zero-sized type marker | ZST struct |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| Boolean flags for states | Runtime errors | Type state |\n| String for semantic types | No type safety | Newtype |\n| Option for uninitialized | Unclear invariant | Builder |\n| Public fields with invariants | Invariant violation | Private + validated new() |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Domain modeling | m09-domain |\n| Trait design | m04-zero-cost |\n| Error handling in constructors | m06-error-handling |\n| Anti-patterns | m15-anti-pattern |\n","# Type-Driven Design\n\n> **Layer 1: Language Mechanics**\n\n## Core Question\n\n**How can the type system prevent invalid states?**\n\nBefore reaching for runtime checks:\n- Can the compiler catch this error?\n- Can invalid states be unrepresentable?\n- Can the type encode the invariant?\n\n---\n\n## Error → Design Question\n\n| Pattern | Don't Just Say | Ask Instead |\n|---------|----------------|-------------|\n| Primitive obsession | \"It's just a string\" | What does this value represent? |\n| Boolean flags | \"Add an is_valid flag\" | Can states be types? |\n| Optional everywhere | \"Check for None\" | Is absence really possible? |\n| Validation at runtime | \"Return Err if invalid\" | Can we validate at construction? |\n\n---\n\n## Thinking Prompt\n\nBefore adding runtime validation:\n\n1. **Can the type encode the constraint?**\n   - Numeric range → bounded types or newtypes\n   - Valid states → type state pattern\n   - Semantic meaning → newtype\n\n2. **When is validation possible?**\n   - At construction → validated newtype\n   - At state transition → type state\n   - Only at runtime → Result with clear error\n\n3. **Who needs to know the invariant?**\n   - Compiler → type-level encoding\n   - API users → clear type signatures\n   - Runtime only → documentation\n\n---\n\n## Trace Up ↑\n\nWhen type design is unclear:\n\n```\n\"Need to validate email format\"\n    ↑ Ask: Is this a domain value object?\n    ↑ Check: m09-domain (Email as Value Object)\n    ↑ Check: domain-* (validation requirements)\n```\n\n| Situation | Trace To | Question |\n|-----------|----------|----------|\n| What types to create | m09-domain | What's the domain model? |\n| State machine design | m09-domain | What are valid transitions? |\n| Marker trait usage | m04-zero-cost | Static or dynamic dispatch? |\n\n---\n\n## Trace Down ↓\n\nFrom design to implementation:\n\n```\n\"Need type-safe wrapper for primitives\"\n    ↓ Newtype: struct UserId(u64);\n\n\"Need compile-time state validation\"\n    ↓ Type State: Connection\u003CConnected>\n\n\"Need to track phantom type parameters\"\n    ↓ PhantomData: PhantomData\u003CT>\n\n\"Need capability markers\"\n    ↓ Marker Trait: trait Validated {}\n\n\"Need gradual construction\"\n    ↓ Builder: Builder::new().field(x).build()\n```\n\n---\n\n## Quick Reference\n\n| Pattern | Purpose | Example |\n|---------|---------|---------|\n| Newtype | Type safety | `struct UserId(u64);` |\n| Type State | State machine | `Connection\u003CConnected>` |\n| PhantomData | Variance\u002Flifetime | `PhantomData\u003C&'a T>` |\n| Marker Trait | Capability flag | `trait Validated {}` |\n| Builder | Gradual construction | `Builder::new().name(\"x\").build()` |\n| Sealed Trait | Prevent external impl | `mod private { pub trait Sealed {} }` |\n\n## Pattern Examples\n\n### Newtype\n\n```rust\nstruct Email(String);  \u002F\u002F Not just any string\n\nimpl Email {\n    pub fn new(s: &str) -> Result\u003CSelf, ValidationError> {\n        \u002F\u002F Validate once, trust forever\n        validate_email(s)?;\n        Ok(Self(s.to_string()))\n    }\n}\n```\n\n### Type State\n\n```rust\nstruct Connection\u003CState>(TcpStream, PhantomData\u003CState>);\n\nstruct Disconnected;\nstruct Connected;\nstruct Authenticated;\n\nimpl Connection\u003CDisconnected> {\n    fn connect(self) -> Connection\u003CConnected> { ... }\n}\n\nimpl Connection\u003CConnected> {\n    fn authenticate(self) -> Connection\u003CAuthenticated> { ... }\n}\n```\n\n---\n\n## Decision Guide\n\n| Need | Pattern |\n|------|---------|\n| Type safety for primitives | Newtype |\n| Compile-time state validation | Type State |\n| Lifetime\u002Fvariance markers | PhantomData |\n| Capability flags | Marker Trait |\n| Gradual construction | Builder |\n| Closed set of impls | Sealed Trait |\n| Zero-sized type marker | ZST struct |\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why Bad | Better |\n|--------------|---------|--------|\n| Boolean flags for states | Runtime errors | Type state |\n| String for semantic types | No type safety | Newtype |\n| Option for uninitialized | Unclear invariant | Builder |\n| Public fields with invariants | Invariant violation | Private + validated new() |\n\n---\n\n## Related Skills\n\n| When | See |\n|------|-----|\n| Domain modeling | m09-domain |\n| Trait design | m04-zero-cost |\n| Error handling in constructors | m06-error-handling |\n| Anti-patterns | m15-anti-pattern |\n",{"name":5,"description":7,"user-invocable":45},"main","6c13f6f4ac5a3bc1e6b78cd2bb1704f122c4a73e","archive\u002Fupstream\u002Fchasebuild-agent-skills\u002Frust\u002Fskills\u002Fm05-type-driven",0,"https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit","https:\u002F\u002Fgithub.com\u002F0xharryriddle","https:\u002F\u002Fharryriddle.vercel.app","2026-04-11 11:49:51",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add 0xharryriddle\u002Fcodex-field-kit --skill m05-type-driven",{"tool":63,"command":64},"bunx","bunx skills add 0xharryriddle\u002Fcodex-field-kit --skill m05-type-driven",{"tool":66,"command":67},"pnpm","pnpm dlx skills add 0xharryriddle\u002Fcodex-field-kit --skill m05-type-driven","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Farchive\u002Fupstream\u002Fchasebuild-agent-skills\u002Frust\u002Fskills\u002Fm05-type-driven\u002FSKILL.md",true,[],[72,101,119,129,155,182],{"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":81,"publishedAt":44},"01M6H7ZKE6MR33HC84QZ1TA6MV","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fvercel-react-best-practices\u002FSKILL.md",[78],{"categoryNo":79,"categoryName":80,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[82,83,84,85,86,87,88,27,89,90,91,92,93,94,95,96,97,98,99,100],"react best practices","react","vercel react best practices","best practices","vercel","tasks","data fetching","pages","next","performance optimization","refactoring","Next.js","Optimization","code","guidelines","react components","components","performance","writing",{"skillNo":102,"name":103,"nameZh":6,"description":104,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":105,"categories":106,"keywords":107,"publishedAt":44},"01M6H7ZGC2WK8SEKYHWDNTMDA9","swarm-planner","[EXPLICIT INVOCATION ONLY] Creates dependency-aware implementation plans optimized for parallel multi-agent execution.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fswarm-planner\u002FSKILL.md",[],[108,109,110,111,112,113,114,115,116,28,117,118],"swarm","swarm planner","planner","parallel","multi-agent","only","execution","plans","dependency","multi","implementation",{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":44},"01M6H7ZD93853RZCYQWH1D38TM","super-swarm-spark","Only to be triggered by explicit super-swarm-spark commands.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fsuper-swarm-spark\u002FSKILL.md",[],[126,108,127,113,128],"super swarm spark","spark","commands",{"skillNo":130,"name":131,"nameZh":6,"description":132,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":133,"categories":134,"keywords":135,"publishedAt":44},"01M6H7Z987QBY49JCCPT953EAZ","role-creator","Create and install Codex custom agent roles in ~\u002F.codex\u002Fconfig.toml, generate role config files, enforce supported keys, and guide users through required role inputs (model, reasoning effort, developer_instructions).","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Frole-creator\u002FSKILL.md",[],[136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154],"role","creator","role creator","keys","users","roles","toml","enforce","install","guide","instructions","model","developer","reasoning","generate","create","config","codex","files",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":164,"publishedAt":44},"01M6H7Z5TRPMDQ7YSZQXPN1G60","read-github","Read and search GitHub repository documentation via gitmcp.io MCP service.\n\n**WHEN TO USE:**\n- User provides a GitHub URL\n- User mentions a specific repo in owner\u002Frepo format\n- User asks \"what does this repo do?\", \"read the docs for X repo\", or similar\n- User wants to search code or docs within a repo","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fread-github\u002FSKILL.md",[161],{"categoryNo":162,"categoryName":163,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",[165,166,167,95,168,169,170,171,28,172,173,174,175,176,177,40,178,179,180,181],"github","read github","read","documentation","docs","MCP","search","when to use","URL","via","io","service","do","user","repo","format","repository",{"skillNo":183,"name":110,"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":187,"publishedAt":44},"01M6H7Z215CTKYJ4Y1X6EQWN6M","Create comprehensive, phased implementation plans with sprints and atomic tasks. Use when user says: \"make a plan\", \"create a plan\", \"plan this out\", \"plan the implementation\", \"help me plan\", \"design a plan\", \"draft a plan\", \"write a plan\", \"outline the steps\", \"break this down into tasks\", \"what's the plan for\", or any similar planning request. Also triggers on explicit \"\u002Fplanner\" or \"\u002Fplan\" commands.","https:\u002F\u002Fgithub.com\u002F0xharryriddle\u002Fcodex-field-kit\u002Fblob\u002Fmain\u002Fskills\u002Fplanner\u002FSKILL.md",[],[110,188,28,189,190,191,27,115,128,192,193,40,194,195,196,197,198,151,87,35],"outline","atomic","with","sprints","draft","me","write","phased implementation","plan","help","planning"]