agentleFS
tirth8205tirth8205/code-review-graph/skills/refactor-safely/SKILL.md

refactor-safely

Skill32k starsChanged 6 months agoMITView on GitHub

Plan and execute safe refactoring using dependency analysis

6 other projects use a version of this, 2 of them edited; 2 of 2 edited versions we compared changed its rules.

How people change it

2 of 2 edited versions changed its rules, and some changes recur.

Of the 2 edited versions we compared: 2 made changes of their own.

Rules people drop

  1. Call refactor_tool with mode="suggest" for refactoring candidates, or mode="dead_code" for unreferenced code.dropped by 2 of 2
  2. Call apply_refactor_tool with the returned refactor_id to apply the rename.dropped by 2 of 2
  3. Before a large refactor, call get_impact_radius_tool and get_affected_flows_tool to see the dependents and critical paths involved.dropped by 2 of 2
  4. Call find_large_functions_tool to find functions worth splitting.dropped by 2 of 2
  5. After the change, call detect_changes_tool to confirm the impact matches the plan.dropped by 2 of 2
  6. Prefer a targeted query_graph_tool call over a broad listing call.dropped by 2 of 2
  7. Call get_minimal_context_tool(task="<your task>") before any other graph tool.dropped by 1 of 2
  8. Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.dropped by 1 of 2

Rules people add

  1. Use the knowledge graph to plan and execute refactoring with confidence.added by 2 of 2
  2. Use refactor_tool with mode="suggest" for community-driven refactoring suggestions.added by 2 of 2
  3. Use refactor_tool with mode="dead_code" to find unreferenced code.added by 2 of 2
  4. Use apply_refactor_tool with the refactor_id to apply renames.added by 2 of 2
  5. After changes, run detect_changes_tool to verify the refactoring impact.added by 2 of 2
  6. Always preview before applying (rename mode gives you an edit list).added by 2 of 2
  7. Check get_impact_radius_tool before major refactors.added by 2 of 2
  8. Use get_affected_flows_tool to ensure no critical paths are broken.added by 2 of 2

We split this file and each edited version into the rules they give an agent and match them by wording. A version that adds no rule of its own and has not changed since this file last did reads as an older text, so what it lacks is not counted as dropped. We keep no past texts of a file, so that is inferred, and an edited version that started from an older text still counts its gaps as drops.

Adopted by

Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data

Week of Sep 27: 0 new projectsWeek of Oct 4: 0 new projectsWeek of Oct 11: 0 new projectsWeek of Oct 18: 0 new projectsWeek of Oct 25: 0 new projectsWeek of Nov 1: 0 new projectsWeek of Nov 8: 0 new projectsWeek of Nov 15: 0 new projects
Sep 2026Oct 2026Nov 2026
New projects taking a version of this file each week, over the 8 weeks our latest run read: only 0 in all, so this is a hint, not a trend.

Most recently taken up by

Who's talking about tirth8205/code-review-graph

The biggest 5 of 72 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 72

Talked about on GitHub, Bluesky and Hacker News (72 times).

On GitHub · 50

45 more on GitHub

On Bluesky · 20

15 more on Bluesky

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 1 is distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 7

    Very specific

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

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

    Call refactor_tool with mode="suggest" for refactoring candidates, or mode="dead_code" for unreferenced code.

    line 12
  2. Very specific:

    Call apply_refactor_tool with the returned refactor_id to apply the rename.

    line 14
  3. Very specific:

    Before a large refactor, call get_impact_radius_tool and get_affected_flows_tool to see the dependents and critical paths involved.

    line 15
  4. Very specific:

    Call find_large_functions_tool to find functions worth splitting.

    line 16
  5. Very specific:

    After the change, call detect_changes_tool to confirm the impact matches the plan.

    line 17
  6. Very specific:

    Call get_minimal_context_tool(task="<your task>") before any other graph tool.

    line 20
  7. Very specific:

    Prefer a targeted query_graph_tool call over a broad listing call.

    line 22
  8. Distinctive:

    Read the implementation and its tests before changing code.

    line 24

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

Refactor Safely

Plan a refactor from the dependency graph and apply renames from a preview.

Steps

  1. Call refactor_tool with mode="suggest" for refactoring candidates, or mode="dead_code" for unreferenced code.
  2. For a rename, call refactor_tool with mode="rename", old_name and new_name. Check the returned edit list before applying.
  3. Call apply_refactor_tool with the returned refactor_id to apply the rename.
  4. Before a large refactor, call get_impact_radius_tool and get_affected_flows_tool to see the dependents and critical paths involved.
  5. Call find_large_functions_tool to find functions worth splitting.
  6. After the change, call detect_changes_tool to confirm the impact matches the plan.

Token Efficiency Rules

  • Call get_minimal_context_tool(task="<your task>") before any other graph tool.
  • Pass detail_level="minimal" wherever a tool accepts it. Use "standard" only when minimal is not enough.
  • Prefer a targeted query_graph_tool call over a broad listing call.
  • Budget: about five tool calls and 800 tokens of graph output per task.
  • Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.

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.