agentleFS
malinskibeniaminmalinskibeniamin/skills/improve-codebase-architecture/SKILL.md

improve-codebase-architecture

Skill4 starsChanged 10 days agoMITView on GitHub

Redesign module boundaries, ownership, and state to make recurring error classes impossible.

195 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use migrate-to-shoehorn, request-refactor-plan and 7 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.
  • simo97Skill

    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 73 projects that use this

  • simo97Skill

    request-refactor-plan

    Use this skill when user wants to create a refactor plan.

    Also in 43 projects that use this

  • liufeng1976Skill

    setup-ts-deep-modules

    Wire dependency-cruiser into a TypeScript repo so each package is a deep module — implementation hidden in subfolders, reachable only through its entry-point files. User-invoked.

    Also in 43 projects that use this

  • FabienDehopreSkill

    decision-mapping

    Turn a loose idea into a sequenced map of investigation tickets, then drive them to resolution one at a time.

    Also in 8 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 69 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 96 projects that use this

  • +2 more from simo97

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 4 are distinctive, and 4 are very specific to this project.

  • 0

    Common

    Most of the 184 edited versions we read keep these.

  • 4

    Distinctive

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read-only invariant redesign.

    line 11
  2. Distinctive:

    Call the Skill tool with "codebase-design" for vocabulary.

    line 15
  3. Distinctive:

    Interface is the test surface: use its stable interface.

    line 18
  4. Very specific:

    Read GLOSSARY.md and ADRs for settled names/decisions.

    line 23
  5. Very specific:

    Scope before scanning -- YAGNI: Use the named module/error/pain point.

    line 27
  6. Distinctive:

    Read REFERENCE.md. Prefer one source of truth over parallel bookkeeping, validated construction over repeated checks, explicit states over …

    line 33
  7. Very specific:

    Write/open an HTML report at $TMPDIR/architecture-review-<timestamp>.html (fallback /tmp or %TEMP%).

    line 39
  8. Distinctive:

    Call the Skill tool with "grilling": ownership, invariant, module shape, seam/adapters, dependencies, states, migration, rollback, …

    line 47

“Common” is measured: kept by at least 6 in 10 of the 184 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

Read-only invariant redesign. Generic audit: /improve; implementation: /development-lifecycle.

Vocabulary

Call the Skill tool with "codebase-design" for vocabulary. Other hosts: dependency loading.

  • Deletion test: removing a deep module spreads hidden complexity into callers.
  • Interface is the test surface: use its stable interface.
  • Two adapters justify a seam: one adapter is hypothetical.
  • Single source of truth: one owned representation, not parallel lists, flags, registries, validators or lifecycles.
  • Structural invariant: construction/transitions make invalid states impossible or unrepresentable.

Read GLOSSARY.md and ADRs for settled names/decisions.

1. Frame

Scope before scanning -- YAGNI. Use the named module/error/pain point; otherwise git log --name-only --format= for hot spots. Widen only when history is scattered.

Explore inline; delegation needs explicit consent and fresh contexts. Prefer graph tools. Map interfaces, dependencies/calls, data ownership/writers, transitions, failures and public tests.

2. Find opportunities

Read REFERENCE.md. Prefer one source of truth over parallel bookkeeping, validated construction over repeated checks, explicit states over illegal flag combinations, and one deep interface over caller choreography.

For each error class: permissive representation, invariant, why callers cannot recreate it. Regression tests verify design, not architecture.

3. Present

Write/open an HTML report at $TMPDIR/architecture-review-<timestamp>.html (fallback /tmp or %TEMP%); return its path. Follow HTML-REPORT.md. Call the Skill tool with "excalidraw-diagram" only for useful editable before/after evidence.

Candidates: files/evidence, error class, current/proposed invariant, owner/module/interface/seam before/after, locality/leverage/testing gain, migration, rollback, compatibility risk, Strong|Worth exploring|Speculative confidence.

End with Top recommendation; do not finalize interfaces. Ask which candidate to explore.

4. Grill

Call the Skill tool with "grilling": ownership, invariant, module shape, seam/adapters, dependencies, states, migration, rollback, observable tests.

  • New term -> Call the Skill tool with "domain-modeling" for a glossary proposal; durable rejection -> offer ADR. Write only with edit authority.
  • Competing interfaces -> design twice with the loaded codebase-design guidance.
  • Visual proposal/competing proposals -> Call the Skill tool separately with "visual-plan"/"plan-arbiter".
  • Implementation -> reversible sequence for /development-lifecycle.

Done: evidenced error class -> proposed owner/invariant -> reversible migration -> public-contract verification; clear next choice. Design claims to verify at implementation, not changes or passing tests from this read-only review.

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.