refactor-safely
Skill0 starsChanged 3 months agoMITView on GitHub
Use when the user wants to clean up, restructure or rename code without changing its behaviour.
19 other projects use a version of this.
Adopted by
Most recently taken up by
- rumotion/ai-agent-project-templatetheir own version, first seen Nov 1, 2026
- yaohuangguan/remote-arctheir own version, first seen Nov 1, 2026
- Remote-Arc/remote-arctheir own version, first seen Nov 1, 2026
- VelimirMueller/claude-skillstheir own version, first seen Nov 1, 2026
- rpraharaj/ai-sdlctheir own version, first seen Nov 1, 2026
- yaohuangguan/agent-playbooktheir own version, first seen Nov 1, 2026
Used with
Projects with it also use audit-test-suite, change-data-safely 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.
yaohuangguanSkillaudit-test-suite
Find where an existing test suite is weak and decide what to test next, ranked by risk. Use this when asked to add missing tests, find gaps, raise coverage, assess test quality or see which areas are thin, even if the request only mentions a coverage percentage.
Also in 3 projects that use this
yaohuangguanSkillchange-data-safely
Change a database schema or stored data without breaking running code or losing data. Use this for any migration, new or changed column, backfill, bulk update, delete, index, or change to a stored format, including in small projects. Data mistakes are often impossible to undo.
Also in 3 projects that use this
SauravSrivastavSkilldebug-failure
Diagnose a failing test, command, or runtime behavior using evidence and produce a minimal verified fix.
Also in 3 projects that use this
NVIDIASkilldebug-issue
Use when the user asks to debug, investigate, or fix a GitHub issue or supplies a repository bug report.
Also in 5 projects that use this
Codagent-AISkillimplement-change
Implements an approved change in one continuous session, with tiered test runs. Use when asked to implement a change from its approved definition, or to invoke codagent:implement-change.
Also in 5 projects that use this
- +6 more from yaohuangguan
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 19
- tirth8205/code-review-graph★ 33ksame name
- techygarg/lattice★ 209same name
- VelimirMueller/ai-development-skills★ 7same name
- VelimirMueller/claude-skills★ 7same name
- Remote-Arc/remote-arc★ 5same name
- yaohuangguan/remote-arc★ 5same name
- Arasz/ai-badger★ 3same name
- hamakyo/okf-skills★ 2same name
- imMamdouhaboammar/get-things-done★ 2same name
- contextosai/skills★ 1same name
9 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- api-docsSkill
- code-reviewSkill
- commit-messageSkill
- debug-loopSkill
- explain-this-fileSkill
- onboarding-mapSkill
- perf-passSkill
- pr-descriptionSkill
- security-passSkill
- sql-reviewSkill
- write-testsSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 7 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 17 edited versions we read keep these.
7
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
- Distinctive: line 14
Run the suite before touching anything and record the result.
- Distinctive: line 16
Run the suite after every move.
- Distinctive: line 17
Update all call sites in the same move.
- Distinctive: line 18
Keep the diff to the target area.
- Distinctive: line 23
No behaviour change and no new feature inside a refactor commit.
- Distinctive: line 24
No formatting sweep across untouched files.
- Distinctive: line 25
If a change turns out to need behaviour edits, stop and say so before continuing.
“Common” is measured: kept by at least 6 in 10 of the 17 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.
Files
Refactor safely
Change the shape of the code. Do not change what it does.
Procedure
- Confirm the goal in one sentence and confirm behaviour must stay identical.
- Find the safety net: existing tests that cover the code. If there are none, write a characterisation test first.
- Run the suite before touching anything and record the result. This is your baseline.
- Make one mechanical move at a time: extract, inline, rename, move, or change signature.
- Run the suite after every move. A red suite means you stop and undo the last move.
- Update all call sites in the same move. Never leave a half renamed symbol.
- Keep the diff to the target area. Unrelated tidying belongs in another commit.
- Finish by rereading the diff for accidental behaviour changes: reordered side effects, changed defaults, dropped error handling.
Rules
- No behaviour change and no new feature inside a refactor commit.
- No formatting sweep across untouched files.
- If a change turns out to need behaviour edits, stop and say so before continuing.
Output format
Goal: <one sentence>
Baseline: <test command and result>
Moves: <numbered list, each with the file touched>
Final: <test command and result>
Behaviour risk: <bullets, or "none identified">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
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.

