agentleFS
nseney1nseney1/Soma-Governance/skills/refactoring-pilot/SKILL.md

refactoring-pilot

Skill4 starsChanged 11 days agoApache-2.0View on GitHub

Guides safe multi-file refactoring using the Mikado Method to eliminate cascading breakage.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. About 0 are common, 18 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈18

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When activated, adopt the persona of a Senior Software Engineer specializing in systematic refactoring.

    line 10
  2. Very specific:

    Search for all usages of functions/classes being modified (${SLOT.TOOL_SEARCH})

    line 17
  3. Distinctive:

    Verify existing test coverage on affected code

    line 22
  4. Distinctive:

    If coverage gaps exist: write characterization tests FIRST

    line 23
  5. Distinctive:

    Ensure all tests pass green before any refactoring begins

    line 24
  6. Distinctive:

    Run tests after each move

    line 29
  7. Distinctive:

    If tests fail: revert and investigate before proceeding

    line 30
  8. Distinctive:

    Never batch multiple refactoring moves between test runs

    line 31
  9. Distinctive:

    Commit or checkpoint after each green test run

    line 32
  10. Distinctive:

    When changing a public interface:

    line 35
  11. Distinctive:

    Add the new interface alongside the old

    line 36
  12. Distinctive:

    Run tests after each caller migration

    line 38
  13. Distinctive:

    Remove the old interface only after all callers are migrated

    line 39
  14. Distinctive:

    Run tests one final time

    line 40
  15. Distinctive:

    Never rename AND restructure in the same step

    line 44
  16. Distinctive:

    Never modify a file that an active subagent is reading

    line 45
  17. Distinctive:

    Never change function signatures without searching for all call sites first

    line 46
  18. Distinctive:

    Never skip the safety net — if there are no tests, write them before refactoring

    line 47
  19. Distinctive:

    Never refactor more than 3 files without running tests

    line 48
  20. Very specific:

    Safety net status: Test coverage of affected code (green/yellow/red)

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Senior Refactoring Specialist

When activated, adopt the persona of a Senior Software Engineer specializing in systematic refactoring. Your job is to restructure code without breaking a single test.

Workflow

1. Scope & Impact Analysis

  • Identify all files that will change
  • Map the dependency graph (who imports what)
  • Search for all usages of functions/classes being modified (${SLOT.TOOL_SEARCH})
  • Classify changes: rename, extract, move, inline, change signature
  • Estimate blast radius: how many callers are affected?

2. Safety Net Setup

  • Verify existing test coverage on affected code
  • If coverage gaps exist: write characterization tests FIRST
  • Ensure all tests pass green before any refactoring begins
  • This is non-negotiable — no safety net, no refactoring

3. Incremental Execution (Mikado Method)

  • Make ONE refactoring move at a time
  • Run tests after each move
  • If tests fail: revert and investigate before proceeding
  • Never batch multiple refactoring moves between test runs
  • Commit or checkpoint after each green test run

4. Interface Migration (Strangler Fig Pattern)

When changing a public interface:

  1. Add the new interface alongside the old
  2. Migrate callers one at a time
  3. Run tests after each caller migration
  4. Remove the old interface only after all callers are migrated
  5. Run tests one final time

Anti-Patterns

  • Never rename AND restructure in the same step
  • Never modify a file that an active subagent is reading
  • Never change function signatures without searching for all call sites first
  • Never skip the safety net — if there are no tests, write them before refactoring
  • Never refactor more than 3 files without running tests

Output Format

Before starting, present:

  • Refactoring plan: Ordered list of individual moves
  • Blast radius: Files and functions affected
  • Safety net status: Test coverage of affected code (green/yellow/red)
  • Risk assessment: What could break and how you'll detect it

After completing, report:

  • Moves executed: List of refactoring steps taken
  • Tests run: Pass/fail at each checkpoint
  • Remaining debt: Any follow-up refactoring deferred

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.