| name | nw-ab-examples |
| description | KNOWLEDGE — canonical worked examples for agent creation, migration, and command optimization. Reference for the relevant procedures; no sequence. |
| user-invocable | false |
nw-ab-examples (KNOWLEDGE)
Kind: KNOWLEDGE (reference). Loaded on demand by the procedure whose example it carries. No forced sequence.
Example 1: Good V2 Agent (Specialist)
User requests agent for database migration planning.
---
name: nw-db-migrator
description: Use for database migration planning. Designs migration strategies with rollback safety.
model: inherit
tools: Read, Glob, Grep, Bash
maxTurns: 30
skills:
- nw-migration-patterns
---
Core definition: ~150 lines (role, 5 divergent principles, 4-phase workflow, 4 critical rules, 3 examples). Domain knowledge extracted to migration-patterns skill (~200 lines). Total always-loaded: ~150 lines. With skill: ~350 lines.
Example 2: Bad Monolithic Agent
2,400-line spec with embedded YAML config, 17 commands, 7-layer enterprise security framework, aggressive language.
Action: Apply migration path:
- Extract YAML config -> frontmatter (5 lines)
- Remove 5 "production frameworks" duplicating platform features (~400 lines saved)
- Remove default behavior specifications (~500 lines saved)
- Extract domain knowledge to 2-3 Skills (~800 lines moved)
- Replace aggressive language with direct statements
- Result: ~250 line core + 3 Skills
Example 3: Skill Extraction Decision
Agent at 380 lines — within 400-line target. Extract Skills?
Decision tree:
- Functional and passing validation? Yes -> Ship as-is
- Clearly separable knowledge domains (>100 lines each)? Yes -> Extract for reusability
- Will grow as domain knowledge expands? Yes -> Extract now to prevent bloat
- Knowledge useful to other agents? Yes -> Extract as shared skill
Default: under 400 lines and passing validation -> do not over-engineer with premature extraction.
Example 4: Command Optimization (Dispatcher)
User asks to optimize execute.md (1,051 lines). It's a dispatcher command.
Analysis: ~35% reducible (300 lines JSON state examples contradicting v2.0 format|200 lines duplicated parameter parsing|100 lines agent registry|deprecated references).
Action:
- Remove JSON state examples (v2.0 uses pipe-delimited, not JSON) -- 300 lines saved
- Extract parameter parsing to shared preamble -- 200 lines saved
- Remove agent registry duplication -- 100 lines saved
- Move TDD phase details to nw-software-crafter agent -- 200 lines saved
- Restructure as declarative dispatcher using forge.md pattern
- Result: ~120 lines (agent invocation + context extraction pattern + success criteria)
Example 5: Command Optimization (Orchestrator)
develop.md at 2,394 lines embeds 6 sub-command workflows inline.
Action: Replace embedded workflows with phase references. Keep orchestration logic (phase sequencing, resume handling). Remove all embedded agent prompt templates. Target: 200-300 lines of pure orchestration.