buddy
nWave concierge — ask any question about methodology, project state, commands, migration, or troubleshooting. Read-only, contextual answers.
Applies the Refactoring Priority Premise (RPP) levels L1-L6 for systematic code refactoring. Use when improving code quality through structured refactoring passes.
> /plugin marketplace add nWave-ai/nWave > /plugin install nw@nwave-marketplace
How it fires
How this command gets triggered: by you, by Claude, or both.
/refactorContext preview
What this command does when you run it.
Applies the Refactoring Priority Premise (RPP) levels L1-L6 for systematic code refactoring. Use when improving code quality through structured refactoring passes.
description: "Applies the Refactoring Priority Premise (RPP) levels L1-L6 for systematic code refactoring. Use when improving code quality through structured refactoring passes." argument-hint: "[target-class-or-module] - Optional: --level=[1-6] --method=[extract|inline|rename|move] --scope=[method|class|module]"
**Wave**: CROSS_WAVE **Agent**: Crafty (nw-software-crafter) **Command**: `*refactor`
Applies the Refactoring Priority Premise (RPP) — 6-level hierarchy L1 Readability|L2 Complexity|L3 Responsibilities|L4 Abstractions|L5 Design Patterns|L6 SOLID++. For complex multi-class refactorings, agent applies Mikado Method internally.
`/nw-refactor` runs **batch-then-verify** by default, regardless of test-suite speed:
1. **Cascade governs PLANNING ORDER only** — analyze and plan lower levels before higher (L2 builds on L1, etc.). Not a test-gating sequence. 2. **Edits applied as one coherent batch** — all planned L1-L6 transformations in a single editing session, NO interleaved test runs. 3. **Run the test suite exactly ONCE**, at the very end, after all L1-L6 edits. 4. **If RED after the batch**: diagnose and fix the **production** code. Do NOT modify tests to make them pass. A test that must change means either (a) the refactor altered observable behavior — revert it — or (b) the test encoded an implementation detail — flag to the user before touching it. Tests changing during a refactor is a signal, not a step.
**Legacy incremental variant** (opt-in only): the `nw-progressive-refactoring` skill documents the incremental L1→test→L2→test cycle — NOT the default; use only when explicitly requested. Anchor: `feedback_refactor_batch_when_test_suite_slow_2026_05_19` (the prior "only batch when suite slow" conditional is removed).
@nw-software-crafter
Execute \*refactor for {target-class-or-module}.
**Context Files:**
**Configuration:**
The invoked agent MUST create a task list from its workflow phases at the start of execution using TaskCreate. Each phase becomes a task with the gate condition as completion criterion. Mark tasks in_progress when starting each phase and completed when the gate passes. This gives the user real-time visibility into progress.
**Handoff To**: {invoking-agent-returns-to-workflow} **Deliverables**: Refactored codebase with quality improvements
/nw-refactor src/auth/token_manager.py --level=2 --scope=module
Crafty applies RPP L1-L2: rename ambiguous variables|extract magic numbers into constants|remove dead code (L1), then simplify conditionals|extract long methods (L2).
/nw-refactor src/billing/ --level=6 --scope=module --mikado_planning=true
Crafty uses Mikado Method for multi-class refactoring, applies dependency inversion|interface segregation across billing module.
/nw-refactor src/des/domain/ --from=1 --to=3 --scope=module
Sweeps L1 readability|L2 complexity|L3 responsibility smells. Cascade governs planning order (analyze L1 before L2 before L3); edits applied as one batch; suite run once at the end.
/nw-refactor src/des/cli/verify.py --level=3 --scope=file
Targets L3 responsibility smells only (Large Class, Feature Envy, Shotgun Surgery). Assumes L1-L2 already clean.
src/* (refactored production code) tests/* (refactored test code) docs/refactoring/ refactoring-log.md quality-metrics.md
AI agents that guide you from idea to working code, with human judgment at every gate. nWave runs inside Claude Code. It breaks feature delivery into seven waves (discover, diverge, discuss, design, devops, distill, deliver).
Repo: nWave-ai/nWave
nWave concierge — ask any question about methodology, project state, commands, migration, or troubleshooting. Read-only, contextual answers.
Bug fix workflow: root cause analysis → user review → regression test + fix via TDD
Detects current wave progress for a feature and resumes at the next step. Scans docs/feature/ for artifacts.
Orchestrates the full DELIVER wave end-to-end (roadmap > execute-all > finalize). Use when all prior waves are complete and the feature is ready for…
Designs system architecture with C4 diagrams and technology selection. Use when defining component boundaries, choosing tech stacks, or creating architecture…
Designs CI/CD pipelines, infrastructure, observability, and deployment strategy. Use when preparing platform readiness for a feature.