refactor
Skill1 starsChanged 5 days agoMITView on GitHub
Safe, behavior-preserving code refactoring for any language. Detects smells (Bloat, OO, Couplers, Layers), applies Fowler & MVVM/Clean Architecture patterns, and runs tests per step. Triggers: refactor, clean up, extract, rename, simplify, decompose, god class, MVVM, Clean Architecture. Only invoke via the orcinus router.
196 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- Doist/todoist-aitheir own version, first seen Nov 9, 2026
- Doist/todoist-clitheir own version, first seen Nov 8, 2026
- rvdbreemen/OTGW-firmwaretheir own version, first seen Nov 8, 2026
- paulocsb/worldcup-fifa-pooltheir own version, first seen Nov 8, 2026
- taixuann/development-spacetheir own version, first seen Nov 8, 2026
- command-center-ai/skillstheir own version, first seen Nov 8, 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 versions196 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- MuhiminOsim/code-refactoring-skill★ 999% same
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★ 710same 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 repository35 other files it gives its agents.
- accessibilitySkill
- api-and-interface-designSkill
- architectureSkill
- ask-questions-if-underspecifiedSkill
- breaking-changeSkill
- buildSkill
- codebase-knowledge-builderSkill
- database-designerSkill
- diagnosing-bugsSkill
- finalizeSkill
- frontend-architectureSkill
- frontend-data-contractsSkill
- frontend-optimistic-mutationsSkill
- handoffSkill
- i18nSkill
- idea-calibrateSkill
- idea-captureSkill
- incomplete-refactorSkill
- independent-reviewSkill
- issue-triageSkill
- mcp-builderSkill
- monitoring-observabilitySkill
- monitoringSkill
- mutation-testing-pythonSkill
- mutation-testingSkill
- orcinusSkill
- orcinus-verifySkill
- performance-optimizationSkill
- registry-publishSkill
- scaffoldSkill
- security-reviewSkill
- skill-creatorSkill
- visual-regressionSkill
- wazaSkill
- webapp-testingSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. 0 are common, 12 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 169 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 17
Behavior is preserved: Every change leaves the program doing exactly the same thing externally.
- Distinctive: line 18
One operation at a time: No bundling multiple logical changes into one step.
- Distinctive: line 19
Tests gate every step: Run tests after each edit.
- Distinctive: line 79
Read target file(s) completely
- Very specific: line 88
Read safety.md §8 in full
- Very specific: line 98
Never Guess File Paths: Always run search or directory listing tools (like grep_search or list_dir) to confirm the exact location of a file …
- Distinctive: line 101
Use Structured Diffs: Always generate precise before-and-after summaries for edits to ensure the changes are atomic and understandable.
- Distinctive: line 107
Re-Read Before Edit: If you haven't viewed a file in the last 10 minutes, re-read it before making any edits.
- Distinctive: line 109
Commit/Stash Tracking: Check git status frequently to ensure you know exactly what is modified and avoid editing files with unstaged, …
- Distinctive: line 115
Does not change external behavior without user approval
- Distinctive: line 116
Does not fix bugs while refactoring (separate concerns)
- Distinctive: line 117
Does not apply multiple operations in one edit
- Distinctive: line 118
Does not refactor code it hasn't read
- Distinctive: line 119
Does not skip tests "just this once"
“Common” is measured: kept by at least 6 in 10 of the 169 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 Specialist
Safe, incremental, behavior-preserving code improvements for any language.
Core Contract
- Behavior is preserved. Every change leaves the program doing exactly the same thing externally. If a change alters behavior, it is not a refactoring — it is a feature change requiring explicit user opt-in.
- One operation at a time. No bundling multiple logical changes into one step. Each step is independently verifiable and revertable.
- Tests gate every step. Run tests after each edit. If tests fail, revert immediately — do not fix forward.
Quick Reference
[!TIP] Token Efficiency: These reference files are large. Do not read them in full. Use
grep_searchto find your target topic first, then view only its specific line range.
| What you need | Reference file |
| Step-by-step process to follow every time | process.md |
| Detect smells before choosing an operation | smells.md |
| When to stop, warn, or ask | safety.md |
| Extract, Inline, Split, Decompose | catalog-composing.md |
| Conditionals, Guards, Polymorphism | catalog-simplifying.md |
| Move, Organize, Encapsulate | catalog-organizing.md |
| Rename, Parameter Objects, Factory | catalog-api.md |
| Inheritance, Composition over Inheritance | catalog-inheritance.md |
| FP, Async, Reactive, DI patterns | catalog-modern.md |
| MVVM, MVP, Repository, Use Case, Clean Architecture | catalog-architecture.md |
| Language idioms and test commands | language-profiles.md |
Decision Tree
"Just refactor this" / "clean this up" / "this smells" (no specific operation given)
→ Read smells.md. Diagnose. Present ranked findings. Confirm priority with user. Then follow process.md.
Specific operation requested (e.g., "extract this into a function", "rename X to Y")
→ Check safety.md for red lines. If clear, go directly to process.md §4 Execution Loop.
Large file or large codebase (file >500 lines, or change touches >3 files)
→ Read safety.md §6 Large Codebase Protocol before anything else.
Architectural scope (user mentions pattern names, layer problems, or any trigger below marked [arch])
→ Read smells.md Family 6. Map current architecture (Grep import statements, identify layers). Present architecture map. Ask: "What target pattern?" Confirm with user. Then read safety.md §8 in full before touching anything. Use operations from catalog-architecture.md.
Language you haven't seen before in this session
→ Check language-profiles.md. If language not listed, ask user: "What command runs your tests?" Then proceed.
Something feels risky (public API, serialization, concurrency, no tests)
→ Read safety.md §3 Red Lines before touching anything. Stop and ask if any red line applies.
Trigger Words
Code-level: refactor, clean up, clean this up, extract, rename, simplify, decompose, restructure, improve readability, reduce complexity, remove duplication, pull this out, break this apart, this is too long, hard to understand, technical debt, code smell, too many parameters, god class, big function, make this cleaner, this needs work, tidy up, reorganize, modernize
Architectural [arch]: MVVM, MVP, MVC, Clean Architecture, Hexagonal, layering, too much in the controller, fat controller, view has logic, business logic in the UI, anemic model, fat service, separation of concerns, introduce repository, add a use case, extract interactor, layer violation, presentation importing data, domain importing service, architecture, restructure layers, move to domain
Refactoring in 30 Seconds
For experienced users who just want the loop:
Code-level:
- Read target file(s) completely
- Detect smells → present ranked list
- Confirm operation order with user
- For each step: state op → show diff → apply → run tests → confirm or revert
- Summarize changes; suggest (but don't apply) follow-ons
Architectural:
- Map current architecture (Grep imports, identify layers) → present map
- Confirm target pattern with user
- Read
safety.md§8 in full - Detect Family 6 smells → present ranked findings
- For each violation: Introduce → Redirect → Remove (one class per step, tests after each)
- Summarize; suggest follow-ons
Full detail: process.md | Architecture operations: catalog-architecture.md
Agentic Context & Tool Mastery
To make this skill highly effective when executed by an autonomous AI agent, adhere to the following tool usage patterns:
- Never Guess File Paths: Always run search or directory listing tools (like
grep_searchorlist_dir) to confirm the exact location of a file before attempting to read or edit it. - Prioritize Targeted Searches: For large codebases, use
grep_searchto map class names, function calls, and import statements instead of reading entire directories. Reading is expensive; scanning is efficient. - Validate Edits Syntactically: Immediately after applying any replacement/edit, run a dry-run linter or compilation check (e.g.
tsc --noEmit,cargo check, or syntax checks) BEFORE running the full test suite. - Use Structured Diffs: Always generate precise before-and-after summaries for edits to ensure the changes are atomic and understandable.
- Token-Sparing File Views: When referencing heavy catalog files (like
catalog-api.md) or smell catalogs (smells.md), do not load the entire file. Use targeted grep searches first to locate the line numbers of the specific smell or refactoring operation you need, and then view only those specific line ranges (e.g.,StartLinetoEndLine). This saves significant token context.
Context Preservation Protocol
In long refactoring sessions, AI agents can lose context or suffer from drift. You MUST:
- Re-Read Before Edit: If you haven't viewed a file in the last 10 minutes, re-read it before making any edits. Code in active development may have been modified externally.
- State Current State: At the beginning of each turn in a multi-step refactoring, explicitly state the current active step and its objective (e.g. "We are currently on Step 2 of 4: Extracting
applyTaxes"). - Commit/Stash Tracking: Check
git statusfrequently to ensure you know exactly what is modified and avoid editing files with unstaged, unrelated changes.
What This Skill Does NOT Do
- Does not change external behavior without user approval
- Does not fix bugs while refactoring (separate concerns)
- Does not apply multiple operations in one edit
- Does not refactor code it hasn't read
- Does not skip tests "just this once"
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.

