From devflow
Use when restructuring code without changing behavior — safe patterns, test preservation, incremental steps
npx claudepluginhub nexuz-sys/devflow --plugin devflowThis skill uses the workspace's default tool permissions.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Executes pre-written implementation plans: critically reviews, follows bite-sized steps exactly, runs verifications, tracks progress with checkpoints, uses git worktrees, stops on blockers.
Safe, incremental code restructuring that preserves behavior and maintains all tests.
Announce at start: "I'm using the devflow:refactoring skill."
Before: 50-line function with 3 responsibilities
After: 3 focused functions, each 15-20 lines
When: Function does more than one thing
Before: 500-line file with multiple concerns
After: 3 files, each with one responsibility
When: File has multiple independent sections
Before: x, temp, data, handleClick
After: userId, pendingOrder, userProfile, onSubmitPayment
When: Names don't communicate intent
Before: if (a && !b || (c && d) && !e)
After: if (isEligibleForDiscount(order))
When: Conditional logic is hard to read
Before: if (retries > 3) or timeout: 30000
After: if (retries > MAX_RETRIES) or timeout: REQUEST_TIMEOUT_MS
When: Numbers/strings have no explanation
Before: Module A imports and calls Module B directly
After: Module A depends on an interface, Module B implements it
When: You need to test A without B, or swap B
skill({ action: "getContent", skill: "refactoring" })
agent({ action: "orchestrate", agents: ["refactoring-specialist"], task: "<description>" })
Read .context/agents/refactoring-specialist.md for project-specific refactoring guidance.
TDD iron law applies during refactoring:
superpowers:test-driven-development)| Pattern | Problem |
|---|---|
| "Big bang" refactor | Too many changes to verify correctness |
| Refactoring + features in same commit | Can't tell if behavior changed intentionally |
| Refactoring without tests | No way to verify behavior is preserved |
| Premature abstraction | 3 similar lines is fine — don't abstract for 2 call sites |
| Refactoring code you don't own | Refactor what you're modifying, not the whole codebase |