improve-codebase-architecture
Skill18 starsChanged 3 months agoMITView on GitHub
Scan a codebase (or a named area of one) for architectural friction, classify each finding by how it was incurred, and propose deepening opportunities in priority order. Use when the user wants an architecture review, asks where the design is causing pain, wants technical debt surfaced and prioritized, or asks what to refactor next.
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 repository33 other files it gives its agents.
- api-design-standardsSkill
- architecture-diagramSkill
- capacity-estimationSkill
- codebase-designSkill
- code-reviewSkill
- code-style-lintSkill
- dependency-upgrade-managementSkill
- diagnosing-bugsSkill
- domain-modelingSkill
- explain-plainlySkill
- grillingSkill
- handoffSkill
- incident-responseSkill
- observabilitySkill
- project-groundworkSkill
- prototypeSkill
- release-versioningSkill
- repo-secureSkill
- repo-shipSkill
- researchSkill
- resolving-merge-conflictsSkill
- safe-deploymentSkill
- secure-codingSkill
- spec-to-ticketsSkill
- tddSkill
- teachSkill
- test-strategySkill
- to-questionnaireSkill
- triageSkill
- wait-whatSkill
- wayfinderSkill
- wizardSkill
- writing-for-agentsSkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 2 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 187 edited versions we read keep these.
2
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 16
If the user named a module, subsystem, or pain point, take it directly.
- Distinctive: line 19
Read any existing domain glossary or ADRs covering the scoped area first, so findings don't re-litigate a decision already made …
“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
Not every rough edge is the same kind of problem. This skill's defining constraint, from Martin Fowler's technical debt quadrant: every finding is classified on two axes before it's prioritized: deliberate vs. inadvertent (was the tradeoff known at the time) and prudent vs. reckless (was it a reasoned tradeoff or a corner cut under pressure). A knowingly-accepted tradeoff and an accidental mistake call for different responses even when the resulting code looks identical.
This skill finds what's shallow; codebase-design supplies the vocabulary (module, interface, depth, seam) for describing why, and the deletion test in Phase 2 is this skill's own. Use that skill's terms exactly rather than drifting into generic words like "component" or "service."
Phase 1: Scope the scan
Decide where to look before looking everywhere, scanning a whole codebase uniformly dilutes attention across places that don't need it:
- If the user named a module, subsystem, or pain point, take it directly.
- Otherwise, walk back through recent commit history to find hot spots (files and areas that keep recurring) since a module actively being changed pays back a deepening investment faster than a stable, rarely-touched one.
Read any existing domain glossary or ADRs covering the scoped area first, so findings don't re-litigate a decision already made deliberately.
Phase 2: Find the friction
Walk the scoped code looking for Ousterhout-style red flags (see codebase-design for the full vocabulary):
- A module whose interface is nearly as complex as its implementation; shallow, not deep.
- Understanding one concept requires bouncing across many small modules to assemble the picture.
- Logic extracted into "testable" pure functions while the real bugs live in how and where they're called; no locality.
- A seam that's leaking implementation details across it instead of hiding them.
For each candidate, apply the deletion test: would removing it concentrate the complexity somewhere sensible, or just relocate the same mess? Only "concentrates" candidates are worth writing up.
Phase 3: Classify by how it was incurred
For each finding, place it in Fowler's quadrant before deciding what to recommend:
| Prudent | Reckless | |
| Deliberate | Accepted knowingly, for a reason: check first whether an ADR already documents why. If so, this may not be a finding at all; only surface it if the friction now outweighs the original reason. | Cut knowingly, for speed, without reasoning through the cost. Flag directly: this is the case most worth revisiting. |
| Inadvertent | A better approach was learned after the fact; normal to accumulate as understanding grows. Prioritize by current cost, not by fault. | A mistake made without the knowledge to avoid it at the time. Worth fixing, but don't frame it as blame: the point is the code's current state, not who wrote it. |
A Deliberate/Prudent finding that still has a live ADR usually isn't a finding; skip it unless the original tradeoff has genuinely stopped paying off. The other three quadrants are real candidates, but the framing of the recommendation differs by quadrant, not just the priority.
Phase 4: Present in priority order
For each surfaced candidate, state:
- Where: the files/modules involved, named with the project's own domain vocabulary where one exists.
- Quadrant: which of the four cells it falls in, and why.
- Problem: the concrete friction this causes today (not hypothetical future pain).
- Proposed deepening: what would change, described in
codebase-designterms. - Cost of leaving it vs. cost of fixing it: the actual tradeoff, since a Reckless/Deliberate finding with a low leave-cost may still not be worth touching now.
Order candidates by leave-cost, not by how easy the fix is; an easy fix for a low-cost problem is not more urgent than a harder fix for a problem actively slowing the team down. Write the findings without em dashes, using a comma, colon, period, or a reworded sentence instead.
Phase 5: Record the decision
Once the user picks a candidate to act on (or explicitly declines one with a load-bearing reason):
- A declined finding with a real reason behind it is an ADR candidate per
domain-modeling, so the next scan doesn't re-surface the same already-settled question. - A finding acted on gets designed properly; run
codebase-design's design-it-twice practice before committing to one interface, rather than taking the first shape that comes to mind.
Done when
- The scan was scoped deliberately (named area or recent hot spots), not run uniformly over the whole codebase.
- Every finding passed the deletion test before being written up.
- Every finding is classified into one of Fowler's four quadrants, with the classification driving how it's framed.
- Findings are ordered by the cost of leaving them, not by ease of fixing them.
- A declined finding with a real reason is captured as an ADR so it isn't re-surfaced next scan.
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.

