agentleFS
me-cedricme-cedric/agent-compass/skills/untangle-codebase/SKILL.md

untangle-codebase

Skill3 starsChanged 45 days agoMITView on GitHub

Untangle a whole codebase in one planned pass, so each later change reads less, breaks less without notice, and debugs faster. Start it yourself; it edits many files.

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use prune-tests, bro and 9 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.
  • Mineru98Skill

    prune-tests

    Prune tests that guard no behavior.

    Also in 4 projects that use this

  • MicrosoftSkill

    bro

    Re-explain the previous assistant message in a much simpler way, for when the reply made you go 'bro what'. Use /bro to get a simpler version of the last answer in Plain Language + Chicago Manual of Style, with diagrams where they help.

    Also in 3 projects that use this

  • GoogleSkill

    codebase-design

    Shared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary.

    Also in 4 projects that use this

  • GoogleSkill

    diagnosing-bugs

    Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.

    Also in 4 projects that use this

  • MicrosoftSkill

    grill-with-docs

    Grilling session that challenges your plan against the existing domain model, sharpens terminology, and updates documentation (CONTEXT.md, ADRs) inline as decisions crystallise. Use when user wants to stress-test a plan against their project's language and documented decisions.

    Also in 4 projects that use this

  • photon-groveSkill

    unslop

    Detects and rewrites generic, overly polished, or AI-sounding prose while preserving meaning. Use when the user asks to "unslop", humanize, de-AI, tighten, or review whether writing sounds generated.

    Also in 3 projects that use this

  • +4 more from google

The file

We split this skill into the rules it gives an agent

10 rules. 1 is common, 9 are distinctive, and 0 are very specific to this project.

  • 1

    Common

    Most of the 13 edited versions we read keep these.

  • 9

    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:

    Check the branch and its base.

    line 19
  2. Distinctive:

    Run the project checks. Record the result.

    line 20
  3. Distinctive:

    Ask one question: do you also want Comments (remove comments that only restate the code) or Tests (see step 4)?

    line 21
  4. Distinctive:

    Remove a comment that restates the implementation, even if it is phrased as a why.

    line 57
  5. Distinctive:

    Keep a comment about something outside the code, such as a proxy that drops websockets.

    line 58
  6. Distinctive:

    Remove a workaround comment when the redesign removes the problem behind it.

    line 59
  7. Distinctive:

    Remove a test that cannot fail, or that repeats the implementation.

    line 62
  8. Distinctive:

    Never remove or weaken a test to make a check pass.

    line 64
  9. Distinctive:

    Run the project checks again.

    line 68
  10. Common:

    Every import is reasonable, and nothing imports code that is more volatile than itself.

    line 73

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

Untangle codebase

Adapted from caldoai/skills (MIT, Maze). This is a planned refactor of many files. Do not start it for a small task.

Goal: pieces that change together sit together. Pieces that change for different reasons are not tied. Everything depends on what changes less.

Before you start

  1. Check the branch and its base. Work on a branch, not on the default branch. Do not commit unless the user asks.
  2. Run the project checks. Record the result. A red check before the start is a blocker: report it and stop.
  3. Ask one question: do you also want Comments (remove comments that only restate the code) or Tests (see step 4)? Do only what the user picks.

1. List every problem

Change nothing yet. Ask one question about each piece: should these pieces change together? Write each wrong answer in a decision log (see references/decision-log.md). There are three kinds.

Hidden links: pieces that must change together, with nothing in the code that shows it.

  • Copies of logic or values.
  • A module that reads a global or file that another module sets.
  • A feature split across folders by layer.
  • A call order or convention that callers must know.

Needless links: pieces that are tied but change for different reasons.

  • Callers that depend on internals.
  • Stable code that imports volatile code.
  • A general function with a parameter that only one workflow understands.
  • A shallow module: its interface changes when its internals change.

Surplus: pieces with no reason of their own to change.

  • Wrappers that only pass calls through.
  • Extension points and config for things that never vary.
  • Dead code.

Also write each special case: code that exists for one situation and does not follow from how the system works. Examples: an if for one value, a parameter for one caller, a swallowed exception, a retry or sleep, a disabled test. Each one is a requirement that the design did not plan for.

2. Redesign from first principles

Work out the fixes as if the system had known today's requirements from the start. Look for the one fix behind several problems. Do not fix special cases one by one. Write each fix above the problems that it solves.

3. Show the plan, then fix

Show the user the decision log. Wait for a yes. Then fix everything on the list. Keep a special case that the system still needs. Do not hunt for bugs separately. Keep input validation, data-loss handling, security controls and accessibility basics.

4. Optional parts

Comments:

  • Remove a comment that restates the implementation, even if it is phrased as a why.
  • Keep a comment about something outside the code, such as a proxy that drops websockets.
  • Remove a workaround comment when the redesign removes the problem behind it.

Tests (do this last; tests are the safety net):

  • Remove a test that cannot fail, or that repeats the implementation.
  • Rewrite a test that is tied to internals so it checks behavior.
  • Never remove or weaken a test to make a check pass. Run the checks after each change.

5. Check, and repeat

Run the project checks again. Use subagents (two or fewer at a time) to search for special cases, hidden links, needless links and surplus. Fix what they find. Stop after 3 passes, or earlier when a pass finds nothing worth fixing. Report anything left.

Done when:

  • Few special cases are left, and each has a reason.
  • A typical change lands in one place.
  • Every import is reasonable, and nothing imports code that is more volatile than itself.
  • The project checks give the same result as before the start. Behavior is the same, apart from bugs that the refactor fixed.

The summary gives the decision log path, the fixes made, each check with its result, and the problems left.

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.