improve-codebase-architecture
Skill47 starsChanged 4 months agoMITView on GitHub
Use when a codebase feels hard to change, test, or navigate — surface architectural friction, identify deeper module seams, and walk one candidate into a concrete refactoring direction.
194 other projects use a version of this.
Adopted by
Most recently taken up by
- mattpocock/skillstheir own version, first seen Oct 8, 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
- michielvandermeer/skillstheir own version, first seen Oct 4, 2026
Used with
Projects with it also use request-refactor-plan, migrate-to-shoehorn 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.
kayamanSkillrequest-refactor-plan
Guides creating a detailed refactor plan with tiny commits via user interview, then files it as a GitHub issue. Use when user wants to plan a refactor, create a refactoring RFC, or break a refactor into safe incremental steps.
Also in 24 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 34 projects that use this
RoentekSkillwriting-beats
Writing, exploit — assemble raw material into a journey of beats, grounding each term before a beat leans on it.
Also in 27 projects that use this
AnasX7Skillscaffold-exercises
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
Also in 34 projects that use this
AnasX7Skillsetup-pre-commit
Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
Also in 43 projects that use this
kayamanSkilledit-article
Edit and improve articles by restructuring sections, improving clarity, and tightening prose. Use when user wants to edit, revise, or improve an article draft.
Also in 21 projects that use this
- +1 more from kayaman
Other versions194 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 194
- mattpocock/skills★ 335ksame name
- LibreChat-AI/LibreChat★ 45ksame name
- vinvcn/mattpocock-skills-zh-CN★ 4.6ksame name
- cashew-labs/libretto★ 904same name
- stevesolun/ctx★ 588same name
- nodetool-ai/nodetool★ 551same name
- chrisdoc/hevy-mcp★ 498same name
- mxyhi/ok-skills★ 492same name
- aws/graph-explorer★ 484same name
- devcxl/mattpocock-skills-zh★ 426same name
184 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 repository111 other files it gives its agents.
- AGENTS.mdAGENTS.md
- COPILOT-INSTRUCTIONS.mdCopilot instructions
- .github/copilot-instructions.mdCopilot instructions
- ai-visibilitySkill
- content-strategySkill
- seoSkill
- actions-debuggingSkill
- agentic-engineeringSkill
- autopilot-patternsSkill
- background-agentSkill
- context-primeSkill
- copilot-memorySkill
- cross-session-memorySkill
- ecosystem-intakeSkill
- fleet-parallelSkill
- github-code-searchSkill
- github-codespaces-efficiencySkill
- github-issue-triageSkill
- github-pr-workflowSkill
- ide-switchingSkill
- knowledge-curatorSkill
- mcp-builderSkill
- mcp-ecosystemSkill
- multi-model-strategySkill
- plan-mode-masterySkill
- scope-guardSkill
- session-managementSkill
- stack-detectorSkill
- sub-agent-sandboxingSkill
- task-intake-routerSkill
- team-plannerSkill
- token-cost-optimizerSkill
- api-and-interface-designSkill
- code-reviewSkill
- context-engineeringSkill
- cpp-debuggingSkill
- deprecation-and-migrationSkill
- diagnoseSkill
- fix-build-errorsSkill
- fix-github-issueSkill
- implementSkill
- nestjs-prismaSkill
- nextjs-prismaSkill
- performance-optimizationSkill
- pr-multi-perspective-reviewSkill
- prototypeSkill
- react-vitestSkill
- receiving-code-reviewSkill
- refactor-cleanSkill
- reviewSkill
- skill-creatorSkill
- source-driven-developmentSkill
- spec-driven-developmentSkill
- systematic-debuggingSkill
- tdd-workflowSkill
- zoom-outSkill
- add-to-changelogSkill
- api-documentationSkill
- architecture-decisionsSkill
- code-tourSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 14 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 187 edited versions we read keep these.
14
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 12
Use this skill when local cleanup is not enough and the problem is architectural shape: too many shallow modules, leaky seams, or a design …
- Distinctive: line 39
Use these terms consistently while reviewing the design:
- Distinctive: line 52
Read the domain vocabulary and architecture decisions before suggesting anything.
- Distinctive: line 53
Prefer the project's own names for subsystems and workflows instead of inventing new terminology.
- Distinctive: line 58
If the user already named a subsystem, workflow, or module, keep the review there.
- Distinctive: line 59
If they did not, use recent commit, PR, or change history to identify which areas are actively changing and scope the architectural review …
- Distinctive: line 66
Look for places where:
- Distinctive: line 100
Do not rewrite half the codebase in one jump.
- Distinctive: line 104
When the direction is clear, record it in the right durable place:
- Distinctive: line 114
If three controllers each validate, transform, and retry the same workflow with slightly different glue code, propose a deeper module that …
- Distinctive: line 120
If a feature only seems testable through large integration tests because the important logic is spread across helpers and callers, propose …
- Distinctive: line 135
Every candidate requires a sweeping rewrite instead of an incremental move
- Distinctive: line 148
Use the project's real vocabulary.
- Distinctive: line 149
Prefer one strong candidate over a long generic list
“Common” is measured: kept by at least 6 in 10 of the 187 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
Improve Codebase Architecture
Use this skill when local cleanup is not enough and the problem is architectural shape: too many shallow modules, leaky seams, or a design that is hard to test through the public interface.
When to Use
- The codebase is correct enough to run, but hard to extend safely
- Understanding one concept requires bouncing across too many tiny modules
- Tests are brittle because the interesting behavior leaks across current seams
- A refactor candidate needs architectural reasoning before code changes start
When NOT to Use
| Instead of improve-codebase-architecture | Use |
| You only need a bigger-picture map of one area | zoom-out |
| The architecture is fine and you just need safe cleanup | refactor-clean |
| You are defining a new feature before coding | spec-driven-development |
Prerequisites
- Access to the project's README, architecture docs, glossary, ADRs, or equivalent guidance
- Enough codebase access to inspect callers, collaborators, and tests
- Willingness to stop at a candidate list first instead of jumping straight into rewrites
Working Vocabulary
Use these terms consistently while reviewing the design:
| Term | Meaning |
| Module | Any unit with an interface and implementation: function, class, package, or slice |
| Interface | Everything a caller must know: types, invariants, ordering, config, and error modes |
| Depth | How much behavior a module hides behind a small interface |
| Seam | The place where behavior can change without editing every caller |
Workflow
1. Load the project's language first
Read the domain vocabulary and architecture decisions before suggesting anything. Prefer the project's own names for subsystems and workflows instead of inventing new terminology.
1-A. Decide where to look before scanning
If the user already named a subsystem, workflow, or module, keep the review there. If they did not, use recent commit, PR, or change history to identify which areas are actively changing and scope the architectural review to those active areas first rather than surveying the whole repository. Deepening architecture pays off most where future changes are likely to land; stable untouched areas are a lower priority.
2. Explore for architectural friction
Look for places where:
- the interface is nearly as complicated as the implementation
- behavior is scattered across many pass-through modules
- tests mostly exercise wiring because the real logic has no stable seam
- bug fixes require touching several files that conceptually belong together
Apply a quick deletion test: if deleting the module would only move the same complexity to every caller, it is earning its keep; if complexity largely disappears, the module is probably shallow.
3. Present deepening opportunities
Return a short numbered list of candidates before proposing exact interfaces. Use this shape:
1. **Candidate:** Order intake module
- **Files:** `src/...`
- **Problem:** Callers know too much about validation and retries
- **Suggested seam:** Consolidate workflow behind one module
- **Why it helps:** Better locality, simpler tests, fewer cross-file edits4. Grill the chosen candidate
Once the user picks a candidate, walk the design tree with them:
- what behavior belongs behind the new seam
- what stays outside
- which dependencies become adapters
- what the new test surface should look like
- whether any ADR or glossary term needs updating
Do not rewrite half the codebase in one jump. The goal is one clear architectural move.
5. Capture the decision
When the direction is clear, record it in the right durable place:
- ADR for a structural decision that future contributors must not re-litigate
- spec or plan for an approved refactor
- issue or backlog item if the work is valuable but deferred
Examples
Example: Thin pass-through module
If three controllers each validate, transform, and retry the same workflow with slightly different glue code, propose a deeper module that owns the workflow and leaves controllers with parameter collection plus response mapping.
Example: Testability problem
If a feature only seems testable through large integration tests because the important logic is spread across helpers and callers, propose a seam that centralizes decisions and makes public behavior testable in one place.
Common Rationalizations
| Rationalization | Reality |
| "We should just rewrite the whole area" | Rewrites hide the real design problem. Find one load-bearing seam first. |
| "Small files mean good architecture" | Splitting code is not the same as creating depth. Shallow modules still leak complexity. |
| "We can decide the interface later" | The interface is the real design work; skipping it postpones the hard part. |
Red Flags
- Proposed modules are named after implementation details instead of domain concepts
- Every candidate requires a sweeping rewrite instead of an incremental move
- The same ADR conflict appears, but no one states whether it should be reopened
- Tests get harder because the design introduces more wiring than leverage
Verification
- The review produced a short candidate list before detailed design work
- Each candidate names affected files, the current problem, and the expected leverage
- The chosen direction defines a clearer seam and a simpler test surface
- Any ADR or glossary conflict is called out explicitly instead of ignored
Tips
- Use the project's real vocabulary; architecture advice is weaker when the language drifts
- Prefer one strong candidate over a long generic list
- Pair this skill with
grill-with-docswhen design language and existing decisions must stay aligned
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.

