refactoring
Skill0 starsChanged 46 days agoMITView on GitHub
Restructuring existing code without changing behavior — extract, rename, replace conditionals, untangle a module. The REFACTOR phase.
61 other projects use a version of this.
Adopted by
Most recently taken up by
- travissmithv1/claude-skillstheir own version, first seen Nov 16, 2026
- RMATI-11861/Claude-Skillstheir own version, first seen Nov 16, 2026
- lengrufeng2008/dsh-skill-librarytheir own version, first seen Nov 15, 2026
- scolladon/crafttheir own version, first seen Nov 15, 2026
- Vasallo94/obsidian-mcp-servertheir own version, first seen Nov 15, 2026
- ishandutta2007/Awesome-Claude-Skillstheir own version, first seen Nov 8, 2026
Used with
Projects with it also use ci-cd, dependency-management 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.
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 5 projects that use this
dkprogSkilldependency-management
Apply when wiring dependencies, integrating external services, or designing interfaces between modules. Ensures loose coupling through dependency injection, interface segregation, and proper abstraction boundaries.
Also in 3 projects that use this
javalenciacaiSkillmulti-agent-orchestration
Design and coordinate multi-agent systems where specialized agents work together to solve complex problems. Covers agent communication, task delegation, workflow orchestration, and result aggregation. Use when building coordinated agent teams, complex workflows, or systems requiring specialized expertise across domains.
Also in 3 projects that use this
harrissohail6Skilldatabase-design
Database schema design and SQL best practices. Use when designing tables, writing queries, or optimizing database performance.
Also in 5 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 7 projects that use this
klauswgSkillperformance
Optimize web performance for faster loading and better user experience. Use when asked to "speed up my site", "optimize performance", "reduce load time", "fix slow loading", "improve page speed", or "performance audit".
Also in 7 projects that use this
Other versions61 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 61
- handsontable/handsontable★ 22ksame name
- ciembor/agent-rules-books★ 2.8ksame name
- hitobito/hitobito★ 485same name
- databrickslabs/ontobricks★ 474same name
- DevelopersGlobal/ai-agent-skills★ 216same name
- REPOZY/superpowers-optimized★ 146same name
- extra-org/extra★ 120same name
- tmcfarlane/team-avatar★ 113same name
- larchanka/skills★ 50same name
- nimadorostkar/Claude-Skills-collection★ 37same name
51 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 repository29 other files it gives its agents.
- hosts/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- adrSkill
- api-designSkill
- auditSkill
- code-reviewSkill
- concurrency-performanceSkill
- coverageSkill
- debuggingSkill
- debugSkill
- fast-laneSkill
- fixSkill
- implementSkill
- intakeSkill
- leanSkill
- migration-safetySkill
- nonnaSkill
- observabilitySkill
- planSkill
- releaseSkill
- reviewSkill
- rollbackSkill
- security-reviewSkill
- shipSkill
- supply-chainSkill
- syncSkill
- tddSkill
- tdd-workflowSkill
- testSkill
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 55 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 54
Speculative generality: Don't add layers, hooks, or abstraction for a future that may never arrive.
“Common” is measured: kept by at least 6 in 10 of the 55 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
Refactoring
Refactoring is changing the shape of code while its behavior stays identical. If behavior changes, it is not a refactor — it is a feature or a fix, and it belongs in its own commit.
The prime directive
Tests stay green and unchanged throughout. The test suite is the proof that behavior held. From the first step to the last, every test that passed before passes after — and you did not edit the tests to make that true. If a refactor forces a test change, one of two things is happening: the test was coupled to internals (fix the test first, in a separate commit), or you are actually changing behavior (stop — that's a different task).
Never mix a refactor with a behavior change in the same commit. A reviewer must be able to trust that a "refactor" commit cannot have altered what the program does. Mixing the two destroys that guarantee and makes the change un-reviewable and un-revertible.
Tests-green as the safety net
You can only refactor safely under coverage. The suite is what lets you move fast — make a change, run tests, and know in seconds whether you broke something. No suite, no net, no speed.
Work in small, reversible steps. Extract one function, run tests, commit. Rename one symbol, run tests, commit. If a step goes red, you revert one small step, not an afternoon. Big-bang rewrites skip the net and accumulate undiagnosable breakage.
"For each desired change, make the change easy (warning: this may be hard), then make the easy change." — Kent Beck
Often the feature you want is awkward because the current structure resists it. Refactor first to make room — as its own green-tested commit — then add the behavior in the next commit. Two clean steps beat one tangled one.
Catalog of common refactors
The everyday moves are mechanical and local: extract function, rename for intent, replace a magic value with a named constant, introduce a parameter object, replace a conditional with a lookup or polymorphism, and guard-clause early returns. Each does one thing, keeps behavior identical, and produces a diff small enough to hold in your head — so do one at a time. The full table (when to reach for each, what it buys) with worked before/after examples lives in references/catalog.md.
When NOT to refactor
- No test coverage yet. Refactoring blind is editing and hoping. Add characterization tests first — tests that pin current behavior as-is (even if it's quirky) — then refactor under them.
- On a hot deadline / incident path. Ship the fix; refactor in a follow-up. Structure work and urgent work compete for the same attention and one will be done badly.
- Speculative generality. Don't add layers, hooks, or abstraction for a future that may never arrive. Refactor toward the code you have, not the code you imagine. The simplest structure that fits today's behavior is the goal.
A refactor that leaves the suite green, the diff small, and the next change easier has done its job.
See .claude/rules/engineering.md; the loop's REFACTOR phase is where this lives.
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.

