refactor
Skill7 starsChanged 9 months agoMITView on GitHub
Code quality analysis and refactoring with validation
195 other projects use a version of this.
Adopted by
Most recently taken up by
- mannobeats/hyper-tastetheir own version, first seen Nov 16, 2026
- 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
Used with
Projects with it also use debug-fix, ascii-diagram 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.
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
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
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★ 660same 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.
The file
We split this skill into the rules it gives an agent
10 rules. 0 are common, 8 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 170 edited versions we read keep these.
8
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 14
No arguments — analyze the entire project
- Very specific: line 20
Read CLAUDE.md and doc/ru/PRD.md for project rules and conventions
- Distinctive: line 25
If tests fail or code doesn't compile — report and stop
- Distinctive: line 107
Ask the user via AskUserQuestion:
- Distinctive: line 114
Read the file, understand context
- Very specific: line 117
If logic is affected — cargo test --workspace
- Distinctive: line 136
Do not create abstractions "for the future" — only when duplication already exists
- Distinctive: line 137
Do not change public API without explicit consent
- Distinctive: line 138
Do not touch files you haven't read
- Distinctive: line 139
Do not expand refactoring beyond the agreed scope
“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
Code quality analysis and incremental refactoring with continuous validation.
Arguments (optional):
- Path or crate:
/refactor crates/app— limit scope - No arguments — analyze the entire project
Process
Phase 1: Exploration
- Read CLAUDE.md and doc/ru/PRD.md for project rules and conventions
- Collect baseline metrics (in parallel):
cargo clippy --workspace --all-targets 2>&1— warnings count- Glob + wc — LOC per crate, files >400 lines
cargo test --workspace 2>&1— baseline: all tests passing?
- If tests fail or code doesn't compile — report and stop
Phase 2: Diagnosis
Analyze code across 8 dimensions. For large scope, use parallel Task agents (subagent_type=Explore) — one per category or group of categories.
Analysis checklist:
Architecture (SOLID)
- Files >400 LOC with multiple public types — splitting candidates
- Modules with >1 responsibility
- Hard dependencies between modules (concrete types instead of traits)
- Open/Closed violations: match on types that will be extended
Legitimate exceptions to "1 file = 1 type": Error+ErrorKind pairs, Builder+Target, small private helpers (<30 LOC), related DTO families (Request/Response), typestate marker types, newtype wrapper collections.
Module coupling / cohesion
- Crate dependency graph: unidirectional? (core ← mid ← app)
- Circular dependencies between modules within a crate
- Excessive
pubAPI — types/functions public without necessity - Crate knows implementation details of another crate (leaky abstraction)
- Changing one module cascades breakage into unrelated modules
Duplication (DRY)
- Repeated code blocks (>5 lines, >2 occurrences)
- Similar match patterns across different files
- Copy-pasted error handling
Dead code
- Unused
use, functions, types, constants - Commented-out code
- Unreachable branches
Performance
- Unnecessary
.clone()/.to_string()/.to_owned()where a reference suffices - O(n²) loops (nested iterations over collections)
- Repeated lookups in HashMap/Vec inside a loop
- Allocations in hot paths
Error boundaries
- Consistent error types at crate boundaries (From / thiserror)
unwrap()/expect()in production code — replace with?or explicit handling- Lost error context (
.map_err(|_| ...)without information) - Panic instead of Result at input boundaries (user, DB, network)
Security
- SQL queries via string concatenation instead of parameterized
- Secrets / tokens hardcoded or logged
- Unvalidated user input (path traversal, XSS)
- Magic numbers and hardcoded config that should be parameters
Style and idioms
- Inconsistent naming
- Missing
#[must_use]on pure functions - Over-abstractions with no usage
- Uncovered edge cases in tests (empty input, errors, overflow)
Phase 3: Report and prioritization
Output to terminal (do not create files):
## Analysis results
| Category | Found | Critical |
|----------------|-------|----------|
| Architecture | N | N |
| Coupling | N | N |
| Duplication | N | N |
| Dead code | N | N |
| Performance | N | N |
| Errors | N | N |
| Security | N | N |
| Style | N | N |
Baseline: X clippy warnings, Y total LOC
### Top issues (by impact)
1. ...
2. ...Ask the user via AskUserQuestion:
- Which categories to fix?
- Budget: quick cleanup / full refactoring?
Phase 4: Execution
For each fix:
- Read the file, understand context
- Make the change (Edit)
cargo check— compiles?- If logic is affected —
cargo test --workspace - Move to next
Order: simple and safe first (dead code, style), then structural.
On compilation/test failure — revert the change and move to next.
Phase 5: Validation
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspaceCompare with baseline: warnings removed, LOC deleted/changed.
Rules
- Do not create abstractions "for the future" — only when duplication already exists
- Do not change public API without explicit consent
- Do not touch files you haven't read
- Do not expand refactoring beyond the agreed scope
- Atomic changes: one fix at a time, verify after each
- Output to terminal, not to report files
- Communicate in the user's language
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.

