improve-codebase-architecture

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.

8 stars

Best use case

improve-codebase-architecture is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

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.

Teams using improve-codebase-architecture should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/improve-codebase-architecture/SKILL.md --create-dirs "https://raw.githubusercontent.com/drvoss/everything-copilot-cli/main/skills/development/improve-codebase-architecture/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/improve-codebase-architecture/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How improve-codebase-architecture Compares

Feature / Agentimprove-codebase-architectureStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

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.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# 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`](../zoom-out/SKILL.md) |
| The architecture is fine and you just need safe cleanup | [`refactor-clean`](../refactor-clean/SKILL.md) |
| You are defining a new feature before coding | [`spec-driven-development`](../spec-driven-development/SKILL.md) |

## 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.

### 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:

```markdown
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 edits
```

### 4. 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-docs`](../../workflow/grill-with-docs/SKILL.md)
  when design language and existing decisions must stay aligned

Related Skills

architecture-decisions

8
from drvoss/everything-copilot-cli

Use when making significant, hard-to-reverse technical decisions to document context, rationale, and consequences as Architecture Decision Records (ADRs)

verification-before-completion

8
from drvoss/everything-copilot-cli

Use before claiming any task is done — run the exact command that proves the fix works, read the output, and only then report success.

using-git-worktrees

8
from drvoss/everything-copilot-cli

Use when you need multiple branches checked out at once — create isolated working directories for parallel development without cloning the repository repeatedly

triage

8
from drvoss/everything-copilot-cli

Use when a single issue needs structured triage — classify it, reproduce if needed, request missing information, and leave a durable brief or close-out note in the tracker.

to-issues

8
from drvoss/everything-copilot-cli

Use when a plan, spec, or PRD must become an actionable backlog — break it into thin dependency-aware issues that each deliver a verifiable vertical slice

sprint-workflow

8
from drvoss/everything-copilot-cli

Use when starting a new feature, refactor, or multi-step dev task — runs the full sprint cycle (Think → Plan → Build → Review → Test → Ship → Monitor) using Copilot CLI's plan/autopilot modes.

sprint-retro

8
from drvoss/everything-copilot-cli

Use at the end of a sprint to run a data-driven retrospective — analyzes session history and git metrics to surface what shipped, what slowed you down, and concrete improvements.

security-audit

8
from drvoss/everything-copilot-cli

Use when a codebase needs a formal security audit beyond a quick scan — applies OWASP Top 10 and STRIDE threat modeling from a CSO perspective to surface systemic vulnerabilities.

release

8
from drvoss/everything-copilot-cli

Use when a sprint or feature is complete and ready to ship — tags the version, generates GitHub Release notes, runs rollout or smoke verification, and publishes to npm/PyPI/Docker registries.

prompt-optimizer

8
from drvoss/everything-copilot-cli

Use when a rough prompt, vague idea, or task description needs to become a finished copy-pasteable prompt for a chat-based LLM - rewrite it into one ready-to-send prompt with no blanks, no placeholders, and a clear output shape.

outside-voice

8
from drvoss/everything-copilot-cli

Use when you need an independent second opinion before, during, or after implementation — run challenge, consult, or review mode in a direct builder-to-builder voice

llm-wiki

8
from drvoss/everything-copilot-cli

Use when research or domain knowledge keeps getting rediscovered across sessions — build a supplementary markdown wiki that compounds synthesized knowledge without replacing GitHub or committed project guidance