refactor-code
Skill0 starsChanged 3 months agoApache-2.0View on GitHub
Implement an agreed structural code change while preserving observable behavior. Use when extraction, consolidation, or responsibility moves must keep existing behavior equivalent. Do not use for an unresolved interface decision alone, bug correction, new feature behavior, or a staged compatibility transition.
9 other projects use a version of this.
Adopted by
Most recently taken up by
- BrOrlandi/my-claude-skillstheir own version, first seen Sep 22, 2026
- r2rka1/skillstheir own version, first seen Aug 18, 2026
- emaraschio/cursor-commandstheir own version, first seen Aug 7, 2026
- igmarin/rails-agent-skillstheir own version, first seen Jul 30, 2026
- chrisetheridge/skillstheir own version, first seen May 11, 2026
- drafael/coding-harnesstheir own version, first seen Apr 28, 2026
Used with
Projects with it also use optimize-performance.
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.
gologo13Skilloptimize-performance
Analyze the current code for performance bottlenecks and provide optimization recommendation...; keywords: api, performance. Use only on explicit request; skip in routine implementation discussions.
Also in 3 projects that use this
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 9
- igmarin/rails-agent-skills★ 27same name
- BrOrlandi/my-claude-skills★ 21same name
- zbruhnke/claude-code-starter★ 17same name
- emaraschio/cursor-commands★ 9same name
- chrisetheridge/skills★ 4same name
- adolfoaranaes12/BMAD-ENHANCED★ 2same name
- r2rka1/skills★ 2same name
- drafael/coding-harness★ 1same name
- gologo13/agent-skills★ 0same name
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 repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- build-prototypeSkill
- challenge-planSkill
- design-interfaceSkill
- evaluate-skillSkill
- fix-bugSkill
- implement-test-firstSkill
- improve-skillSkill
- investigate-bugSkill
- map-decisionsSkill
- migrate-systemSkill
- model-domainSkill
- reframe-explanationSkill
- review-requirementsSkill
- split-workSkill
- synthesize-evidenceSkill
- write-agent-guidanceSkill
- write-commit-messageSkill
- write-skillSkill
- write-specSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
1
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 34
Stop when the requested structure exists and the relevant before/after behavior agrees.
“Common” is measured: kept by at least 6 in 10 of the 9 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 Code
Change the requested structure with evidence that its callers still observe the same behavior.
- Define equivalence at the affected boundary: results and identity, side effects, ordering, errors, resource lifetime, and compatibility where the change touches them. Existing quirks remain behavior unless their correction is also in scope; an apparently cleaner result can still be a regression.
- Establish that boundary's behavior before changing its implementation. Reuse meaningful coverage; add characterization only where an exposed risk lacks proof. A pre-existing failure or unavailable check limits the baseline: record it, preserve the evidence, and use an independent observation where possible. A green run only after editing cannot establish before/after equivalence.
- Move the chosen responsibility while keeping callers' obligations intact. Preserve ordering and failure paths through extractions, including work that must not occur after failure. Keep useful behavior tests tied to the public boundary; replace an implementation-coupled assertion only with evidence that its behavior remains covered. Split genuinely independent moves when each can be verified; keep a coupled edit together when intermediate states cannot work.
- Repeat the same behavioral observations after the move, and verify the chosen structural boundary is now real rather than an unused wrapper. Treat a changed observation as a discrepancy to explain, not a reason to update expectations. Report the affected guarantees and any equivalence that remains unproved.
Stop when the requested structure exists and the relevant before/after behavior agrees. An unresolved contract choice can compose with interface design; an independently requested correction or feature remains a separate behavior change. Small cleanup inside an already green test-first slice does not require another Skill. This Skill owns preservation across structural change, not test-first sequencing, diagnosis, or mixed-version rollout.
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.

