quality-refactor
community[command]
Use when accumulated tech debt needs systematic identification and safe reduction
$
/plugin install maestro-flowdetails
<purpose>
Plan and execute targeted refactoring with safety guarantees through analysis, planning, and reflection-driven iteration. Identifies affected files and dependencies, creates a refactoring plan, confirms with the user before execution, then applies changes with test verification after every modification to ensure zero regressions. Each refactoring round records strategy, outcome, and adjustments in reflection-log.md.
</purpose>
<required_reading> @~/.maestro/workflows/refactor.md </required_reading>
<context> Scope: $ARGUMENTS (required) - Module path: "src/auth" - specific directory - Feature area: "authentication" - conceptual scope - "all" - full codebase scanIf not provided, prompt user for scope.
Pre-load context (before refactoring)
- Coding specs: Run
maestro spec load --category codingto load coding conventions. Apply conventions to all refactored code. - Review specs: Run
maestro spec load --category reviewto load review standards. Use as quality gate for refactored code. - Role Knowledge:
- Browse:
maestro wiki list --category coding - Identify task-relevant entries, then load:
maestro wiki load <id1> [id2...]
- Browse:
- All are optional — proceed without if unavailable. </context>
Knowledge inquiry on completion:
After successful refactoring, ask user once: "Record refactoring pattern as coding convention?" If yes, persist via Skill("spec-add", "coding \"<title>\" \"<pattern>\" --keywords <kw1>,<kw2>").
Next-step routing on completion:
- All tests pass →
/quality-sync(update codebase docs) - Test failures after refactor →
/quality-debug "test failures after refactor in {scope}" - No test suite available →
/quality-auto-test {phase}</execution>
<error_codes>
| Code | Severity | Condition | Recovery |
|---|---|---|---|
| E001 | error | Refactoring scope/description required | Prompt user for module path, feature area, or "all" |
| E002 | error | Test suite not available for affected area | Suggest creating tests first, or proceed with manual verification |
| W001 | warning | Partial test coverage for affected area | Note uncovered areas, proceed with extra caution |
| </error_codes> |
<success_criteria>
- Refactoring plan created and confirmed by user
- Changes implemented according to plan
- All tests pass after refactoring
- No regressions introduced
- reflection-log.md written with strategy and outcomes </success_criteria>
technical
- github
- catlog22/maestro-flow
- stars
- 340
- license
- unspecified
- contributors
- 1
- last commit
- 2026-05-25T02:58:12Z
- file
- .claude/commands/quality-refactor.md