[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7882NNARENM2KQEP313B493":3,"skill-same:01M7882NNARENM2KQEP313B493":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":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M7882NNARENM2KQEP313B493","codebase-design",null,"Shared vocabulary and principles for designing deep modules. Use when the user wants to design or refine a module's interface, hunt for deepening opportunities, decide where a seam belongs, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.","officialunofficial\u002Fskills","officialunofficial","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F127067914?v=4","01M78827JABEMMN63AC8J1RCXV","Official Unofficial, Inc.","01M78827KC164SFKN4DXTCKK7N",7,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fcodebase-design\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: codebase-design\ndescription: Shared vocabulary and principles for designing deep modules. Use when the user wants to design or refine a module's interface, hunt for deepening opportunities, decide where a seam belongs, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.\n---\n\n# Codebase Design\n\nDesign **deep modules**: a lot of behaviour tucked behind a small interface, sited at a clean seam, and tested through that interface. Apply this language and these principles anywhere code is being designed or reshaped. You are chasing three payoffs — leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms precisely. Don't swap in \"component,\" \"service,\" \"API,\" or \"boundary\" — the consistency is the whole point.\n\n**Module** — anything that pairs an interface with an implementation. Intentionally scale-agnostic: a function, a class, a package, or a slice that spans tiers. _Avoid_: unit, component, service.\n\n**Interface** — everything a caller must know to use the module correctly: the type signature, yes, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (both too narrow — they name only the type-level surface).\n\n**Implementation** — the code inside a module, its body. Not the same as **Adapter**: a thing can be a small adapter wrapping a large implementation (a Postgres repo) or a large adapter wrapping a small one (an in-memory fake). Say \"adapter\" when the seam is the subject; \"implementation\" otherwise.\n\n**Depth** — leverage at the interface: how much behaviour a caller (or test) can reach per unit of interface it must learn. A module is **deep** when a lot of behaviour hides behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_ — a place where behaviour can change without editing that place; the *location* where a module's interface sits. Choosing where the seam goes is a design decision in its own right, separate from deciding what lives behind it. _Avoid_: boundary (already overloaded by DDD's bounded context).\n\n**Adapter** — a concrete thing that satisfies an interface at a seam. It names a *role* (which slot it fills), not a substance (what's inside).\n\n**Leverage** — the caller's reward for depth: more capability per unit of interface learned. One implementation pays back across N call sites and M tests.\n\n**Locality** — the maintainer's reward for depth: change, bugs, knowledge, and verification gather in one place instead of scattering across callers. Fix it once, it's fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + plenty of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + thin implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nAs you shape an interface, ask:\n\n- Can I cut the number of methods?\n- Can I simplify the parameters?\n- Can I bury more complexity inside?\n\n## Principles\n\n- **Depth is a property of the interface, not the implementation.** A deep module may be built inside from small, mockable, swappable pieces — they simply aren't part of the interface. A module can carry **internal seams** (private to its implementation, exercised by its own tests) alongside the **external seam** at its interface.\n- **The deletion test.** Picture deleting the module. If complexity evaporates, it was a pass-through. If complexity resurfaces spread across N callers, it was pulling its weight.\n- **The interface is the test surface.** Callers and tests cross the same seam. If you find yourself wanting to test *past* the interface, the module is probably the wrong shape.\n- **One adapter is a hypothetical seam; two adapters make it real.** Add a seam only when something genuinely varies across it.\n\n## Designing for testability\n\nGood interfaces make tests fall out naturally:\n\n1. **Accept dependencies, don't construct them.**\n\n   ```typescript\n   \u002F\u002F Testable\n   function processOrder(order, paymentGateway) {}\n\n   \u002F\u002F Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results rather than firing side effects.**\n\n   ```typescript\n   \u002F\u002F Testable\n   function calculateDiscount(cart): Discount {}\n\n   \u002F\u002F Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods means fewer tests; fewer params means simpler setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it shows callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** yields **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as the ratio of implementation lines to interface lines** (Ousterhout): rewards padding the implementation. Prefer depth-as-leverage.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow — here, interface covers every fact a caller must know.\n- **\"Boundary\"**: overloaded by DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies** — see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **Exploring alternative interfaces** — see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): fan out parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.\n","# Codebase Design\n\nDesign **deep modules**: a lot of behaviour tucked behind a small interface, sited at a clean seam, and tested through that interface. Apply this language and these principles anywhere code is being designed or reshaped. You are chasing three payoffs — leverage for callers, locality for maintainers, and testability for everyone.\n\n## Glossary\n\nUse these terms precisely. Don't swap in \"component,\" \"service,\" \"API,\" or \"boundary\" — the consistency is the whole point.\n\n**Module** — anything that pairs an interface with an implementation. Intentionally scale-agnostic: a function, a class, a package, or a slice that spans tiers. _Avoid_: unit, component, service.\n\n**Interface** — everything a caller must know to use the module correctly: the type signature, yes, but also invariants, ordering constraints, error modes, required configuration, and performance characteristics. _Avoid_: API, signature (both too narrow — they name only the type-level surface).\n\n**Implementation** — the code inside a module, its body. Not the same as **Adapter**: a thing can be a small adapter wrapping a large implementation (a Postgres repo) or a large adapter wrapping a small one (an in-memory fake). Say \"adapter\" when the seam is the subject; \"implementation\" otherwise.\n\n**Depth** — leverage at the interface: how much behaviour a caller (or test) can reach per unit of interface it must learn. A module is **deep** when a lot of behaviour hides behind a small interface, **shallow** when the interface is nearly as complex as the implementation.\n\n**Seam** _(Michael Feathers)_ — a place where behaviour can change without editing that place; the *location* where a module's interface sits. Choosing where the seam goes is a design decision in its own right, separate from deciding what lives behind it. _Avoid_: boundary (already overloaded by DDD's bounded context).\n\n**Adapter** — a concrete thing that satisfies an interface at a seam. It names a *role* (which slot it fills), not a substance (what's inside).\n\n**Leverage** — the caller's reward for depth: more capability per unit of interface learned. One implementation pays back across N call sites and M tests.\n\n**Locality** — the maintainer's reward for depth: change, bugs, knowledge, and verification gather in one place instead of scattering across callers. Fix it once, it's fixed everywhere.\n\n## Deep vs shallow\n\n**Deep module** = small interface + plenty of implementation:\n\n```\n┌─────────────────────┐\n│   Small Interface   │  ← Few methods, simple params\n├─────────────────────┤\n│                     │\n│  Deep Implementation│  ← Complex logic hidden\n│                     │\n└─────────────────────┘\n```\n\n**Shallow module** = large interface + thin implementation (avoid):\n\n```\n┌─────────────────────────────────┐\n│       Large Interface           │  ← Many methods, complex params\n├─────────────────────────────────┤\n│  Thin Implementation            │  ← Just passes through\n└─────────────────────────────────┘\n```\n\nAs you shape an interface, ask:\n\n- Can I cut the number of methods?\n- Can I simplify the parameters?\n- Can I bury more complexity inside?\n\n## Principles\n\n- **Depth is a property of the interface, not the implementation.** A deep module may be built inside from small, mockable, swappable pieces — they simply aren't part of the interface. A module can carry **internal seams** (private to its implementation, exercised by its own tests) alongside the **external seam** at its interface.\n- **The deletion test.** Picture deleting the module. If complexity evaporates, it was a pass-through. If complexity resurfaces spread across N callers, it was pulling its weight.\n- **The interface is the test surface.** Callers and tests cross the same seam. If you find yourself wanting to test *past* the interface, the module is probably the wrong shape.\n- **One adapter is a hypothetical seam; two adapters make it real.** Add a seam only when something genuinely varies across it.\n\n## Designing for testability\n\nGood interfaces make tests fall out naturally:\n\n1. **Accept dependencies, don't construct them.**\n\n   ```typescript\n   \u002F\u002F Testable\n   function processOrder(order, paymentGateway) {}\n\n   \u002F\u002F Hard to test\n   function processOrder(order) {\n     const gateway = new StripeGateway();\n   }\n   ```\n\n2. **Return results rather than firing side effects.**\n\n   ```typescript\n   \u002F\u002F Testable\n   function calculateDiscount(cart): Discount {}\n\n   \u002F\u002F Hard to test\n   function applyDiscount(cart): void {\n     cart.total -= discount;\n   }\n   ```\n\n3. **Small surface area.** Fewer methods means fewer tests; fewer params means simpler setup.\n\n## Relationships\n\n- A **Module** has exactly one **Interface** (the surface it shows callers and tests).\n- **Depth** is a property of a **Module**, measured against its **Interface**.\n- A **Seam** is where a **Module**'s **Interface** lives.\n- An **Adapter** sits at a **Seam** and satisfies the **Interface**.\n- **Depth** yields **Leverage** for callers and **Locality** for maintainers.\n\n## Rejected framings\n\n- **Depth as the ratio of implementation lines to interface lines** (Ousterhout): rewards padding the implementation. Prefer depth-as-leverage.\n- **\"Interface\" as the TypeScript `interface` keyword or a class's public methods**: too narrow — here, interface covers every fact a caller must know.\n- **\"Boundary\"**: overloaded by DDD's bounded context. Say **seam** or **interface**.\n\n## Going deeper\n\n- **Deepening a cluster given its dependencies** — see [DEEPENING.md](DEEPENING.md): dependency categories, seam discipline, and replace-don't-layer testing.\n- **Exploring alternative interfaces** — see [DESIGN-IT-TWICE.md](DESIGN-IT-TWICE.md): fan out parallel sub-agents to design the interface several radically different ways, then compare on depth, locality, and seam placement.\n",{"name":5,"description":7},"main","e1e71e8aa302edca3e052370aefa9272f86d07ee","skills\u002Fengineering\u002Fcodebase-design",0,"https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills","https:\u002F\u002Fgithub.com\u002Fofficialunofficial","officialunofficial.com","2026-11-06 10:07:10",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add officialunofficial\u002Fskills --skill codebase-design",{"tool":38,"command":39},"bunx","bunx skills add officialunofficial\u002Fskills --skill codebase-design",{"tool":41,"command":42},"pnpm","pnpm dlx skills add officialunofficial\u002Fskills --skill codebase-design","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fcodebase-design\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"DEEPENING.md","REFERENCE","参考文档",2623,"https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fcodebase-design\u002FDEEPENING.md",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},"DESIGN-IT-TWICE.md",2745,"https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fengineering\u002Fcodebase-design\u002FDESIGN-IT-TWICE.md",[57,64,71,78,85,92],{"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":19},"01M7887BDP2BC5HFHEKCNMBZ4Q","writing-great-skills","Reference for writing and editing skills well — the vocabulary and principles that make a skill predictable.","https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fwriting-great-skills\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":15,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":19},"01M788772K4QYXCZX3Y2P2AX9V","technical-writing","House style for technical writing — the voice, sentence craft, formatting, and user-facing-copy rules that make docs and product text clear, direct, and consistent. Use when writing or editing a README, docs, a spec, release notes, a changelog, help text, or any error\u002FCLI\u002FUI copy a person reads; when reviewing a diff that touches prose or messages; or when a project needs a writing standard. Reference-heavy mechanics live in REFERENCE.md.","https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Ftechnical-writing\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":19},"01M78875087F1XKP7C6VRC49CY","teach","Teach the user a new skill or concept, within this workspace.","https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fteach\u002FSKILL.md",[],[],{"skillNo":79,"name":80,"nameZh":6,"description":81,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":82,"categories":83,"keywords":84,"publishedAt":19},"01M78872Z38MACN22AQDY9410P","handoff","Compact the current conversation into a handoff document for another agent to pick up.","https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fhandoff\u002FSKILL.md",[],[],{"skillNo":86,"name":87,"nameZh":6,"description":88,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M78870FVRDYRT1WVP9HJ6FQ3","grilling","Interrogate the user's plan or design one decision at a time until you both share the same understanding. Use when the user wants to pressure-test an idea before building it, or reaches for any 'grill' trigger phrase.","https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fgrilling\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":19},"01M7886XGPEWXZYDA6K310HNYP","grill-me","A relentless, one-decision-at-a-time interview that sharpens a plan or design.","https:\u002F\u002Fgithub.com\u002Fofficialunofficial\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fproductivity\u002Fgrill-me\u002FSKILL.md",[],[]]