agentleFS
drvossdrvoss/everything-copilot-cli/skills/development/improve-codebase-architecture/SKILL.md

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

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.
  • kayamanSkill

    request-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

  • qhuang20Skill

    migrate-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

  • RoentekSkill

    writing-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

  • AnasX7Skill

    scaffold-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

  • AnasX7Skill

    setup-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

  • kayamanSkill

    edit-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

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
  1. Distinctive:

    Use this skill when local cleanup is not enough and the problem is architectural shape: too many shallow modules, leaky seams, or a design …

    line 12
  2. Distinctive:

    Use these terms consistently while reviewing the design:

    line 39
  3. Distinctive:

    Read the domain vocabulary and architecture decisions before suggesting anything.

    line 52
  4. Distinctive:

    Prefer the project's own names for subsystems and workflows instead of inventing new terminology.

    line 53
  5. Distinctive:

    If the user already named a subsystem, workflow, or module, keep the review there.

    line 58
  6. Distinctive:

    If they did not, use recent commit, PR, or change history to identify which areas are actively changing and scope the architectural review …

    line 59
  7. Distinctive:

    Look for places where:

    line 66
  8. Distinctive:

    Do not rewrite half the codebase in one jump.

    line 100
  9. Distinctive:

    When the direction is clear, record it in the right durable place:

    line 104
  10. Distinctive:

    If three controllers each validate, transform, and retry the same workflow with slightly different glue code, propose a deeper module that …

    line 114
  11. Distinctive:

    If a feature only seems testable through large integration tests because the important logic is spread across helpers and callers, propose …

    line 120
  12. Distinctive:

    Every candidate requires a sweeping rewrite instead of an incremental move

    line 135
  13. Distinctive:

    Use the project's real vocabulary.

    line 148
  14. Distinctive:

    Prefer one strong candidate over a long generic list

    line 149

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

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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-architectureUse
You only need a bigger-picture map of one areazoom-out
The architecture is fine and you just need safe cleanuprefactor-clean
You are defining a new feature before codingspec-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:

TermMeaning
ModuleAny unit with an interface and implementation: function, class, package, or slice
InterfaceEverything a caller must know: types, invariants, ordering, config, and error modes
DepthHow much behavior a module hides behind a small interface
SeamThe 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 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

RationalizationReality
"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 when design language and existing decisions must stay aligned

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.