codebase-design
Skill3 starsChanged 4 months agoMITView on GitHub
Use when designing deep modules, finding refactoring or deepening opportunities, or making a codebase more testable and AI-navigable. Presents deepening opportunities and works through the one you pick. Triggers on "deep modules", "refactor architecture", "deepening", "深化模块", "重构架构", "代码库设计". Not for executing the change (use refactoring), single-file clarity (use simplify), or greenfield architecture (use architecture) — this skill designs and audits, it does not edit code.
139 other projects use a version of this.
Adopted by
Most recently taken up by
- mattpocock/skillstheir own version, first seen Oct 8, 2026
- rafaelob/pragmatic-agent-skillstheir own version, first seen Oct 5, 2026
- hmjBill/skillstheir own version, first seen Oct 5, 2026
- AlexisBalayre/claude-code-configtheir own version, first seen Oct 5, 2026
- KroxiDev/engineering-skillstheir own version, first seen Oct 5, 2026
- gordon1210/reposcouttheir own version, first seen Oct 4, 2026
Used with
Projects with it also use writing-beats, writing-shape and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
RoentekSkillwriting-beats
Writing, exploit — assemble raw material into a journey of beats, grounding each term before a beat leans on it.
Also in 23 projects that use this
RoentekSkillwriting-shape
Writing, exploit — shape raw material into an article, paragraph by paragraph.
Also in 23 projects that use this
loulanyueSkillsetup-ts-deep-modules
Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.
Also in 16 projects that use this
risadamsSkillwhich-skill
Router over this pack's skills and flows. Ask it "which skill fits X" when you don't remember what's available.
Also in 5 projects that use this
pahwarangerSkillsetup-skills
Sets up an `## Agent skills` block in AGENTS.md/CLAUDE.md and `docs/agents/` so the engineering skills know this repo's ticket tracker (GitHub or local markdown), triage label vocabulary, and domain doc layout. Run before first use of `to-tickets`, `to-prd`, `triage`, `diagnose`, `tdd`, `improve-codebase-architecture`, or `zoom-out` — or if those skills appear to be missing context about the ticket tracker, triage labels, or domain docs.
Also in 7 projects that use this
qhuang20Skillmigrate-to-shoehorn
Migrate test files from `as` type assertions to @total-typescript/shoehorn. Use when user mentions shoehorn, wants to replace `as` in tests, or needs partial test data.
Also in 24 projects that use this
- +2 more from Roentek
Other versions139 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 139
- mattpocock/skills★ 335ksame name
- LibreChat-AI/LibreChat★ 45ksame name
- vinvcn/mattpocock-skills-zh-CN★ 4.6ksame name
- stevesolun/ctx★ 588same name
- nodetool-ai/nodetool★ 551same name
- mxyhi/ok-skills★ 492same name
- aws/graph-explorer★ 484same name
- devcxl/mattpocock-skills-zh★ 426same name
- Tiberriver256/mcp-server-azure-devops★ 393same name
- bighadj22/codflow★ 338same name
129 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- brainstormSkill
- oss-strategySkill
- specSkill
- researchSkill
- api-designSkill
- architectureSkill
- design-researchSkill
- domain-modelingSkill
- frontend-designSkill
- imagegenSkill
- image-to-codeSkill
- prompt-engineeringSkill
- prototypeSkill
- schema-designSkill
- auth-implementationSkill
- breakdownSkill
- context-engineeringSkill
- error-handlingSkill
- i18nSkill
- implementSkill
- multi-agent-orchestrationSkill
- cost-optimizationSkill
- performanceSkill
- refactoringSkill
- simplifySkill
- api-testingSkill
- e2e-testingSkill
- load-testingSkill
- tddSkill
- test-generationSkill
- a11y-reviewSkill
- code-reviewSkill
- debuggingSkill
- lintingSkill
- security-reviewSkill
- ci-cdSkill
- deprecation-migrationSkill
- git-workflowSkill
- oss-polishSkill
- shippingSkill
- documentation-auditSkill
- handoffSkill
- incident-responseSkill
- observabilitySkill
- purity-auditSkill
- skill-authoringSkill
- using-skillsSkill
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 2 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 128 edited versions we read keep these.
2
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
Read the project's domain glossary (CONTEXT.md) and any ADRs in the area you're touching first — the domain language names good seams.
- Very specific: line 49
Write a self-contained HTML file to the OS temp directory (resolve from $TMPDIR, fall back to /tmp or %TEMP%), at …
- Distinctive: line 59
If a candidate contradicts an existing ADR, only surface it when the friction warrants reopening the ADR.
- Distinctive: line 64
Do NOT propose interfaces yet.
“Common” is measured: kept by at least 6 in 10 of the 128 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Codebase Design
Design deep modules: a lot of behaviour behind a small interface, placed at a clean seam, testable through that interface. Leverage for callers, locality for maintainers, testability for everyone. This skill merges the deep-module vocabulary with a scan-and-grill workflow: surface architectural friction as deepening opportunities, present them as a visual HTML report, then grill through the one the user picks.
When to use
- Designing a new module or restructuring an existing one — deciding where a seam goes, what hides behind it
- Finding refactoring or deepening opportunities across a codebase
- Making a codebase more testable or AI-navigable
- Consolidating tightly-coupled shallow modules into one deep module
- Triggers on "deep module", "seam", "refactoring opportunity", "架构改进", "模块设计", "deepening", "深化模块", "重构架构", "代码库设计"
Not for: executing the structural change once the design is settled (use refactoring); single-file clarity cleanup — naming, nesting, dead code (use simplify); greenfield system architecture (use architecture); feature-level API contracts (use api-design). This skill designs and audits; it does not edit code.
Steps
1. Scan for deepening opportunities
Read the project's domain glossary (CONTEXT.md) and any ADRs in the area you're touching first —
the domain language names good seams; ADRs record decisions not to re-litigate.
Scope before you scan — put weight on parts of the codebase that have recently changed. If the user
named a direction, take it. Otherwise walk the commit history (git log --oneline) to find hot
spots, then explore those paths first.
Spawn an Explore sub-agent to walk the codebase and note friction (if sub-agents are unavailable in this environment, walk it yourself with Glob/Grep/Read, focusing on recently-changed files via git log --oneline -20). Note where understanding one
concept requires bouncing between many small modules; where modules are shallow (interface
nearly as complex as the implementation); where pure functions were extracted just for testability
but bugs hide in how they're called; where tightly-coupled modules leak across seams; where code
is untested or hard to test through its current interface.
Apply the deletion test to anything suspect: would deleting it concentrate complexity, or just move it? "Concentrates" is the signal.
- Load references/language.md for the glossary (module, interface, depth, seam, adapter, leverage, locality) and principles
- Load references/deepening.md for dependency categories and the replace-don't-layer testing strategy
2. Present candidates as an HTML report
Write a self-contained HTML file to the OS temp directory (resolve from $TMPDIR, fall back to
/tmp or %TEMP%), at <tmpdir>/architecture-review-<timestamp>.html. Open it for the user
(xdg-open / open / start) and tell them the absolute path.
Each candidate is a card: Files, Problem, Solution, Benefits (in terms of locality and leverage),
a before/after visualisation, and a recommendation-strength badge (Strong / Worth exploring /
Speculative). End with a Top Recommendation section. Use CONTEXT.md vocabulary for the domain and
the glossary for the architecture — if CONTEXT.md defines "Order," say "the Order intake module,"
not "the FooBarHandler."
If a candidate contradicts an existing ADR, only surface it when the friction warrants reopening the ADR; mark it clearly in the card.
- Load references/html-report.md for the full HTML scaffold, diagram patterns, and styling guidance
Do NOT propose interfaces yet. After the file is written, ask: "Which of these would you like to explore?"
3. Grill through the chosen candidate
Once the user picks a candidate, walk the design tree: constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive. Side effects happen inline as decisions crystallize:
- Naming a deepened module after a concept not in
CONTEXT.md? Add the term toCONTEXT.md(create it lazily if needed). - Sharpening a fuzzy term? Update
CONTEXT.mdright there. - User rejects the candidate with a load-bearing reason? Offer an ADR so future reviews don't re-suggest it.
- Want to explore alternative interfaces? Run the design-it-twice parallel sub-agent pattern.
- Load references/interface-design.md for interface design criteria: depth, testability rules, seam placement
- Load references/design-it-twice.md for the parallel sub-agent pattern when exploring alternative interfaces
Output: docs/design/codebase-audit.md — the deepening opportunities found (candidates with
problem/solution/benefit/strength), the one chosen, and the grilled result (defined interface, seam
placement, testing strategy). The HTML report (Step 2) is the visual presentation; this md is the
durable record that survives the temp file.
Verify
- HTML report written to temp dir and opened for the user; absolute path communicated
- Every candidate card has Files, Problem, Solution, Benefits, before/after diagram, strength badge
- Glossary terms used exactly (module, interface, depth, seam, adapter) — no drift to "component," "service," "API," "boundary"
- Domain vocabulary from CONTEXT.md used for module names, not raw type names
- ADR conflicts flagged only when the friction warrants reopening
- After grilling: the chosen candidate has a defined interface, a seam placement, and a testing strategy
Red flags: proposing interfaces during the scan; listing every theoretical refactor an ADR forbids; drifting to "component"/"service"/"API"/"boundary"; skipping the deletion test.
References
- ${CLAUDE_PLUGIN_ROOT}/references/engineering-principles.md — shared discipline (surface assumptions, push back, verify don't assume)
- references/language.md — glossary: module, interface, implementation, depth, seam, adapter, leverage, locality + principles (deletion test, interface is the test surface, one vs two adapters)
- references/deepening.md — dependency categories (in-process, local-substitutable, ports & adapters, mock), seam discipline, replace-don't-layer testing
- references/html-report.md — HTML scaffold, Tailwind/Mermaid via CDN, diagram patterns (mass, cross-section, call-graph collapse), tone and glossary usage
- references/interface-design.md — interface design criteria: what an interface includes, depth, testability rules, comparing alternatives
- references/design-it-twice.md — parallel sub-agent pattern for exploring alternative interfaces (Ousterhout's "Design It Twice")
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

