Nw Command Optimization Workflow
Step-by-step workflow for converting bloated command files to lean declarative definitions
Install
npx skills add nWave-ai/nWave --skill nw-command-optimization-workflow -g -a claude-code -y- Repository
- nWave-ai/nWave628
- Category
- Engineering
- Updated
- 2mo ago
- License
- MIT
- Context cost
- Lightabout 1,080 tokens
- Runs scripts
- No, instructions only
What it does
Step-by-step workflow for converting bloated command files to lean declarative definitions
Command Optimization Workflow
Overview
Convert oversized commands (500-2400 lines) to lean declarative definitions (40-300 lines) by removing duplication, extracting domain knowledge to agents, and adopting the forge.md pattern.
Phase 1: Analyze
- Classify: dispatcher, orchestrator, or simple
- Measure:
wc -lthe file - Identify content categories (approximate %): parameter parsing/validation | Workflow/orchestration logic | Agent prompt templates | Examples/documentation | Error handling | Boilerplate (orchestrator briefing, agent registry)
- Flag reducible content: Duplication from other commands (orchestrator briefing, agent registry, parameter parsing) | Domain knowledge belonging in agents (TDD phases, review criteria, methodology) | Dead code (deprecated formats, aspirational features, old signatures) | Verbose examples (JSON blocks exceeding 3 examples) | Aggressive language (count CRITICAL/MANDATORY/MUST)
Phase 2: Extract
2a: Remove shared boilerplate
These blocks appear in 5-12 commands, extract to shared orchestrator preamble skill:
- "Sub-agents have NO ACCESS to Skill tool" briefing (~20-30 lines/file)
- Agent registry with capabilities (~15-20 lines/file)
- Parameter parsing rules (~10-15 lines/file)
- Pre-invocation validation checklist (~10-15 lines/file)
- "What NOT to include" blocks (~8-12 lines/file)
After extraction, command references preamble.
2b: Move domain knowledge to agents
If command contains HOW the agent works, move to agent definition or skill:
- TDD phase details -> nw-software-crafter | DIVIO templates -> nw-documentarist | Refactoring hierarchies -> nw-software-crafter | BDD/Gherkin -> nw-acceptance-designer | Review criteria -> reviewer agent | Mutation testing config -> nw-software-crafter
Command retains WHAT and success criteria. Agent owns HOW.
