refactoring
Skill0 starsChanged 2 months agoMITView on GitHub
Restructuring existing code without changing behavior — extract, rename, replace conditionals, untangle a module. The REFACTOR phase.
39 other projects use a version of this.
Adopted by
Most recently taken up by
- jablonkai/skillstheir own version, first seen Oct 1, 2026
- fabiandistler/agentstheir own version, first seen Sep 30, 2026
- wormeyman/wormeyman-skillstheir own version, first seen Sep 25, 2026
- dan-the-dev/xp-developer-skillstheir own version, first seen Sep 23, 2026
- syanga/astacktheir own version, first seen Sep 20, 2026
- nafeeur/MaskShifttheir own version, first seen Sep 12, 2026
Used with
Projects with it also use performance, ci-cd 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.
pluginagentmarketplaceSkillperformance
Optimize application performance through caching strategies, load balancing, database scaling, and monitoring. Build systems handling thousands of concurrent users.
Also in 7 projects that use this
JohnJBorenSkillci-cd
CI/CD pipeline design, GitHub Actions, testing automation, and deployment strategies
Also in 4 projects that use this
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 6 projects that use this
CloudAI-XSkilldatabase-design
Designs database schemas, indexing strategies, query optimization, and migration patterns for SQL and NoSQL databases. Use when designing tables, optimizing queries, fixing N+1 problems, planning migrations, or when asked about database performance, normalization, ORMs, or data modeling.
Also in 5 projects that use this
AnthropicSkilldocumentation
Write and maintain technical documentation. Trigger with "write docs for", "document this", "create a README", "write a runbook", "onboarding guide", or when the user needs help with any form of technical writing — API docs, architecture docs, or operational runbooks.
Also in 8 projects that use this
AnthropicSkillincident-response
Run an incident response workflow — triage, communicate, and write postmortem. Trigger with "we have an incident", "production is down", an alert that needs severity assessment, a status update mid-incident, or when writing a blameless postmortem after resolution.
Also in 5 projects that use this
- +1 more from anthropics
Other versions39 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 39
- ciembor/agent-rules-books★ 2.9ksame name
- databrickslabs/ontobricks★ 393same name
- extra-org/extra★ 113same name
- 312362115/claude★ 107same name
- DevelopersGlobal/ai-agent-skills★ 69same name
- andreaswasita/copilot-agents-dojo★ 54same name
- dan-the-dev/xp-developer-skills★ 30same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- krzysztofsurdy/code-virtuoso★ 22same name
- s-hiraoku/synapse-a2a★ 16same name
29 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 34 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 34 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.

