refactor
Skill1 starsChanged 4 days agoMITView on GitHub
Restructure, simplify and de-bloat an existing codebase without changing what it does - pin today's behavior, then delete, merge, simplify and reshape one proven step per commit. Use when asked to refactor, clean up, simplify, de-bloat or restructure code, remove dead code or duplication, split a file or module that grew too big, replace an old system, or fix what a review or audit found.
195 other projects use a version of this.
Adopted by
Most recently taken up by
- GoBeromsu/craft-skillstheir own version, first seen Nov 16, 2026
- erikperttu/steering-coding-agentstheir own version, first seen Nov 16, 2026
- chuckplayer/claude-agent-packtheir own version, first seen Nov 16, 2026
- Archont561/skillstheir own version, first seen Nov 15, 2026
- nazmirket/skillstheir own version, first seen Nov 15, 2026
- qivora-labs/agentinittheir own version, first seen Nov 15, 2026
Used with
Projects with it also use ascii-diagram, debug-fix and 10 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.
SethGammonSkillascii-diagram
Generate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.
Also in 4 projects that use this
zebbernSkilldebug-fix
Find and fix a bug or issue — from any source (GitHub issue, error message, user report, or observed behavior)
Also in 4 projects that use this
parcadeiSkillagent-context-isolation
Agent Context Isolation
Also in 3 projects that use this
parcadeiSkillagentica-infrastructure
Reference guide for Agentica multi-agent infrastructure APIs
Also in 3 projects that use this
- +8 more from parcadei
Other versions195 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 195
- github/awesome-copilot★ 41ksame name
- unkeyed/unkey★ 5.5ksame name
- parcadei/Continuous-Claude★ 3.9ksame name
- parcadei/Continuous-Claude-v2★ 3.9ksame name
- parcadei/Continuous-Claude-v3★ 3.9ksame name
- adobe/S3Mock★ 1.2ksame name
- SethGammon/Citadel★ 927same name
- poshan0126/dotclaude★ 871same name
- JordanCoin/codemap★ 715same name
- membrane/api-gateway★ 658same name
185 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 repository20 other files it gives its agents.
- AGENTS.mdAGENTS.md
- agents-mdSkill
- app-iconSkill
- buildSkill
- cloneSkill
- debugSkill
- design-systemSkill
- docker-optimizeSkill
- improve-loopSkill
- mac-appSkill
- mac-designSkill
- product-briefSkill
- quality-barSkill
- researchSkill
- reviewSkill
- start-hereSkill
- stop-overthinkingSkill
- ui-directorSkill
- user-storiesSkill
- ux-designSkill
The file
We split this skill into the rules it gives an agent
9 rules. 0 are common, 6 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 170 edited versions we read keep these.
6
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 15
Start from findings, not taste: a review audit, or run one.
- Distinctive: line 16
Before removing or reshaping anything, learn why it exists: its callers, what it calls, its edge cases, its tests, and its history (git log …
- Distinctive: line 21
Write a short plan: each change, why it helps, how you will prove it, in the order below.
- Distinctive: line 27
Before the first edit, make sure a change in behavior would show up:
- Distinctive: line 29
Run the existing tests and record the result.
- Very specific: line 35
Check the net works: break one pinned line for a moment and see a test fail (build).
- Distinctive: line 71
Don't merge two simple functions into one complicated one, or inline a name that explained something.
- Very specific: line 73
Follow the codebase's conventions, and the rules in build.
- Distinctive: line 87
Every step is its own green commit, with nothing removed that something still used.
“Common” is measured: kept by at least 6 in 10 of the 170 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
The outcome: the same product, with less code, fewer concepts and one clear place for each thing, and proof at every step that nothing a user or caller relies on changed. Agents fail this two ways: they rewrite large parts at once and quietly change behavior, or they move code around and call it cleaner. Smaller and clearer, with the same results, is the only win.
1. Know what you are changing
- Start from findings, not taste: a
reviewaudit, or run one. - Before removing or reshaping anything, learn why it exists: its callers, what it calls, its
edge cases, its tests, and its history (
git log -p, blame). Code that looks odd is often a fix for a bug you haven't met. If you can't say why it is there, read more. - The deletion test for each module: if it disappeared, would its complexity spread to every caller (it earns its place) or barely move (it is a pass-through, merge it away)?
- Write a short plan: each change, why it helps, how you will prove it, in the order below. For anything beyond a small cleanup, show the plan and let the user pick before you start. "This code is fine" is a valid result.
2. Pin today's behavior first
Before the first edit, make sure a change in behavior would show up:
- Run the existing tests and record the result. Fix nothing yet.
- Where risky code has no test, add tests that pin what it does now, at the interface callers use: outputs, errors, side effects, ordering. Golden files or snapshots work for output, screenshots for UI, a timing baseline where speed matters.
- These tests describe the current behavior, odd parts included. A suspected bug is written
down and fixed separately with
debug, never inside a refactor. - Check the net works: break one pinned line for a moment and see a test fail (
build).
3. Work in this order
Each one makes the next easier and safer:
- Delete what is dead. Unused files, exports, functions, flags, dependencies, config,
commented-out code. Confirm first with
review's unused-code search, plus public APIs and anything other repos or users may call. Then delete it, and let the build and tests confirm. - Merge duplicates. Pick the best version, cover it with the cases of both, move every caller to it, then delete the others.
- Simplify in place. Flatten nesting, name what a reader has to decode, remove wrappers that only forward, abstractions with one user, options nobody sets, and comments that repeat the code. Keep the helpers that give a concept a name.
- Reshape modules last. Split a module that does unrelated jobs, merge shallow layers into one deeper module with a small interface, move logic to the layer that owns it. Propose a new shape only with a clear win: fewer places to touch for a feature, simpler tests.
4. One proven step at a time
- One change per commit, behavior unchanged, the build and every test green after each. No features or fixes mixed in.
- Big moves go new-beside-old: build the new piece, move callers over a few at a time, then delete the old one. Never leave two systems running longer than the change needs.
- Mechanical changes across many files (renames, moved imports) use the language's tools or a codemod, not hand edits, and are their own commit.
- Replace tests rather than stacking them: once tests at the new interface cover the old shallow ones, delete the old ones.
- A step that grows past what you can verify at once gets split. A step whose tests fail is reverted, not patched until green.
5. Keep the balance
- Fewer lines is not the goal; faster understanding is. Revert a "simplification" that is harder to read than what it replaced.
- Don't merge two simple functions into one complicated one, or inline a name that explained something.
- Follow the codebase's conventions, and the rules in
build. A refactor that imposes a new style is churn. - Validation, error handling, security, accessibility and edge cases survive every move.
6. Prove the result
Report before and after, with the commands that measured them: lines, files, modules and
dependencies removed; the same test results (and outputs, screenshots or timings where you
pinned them); the duplicates and dead code gone, cited by file:line. Update ARCHITECTURE.md
or AGENTS.md where the structure they describe changed. Then run review on the whole change.
Done when
- Behavior was pinned before the first edit, and the same checks pass after the last one.
- Every step is its own green commit, with nothing removed that something still used.
- The code is measurably smaller or simpler, and the report shows the numbers and names what was not checked.
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.

