refactor
Skill9 starsChanged 9 days agoMITView on GitHub
Restructure existing code to improve maintainability while preserving observable behavior and compatibility. Use for behavior-preserving cleanup of design, duplication, coupling, or complexity; do not use primarily to fix defects, add features, or claim performance optimization.
195 other projects use a version of this.
Adopted by
Most recently taken up by
- chrisallenlane/claude-swe-workflowstheir own version, first seen Nov 29, 2026
- AnthonyDelaCruz/agent-setuptheir own version, first seen Nov 29, 2026
- Tomas542/lightning_hydra_templatetheir own version, first seen Nov 29, 2026
- alfa-reza/skillstheir own version, first seen Nov 29, 2026
- discountry/ritmex-skillstheir own version, first seen Nov 29, 2026
- nexus-a1/claude-skillstheir own version, first seen Nov 29, 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
jidechaoSkillmodern-go
Modernize Go code by applying version-appropriate idioms and APIs (gofix-style transformations). Scans go.mod for the Go version, then transforms Go source files to use modern patterns—from Go 1.0 through 1.26+. Use when the user says "现代化","现代Go语言", "地道的", "idiomatic", "modernize", "modern-go", "update Go code", "gofix", or wants to upgrade Go idioms.
Also in 3 projects that use this
SethGammonSkillresearch-fleet
Parallel research using Fleet wave mechanics. Spawns multiple scout agents, each investigating a different angle of the same question. Findings are compressed between waves. Produces a unified research brief from multiple independent perspectives.
Also in 3 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
- +6 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★ 42ksame 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★ 661same 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 repository9 other files it gives its agents.
- api-designSkill
- code-reviewSkill
- commitsSkill
- debugSkill
- deployment-readinessSkill
- docsSkill
- security-reviewSkill
- sqlSkill
- testingSkill
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 6 are distinctive, and 0 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.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when the requested outcome is clearer structure, lower unnecessary coupling, higher cohesion, reduced duplication or …
- Distinctive: line 16
Do not activate it when the primary outcome is a bug fix, new functionality, dependency upgrade, style-only rewrite, or performance …
- Distinctive: line 32
Run the most relevant available checks, progressing from focused tests to broader suites, build, static analysis, integration checks, or …
- Distinctive: line 43
Versions and consumers: Check supported runtimes, protocols, extensions, and downstream callers.
- Distinctive: line 54
Do not alter public contracts silently, remove tests, or accept failing checks as proof of preservation.
- Distinctive: line 55
Do not claim performance improvement without representative measurement, or behavioral equivalence from compilation alone.
“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
Refactoring
Outcome
Improve a demonstrated maintenance problem through small, reversible changes while preserving observable behavior, public contracts, and compatibility with existing consumers. Prefer the simplest design improvement supported by repository evidence.
Use and non-use
Use this skill when the requested outcome is clearer structure, lower unnecessary coupling, higher cohesion, reduced duplication or complexity, or improved testability without intentionally changing behavior.
Do not activate it when the primary outcome is a bug fix, new functionality, dependency upgrade, style-only rewrite, or performance optimization. Separate those concerns when they coexist, and do not disguise behavior changes as refactoring.
Required evidence
Identify the maintenance problem, requested scope, affected code, current tests, known consumers, and repository conventions. Treat a design principle or personal preference as a possible lens, not evidence of a defect. If existing behavior or compatibility obligations cannot be characterized well enough for the risk, inspect further or add focused characterization tests before changing the code.
Workflow
- State the concrete maintenance problem and why it matters. Distinguish excessive responsibility, coupling, duplication, low cohesion, complex flow, poor naming, or hard-to-test boundaries from harmless stylistic differences.
- Inspect the current implementation, call sites, tests, documentation, configuration, data formats, and relevant change history. Record the baseline repository state and preserve unrelated work.
- Map contracts and dependencies across the proposed boundary, including public and internal consumers, external services, generated code, plugins, and versioned interfaces.
- Define observable invariants before editing: accepted inputs, outputs, ordering, errors, state transitions, side effects, compatibility, and resource or concurrency semantics relevant to the change.
- Assess risk and validation strength. Consider reach, contract visibility, legacy behavior, test coverage, stateful data, concurrency, rollback difficulty, and the cost of failure. Do not treat successful compilation as behavioral equivalence.
- Select a proportional strategy. Prefer a local rename, extraction, movement, simplification, or deduplication when it solves the demonstrated problem. Use responsibility separation, new abstractions, or architectural boundaries only when evidence justifies their additional complexity.
- Establish a safety net with existing tests or focused characterization and regression tests. Characterization tests should capture important current behavior without declaring every accidental implementation detail permanent.
- Apply one coherent, reversible change at a time. Keep diffs narrow, preserve interfaces where possible, and re-check affected call sites after each meaningful step. Avoid opportunistic cleanup outside the requested scope.
- Run the most relevant available checks, progressing from focused tests to broader suites, build, static analysis, integration checks, or compatibility tests as risk warrants. Add specialized validation for persistence, serialization, or concurrency when those contracts are touched.
- Compare the final behavior, contracts, tests, and diff with the baseline. Report what changed structurally, what remained invariant, checks actually executed and their observed results, unresolved risks, and any follow-up that should remain separate.
Behavior and compatibility safeguards
- Public APIs: Preserve names, signatures, defaults, return semantics, ordering, and documented behavior. Treat a required API change as a separate, explicit compatibility decision with migration planning.
- Serialization: Preserve field names, types, nullability, defaults, encodings, and format/version expectations used by readers and writers.
- Persistence: Preserve schemas, keys, constraints, transaction behavior, stored representations, and migration compatibility. Do not rewrite persistent data implicitly.
- Exceptions: Preserve externally observed error categories, timing, propagation, and relied-upon details. Do not broaden catches or suppress failures merely to simplify control flow.
- Concurrency: Preserve atomicity, ordering, synchronization, cancellation, reentrancy, and thread or task safety. Treat changes to shared mutable state or timing as high risk.
- Side effects: Preserve which external actions occur, their order, frequency, idempotency, and failure behavior.
- Versions and consumers: Check supported runtimes, protocols, extensions, and downstream callers; avoid silently requiring a newer dependency or platform.
- Regression evidence: Retain existing tests and add focused coverage for exposed risks. Never delete or weaken a test merely to make validation pass.
Engineering criteria
Favor cohesion, legibility, simplicity, testability, incremental evolution, and reduced unnecessary coupling. Apply single responsibility only when distinct reasons to change or mixed concerns are observable. Do not impose SOLID, Clean Architecture, DDD, patterns, layers, or generic abstractions without showing the concrete problem they solve. Avoid premature abstraction and avoid reporting subjective style preferences as architectural defects.
Limits and uncertainty
- Respect the requested scope; do not expand a local improvement into a broad rewrite without evidence and authorization.
- Preserve unrelated changes and do not update dependencies unless the refactoring demonstrably requires it and the scope permits it.
- Do not alter public contracts silently, remove tests, or accept failing checks as proof of preservation.
- Do not claim performance improvement without representative measurement, or behavioral equivalence from compilation alone.
- For high-risk or weakly characterized code, present safer alternatives, narrow the change to what can be validated, or stop before editing.
- Report checks not run and why. Never fabricate results, and do not commit or push automatically.
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.

