refactor-safely
Skill0 starsChanged 16 days agoMITView on GitHub
Behavior-preserving cleanup — lock behavior with tests, refactor mechanically, re-run the same tests. Use when the user asks to refactor, clean up, simplify, or restructure without changing behavior.
19 other projects use a version of this, 1 of them edited.
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
- yaohuangguan/agent-playbooktheir own version, first seen Nov 1, 2026
- rpraharaj/ai-engineeredited, first seen Nov 1, 2026
Used with
Projects with it also use audit-test-suite, change-data-safely and 8 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
- +6 more from yaohuangguan
Other versions19 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- rpraharaj/ai-engineer★ 117% same
Wrote their own version · 18
- 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
8 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 repository66 other files it gives its agents.
- AGENTS.mdAGENTS.md
- a11y-passSkill
- assess-changeSkill
- build-regression-packSkill
- charter-exploratorySkill
- classify-dataSkill
- commitSkill
- cut-releaseSkill
- data-changeSkill
- debugSkill
- design-experimentSkill
- diff-environmentsSkill
- draft-steercoSkill
- engineering-barSkill
- explain-codeSkill
- explore-codebaseSkill
- fix-ciSkill
- handoffSkill
- implement-changeSkill
- incident-triageSkill
- lean-reviewSkill
- map-dependenciesSkill
- map-design-handoffSkill
- map-processSkill
- open-prSkill
- performanceSkill
- plan-data-migrationSkill
- plan-incrementSkill
- plan-rollbackSkill
- plan-uatSkill
- prioritize-backlogSkill
- production-passSkill
- ready-to-mergeSkill
- record-decisionSkill
- revert-changeSkill
- review-architectureSkill
- review-changeSkill
- review-pipelineSkill
- security-passSkill
- shape-workSkill
- ship-notesSkill
- spec-analyticsSkill
- spec-observabilitySkill
- start-projectSkill
- synthesize-discoverySkill
- triage-blockersSkill
- triage-defectSkill
- update-raidSkill
- verify-uiSkill
- write-api-examplesSkill
- write-architectureSkill
- write-designSkill
- write-dev-tasksSkill
- write-docsSkill
- write-integration-contractSkill
- write-nfrSkill
- write-opportunitySkill
- write-prdSkill
- write-requirementsSkill
- write-runbookSkill
- The first 60 shown.
The file
Files
Refactor safely
Change structure, not behavior. If they also want new behavior, stop and send that part to shape-work / implement-change.
Is this the right skill?
| Signal | Do this instead |
| New behavior in the same ask | split — this skill is structure only |
| Tests are red before you start | debug |
| Delete-list only | lean-review first |
Required inputs
- Named unit (files, package, endpoint)
AGENTS.mdTest command
Human decisions (do not invent)
- Mixing a feature into the refactor (do not)
Procedure
- Pin behavior with existing tests. If coverage is too thin, add characterization tests via
write-testsfirst. Run them — that green run is the baseline. If they are red, this isdebug. - List mechanical steps. Climb
engineering-barMinimum path. No new framework, cache, or feature flags. Never delete trust-boundary checks to look smaller. - One cluster of moves, then re-run the same tests. Stay in the named unit plus callers.
- Re-run characterization tests, then repo Test / Lint / Typecheck if known. If a conditional’s meaning changed, revert that part.
Output
- Path: the structural diff
- Template: references/refactor-report.md
Quality bar
- Baseline tests were green before the moves
- Same tests green after
- Diff is structural
- No mixed feature work
Done
Fill the report. Next: ready-to-merge if they want it shipped.
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.

