/refactor
SkillDev toolsRefactor code using Martin Fowler's patterns. Improves readability, moves behavior closer to data, removes unnecessary abstractions.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the /refactor skill
What this skill tells your AI
The instructions your AI receives, as published by rakovi4/continue-framework in .claude/skills/refactor/SKILL.md and read by ahel’s review.
Scatter–gather: three parallel read-only detectors scan for smells, then a single serial fixer applies refactorings one at a time. Detectors never edit — only the fixer writes, and it re-scans cascades after each change, so the "one refactoring at a time" invariant is preserved.
Usage
/refactor # Analyze current code for smells
/refactor Email # Create Email value object
/refactor UserService # Refactor specific file
Workflow
- Identify the target file (and its tests / siblings). This determines which
file-type checks apply (backend vs
.tsx). - Dispatch the detectors concurrently and await all of them — start every
named agent before awaiting results, then gather every result. No dispatch is
detached or fire-and-forget: step 3 requires the complete result set.
Each runs only its cluster of
.claude/templates/refactoring/scan-checklist.mdand returns a candidate table:refactor-mechanics-agent— cluster M (size, complexity, variables, dead code)refactor-design-agent— cluster D (domain modeling, behavior placement, type safety)refactor-duplication-agent— cluster T (sibling/cross-class duplication, tests, frontend)
- Gather + fix: hand all candidate tables to
.claude/agents/refactor-agent.md(the serial fixer). It merges, dedups, orders highest-impact-first, applies ONE refactoring at a time (loading the template from the Code Smells Routing Table), runs tests, and re-scans cascades inline — repeating until clean.
Small-file shortcut
If the target is small with few methods/concerns, skip the fan-out and run a
single refactor-agent pass over the whole checklist — the detector
orchestration + merge overhead can exceed the single-agent cost on tiny files.
Dispatch that lone pass and await its result. Here the fixer's report is this
skill's entire output, so an unawaited call could report "refactored" before a
file was touched.
Available Templates
Backend (.claude/templates/refactoring/)
scan-checklist.md- Scan hub: detector clusters + output format (links the three below)scan-mechanics.md- Cluster M checks (structural mechanics)scan-design.md- Cluster D checks (design + domain judgment)scan-duplication.md- Cluster T checks (duplication, tests, frontend)code-smells-routing-table.md- Smell → fix → template map (serial fixer)value-object.md- Replace primitive with value objectreplace-string-with-enum.md- Replace string constants with domain enumcomputed-field.md- Remove persisted field, replace with computed methodtest-base-class.md- Extract shared test setupfactory-method.md- Replace constructor with factoryencapsulate-conditional.md- Move conditionals to data classparameterize-helper.md- Add parameters to test helpersinline-test-params.md- Simplify test→statement data flowreplace-map-with-dto.md- Replace Map.of() with typed DTOrest-response-dto.md- Wrap in REST DTO for snake_case conversionmove-to-data.md- Move behavior, serialization, factories to data ownersimplify-expressions.md- Static imports, method references, inline variablesflatten-control-flow.md- Flatten conditionals, Optional patterns, child delegationextract-method.md- Named computations, guards, long method decompositionreplace-comment-with-code.md- Replace narrative comments with intention-revealing codeextract-class.md- Split large class by concern, extract superclass for shared infraadapter-query.md- Extract typed AdapterQuery for Specification/CriteriaQuery logicsubselect-read-model.md- Consolidate multiple repositories into single query with ORM relationships
Frontend (.claude/templates/refactoring/)
extract-component.md- Extract JSX block into field/section componentextract-shared-ui.md- Move reusable component toapp/components/ui/extract-test-fixture.md- Extract MSW response fixtures, stub helpers, assertion helpers
Constraints
- Acceptance tests: Selenium Statements should inject and delegate to backend Statements for shared setup (board setup, task creation) — never reimplement the same API calls.
- Frontend extraction: preserve CSS classes, Tailwind utilities, icon imports, element hierarchy, and ordering exactly. Rendered HTML must be structurally identical after extraction.
Signals
- GitHub stars
- 51
- Forks
- 14
- Last commit
- Sep 2026
- Hacker News mentions
- 20
Advanced
- Catalog kind
- skill
- Gateway key
refactor-rakovi4- Source
- github.com/rakovi4/continue-framework