with one click
codebase-improve
// Use when finding architectural friction in a codebase. Surfaces shallow modules, proposes refactors for testability/AI-navigability, grills the design. Uses CONTEXT.md + ADRs.
// Use when finding architectural friction in a codebase. Surfaces shallow modules, proposes refactors for testability/AI-navigability, grills the design. Uses CONTEXT.md + ADRs.
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | codebase-improve |
| description | Use when finding architectural friction in a codebase. Surfaces shallow modules, proposes refactors for testability/AI-navigability, grills the design. Uses CONTEXT.md + ADRs. |
| disable-model-invocation | true |
| metadata | {"upstream":"mattpocock/skills/engineering/improve-codebase-architecture","adapted-date":"2026-04-28"} |
Surface architectural friction and propose deepening opportunities — refactors that turn shallow modules into deep ones. The aim is testability and AI-navigability.
Use these terms exactly in every suggestion. Consistent language is the point — don't drift into "component," "service," "API," or "boundary." Full definitions in ${CLAUDE_SKILL_DIR}/LANGUAGE.md.
Key principles (see ${CLAUDE_SKILL_DIR}/LANGUAGE.md for the full list):
This skill is informed by the project's domain model. The domain language gives names to good seams; ADRs record decisions the skill should not re-litigate.
These commands run automatically when the skill loads — output replaces each line below:
cat CONTEXT.md 2>/dev/null || truels docs/adr/ 2>/dev/null || trueIf CONTEXT.md content is present above, use that vocabulary throughout. If ADR list showed files, read the relevant ones before exploring.
Then use the Agent tool with subagent_type=Explore to walk the codebase. Don't follow rigid heuristics — explore organically and note where you experience friction:
Apply the deletion test to anything you suspect is shallow: would deleting it concentrate complexity, or just move it? A "yes, concentrates" is the signal you want.
Present a numbered list of deepening opportunities. For each candidate:
Use CONTEXT.md vocabulary for the domain, and ${CLAUDE_SKILL_DIR}/LANGUAGE.md vocabulary for the architecture.
ADR conflicts: if a candidate contradicts an existing ADR, only surface it when the friction is real enough to warrant revisiting the ADR. Mark it clearly (e.g. "contradicts ADR-0007 — but worth reopening because…").
Do NOT propose interfaces yet. Ask the user: "Which of these would you like to explore?"
Once the user picks a candidate, drop into a grilling conversation. Walk the design tree with them — constraints, dependencies, the shape of the deepened module, what sits behind the seam, what tests survive.
Side effects happen inline as decisions crystallize:
CONTEXT.md? Add the term to CONTEXT.md. Create the file lazily if it doesn't exist.CONTEXT.md right there.${CLAUDE_SKILL_DIR}/INTERFACE-DESIGN.md.