@crewx/wbs 0.1.6 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md CHANGED
@@ -1,1198 +1,1198 @@
1
- ---
2
- name: crewx/wbs
3
- description: Work Breakdown Structure (WBS) management skill. Enables AI coordinators to decompose complex tasks into 30-minute timeboxed jobs and execute them via worker agents.
4
- metadata:
5
- version: 0.3.0
6
- built-in: true
7
- ---
8
-
9
- # WBS Skill
10
-
11
- Provides state management and worker execution for Work Breakdown Structure based task decomposition.
12
-
13
- ## Core Principle
14
-
15
- **System provides state management, AI agent makes intelligent decisions.**
16
-
17
- ```
18
- User Request
19
- |
20
- v
21
- +-----------------------------------------------------+
22
- | Coordinator Agent (with WBS skill) |
23
- | - Analyze request (AI judgment) |
24
- | - Decompose into 30-min Jobs (AI judgment) |
25
- | - Execute workers: crewx x "@agent action" |
26
- | - Track state: wbs.js |
27
- +-----------------------------------------------------+
28
- |
29
- +---------------+--------------+
30
- v v v
31
- +---------+ +---------+ +---------+
32
- | Worker1 | | Worker2 | | Worker3 |
33
- | @claude | | @gemini | | @copilot|
34
- +---------+ +---------+ +---------+
35
- ```
36
-
37
- ## What is WBS Skill?
38
-
39
- The WBS (Work Breakdown Structure) skill is a **project management system for complex AI-driven tasks**. It enables coordinator agents to:
40
-
41
- 1. **Decompose complex tasks** into manageable 30-minute jobs
42
- 2. **Track progress** with state management (pending -> running -> completed/failed)
43
- 3. **Coordinate multiple agents** by assigning different jobs to specialized workers
44
- 4. **Manage context** through detail documents and structured workflow
45
- 5. **Execute in parallel** by distributing jobs across multiple worker agents
46
-
47
- ### Key Characteristics
48
-
49
- - **Structured Approach**: Projects are broken down into jobs with clear status tracking
50
- - **Time-Boxed Execution**: Each job targets 15-45 minutes (optimal: 25-30 min)
51
- - **Multi-Agent Coordination**: Different jobs can be assigned to different AI agents
52
- - **State Persistence**: All project data, jobs, and execution history are tracked in `.wbs-data.json`
53
- - **Automated Workflow**: Git branching, PR templates, and issue tracking integration
54
- - **Job Slug System**: Jobs are identified by intuitive slugs (`wbs-5-1`, `wbs-5-2`) computed from `wbs_id + seq`
55
- - **Auto-generated Detail Files**: `job add` automatically generates/updates `wbs-details/wbs-{N}-detail.md` with job metadata
56
-
57
- ## Job Slug System
58
-
59
- Each job gets a **slug** computed from its WBS ID and sequence number: `wbs-{N}-{seq}`
60
-
61
- | Internal ID | Slug | Meaning |
62
- |------------|------|---------|
63
- | `job-15` | `wbs-5-1` | 1st Job of WBS-5 |
64
- | `job-16` | `wbs-5-2` | 2nd Job of WBS-5 |
65
- | `job-17` | `wbs-5-3` | 3rd Job of WBS-5 |
66
-
67
- - Slugs are **computed values** (not stored in DB) -- derived from `wbs_id` + `seq`
68
- - All commands accepting `<job-id>` also accept `<slug>`: `wbs job update wbs-5-1 --status completed`
69
- - Git branches use slug naming: `feature/wbs-5-1`
70
- - Worktree directories align with slug naming
71
-
72
- ## When to Use WBS Skill
73
-
74
- ### Use WBS When
75
-
76
- Choose WBS for tasks that meet **any** of these criteria:
77
-
78
- - **Complex multi-step tasks** (> 45 minutes total)
79
- - Feature implementations spanning multiple files/modules
80
- - Large-scale refactoring projects
81
- - Bug fix sprints with multiple related issues
82
-
83
- - **30-minute timeboxing needed**
84
- - Tasks prone to context loss (LLM "Lost in the Middle" problem)
85
- - Work requiring periodic checkpoints and validation
86
- - Projects where partial progress needs to be tracked
87
-
88
- - **Parallel execution beneficial**
89
- - Jobs that can be distributed across multiple worker agents
90
- - Tasks where different agents excel at different subtasks
91
- - Work that benefits from concurrent execution
92
-
93
- - **Progress tracking important**
94
- - Team collaboration requiring visibility into task status
95
- - Projects with external stakeholders needing updates
96
- - Work where partial failure recovery is critical
97
-
98
- - **GitHub integration needed**
99
- - Tasks linked to GitHub issues
100
- - Projects requiring structured PR workflows
101
- - Work following standardized git branching strategies
102
-
103
- ### Use Direct Delegation When
104
-
105
- Skip WBS for simpler scenarios:
106
-
107
- - Single-step tasks (< 15 minutes)
108
- - One-off file modifications
109
- - Quick code analysis or queries
110
- - Rapid prototyping without tracking needs
111
- - Tasks with no need for state persistence
112
-
113
- ### Decision Flow
114
-
115
- ```
116
- Task received
117
- |
118
- v
119
- Expected duration?
120
- |
121
- +--- < 15 min ----------------------> Direct Delegation
122
- |
123
- +--- 15-45 min -+- Single step ------> Direct Delegation
124
- | +- Multi-step --------> WBS Skill
125
- |
126
- +--- > 45 min ----------------------> WBS Skill (required)
127
- ```
128
-
129
- ## Use Case Examples
130
-
131
- ### 1. Complex Feature Implementation
132
-
133
- **Scenario**: Implement user authentication system
134
-
135
- ```bash
136
- # WBS approach - structured and tracked
137
- wbs.js create "User Authentication Implementation"
138
- wbs.js job add wbs-1 --title "Design User model" --agent "@claude:sonnet" --seq 1
139
- wbs.js job add wbs-1 --title "Implement login API" --agent "@copilot" --seq 2
140
- wbs.js job add wbs-1 --title "Add JWT handling" --agent "@copilot" --seq 3
141
- wbs.js job add wbs-1 --title "Write unit tests" --agent "@claude:sonnet" --seq 4
142
- wbs.js job run wbs-1
143
- ```
144
-
145
- **Why WBS**: Multi-step process, multiple agents, progress tracking needed
146
-
147
- ### 2. Bug Fix Sprint
148
-
149
- **Scenario**: Fix multiple related authentication bugs
150
-
151
- ```bash
152
- # WBS approach - organized issue resolution
153
- wbs.js create "Bug Fix Sprint"
154
- wbs.js job add wbs-2 --title "Fix login bug" --agent "@claude" --issue 42 --seq 1
155
- wbs.js job add wbs-2 --title "Fix session timeout" --agent "@claude" --issue 43 --seq 2
156
- wbs.js job add wbs-2 --title "Fix password reset" --agent "@claude" --issue 44 --seq 3
157
- wbs.js job run wbs-2
158
- ```
159
-
160
- **Why WBS**: Multiple issues, GitHub integration, failure recovery important
161
-
162
- ### 3. Large Refactoring
163
-
164
- **Scenario**: Refactor API layer across multiple modules
165
-
166
- ```bash
167
- # WBS approach - context preservation across modules
168
- wbs.js create "API Refactoring"
169
- wbs.js job add wbs-3 --title "Refactor auth module" --agent "@claude" --seq 1
170
- wbs.js job add wbs-3 --title "Refactor user module" --agent "@claude" --seq 2
171
- wbs.js job add wbs-3 --title "Update tests" --agent "@copilot" --seq 3
172
- wbs.js job run wbs-3
173
- ```
174
-
175
- **Why WBS**: Context preservation critical, step-by-step validation needed
176
-
177
- ### 4. Simple Code Fix (No WBS)
178
-
179
- **Scenario**: Fix a typo in documentation
180
-
181
- ```bash
182
- # Direct delegation - immediate execution
183
- crewx x "@claude Fix typo in README.md line 42"
184
- ```
185
-
186
- **Why Direct**: Single-step, < 15 minutes, no tracking needed
187
-
188
- ## 30-Minute Timeboxing
189
-
190
- | Category | Time | Description |
191
- |----------|------|-------------|
192
- | Minimum | 15 min | Below this -> don't separate as Job |
193
- | Optimal | 25-30 min | Target duration |
194
- | Maximum | 45 min | Above this -> re-decompose |
195
-
196
- **Rationale**: LLM context limits (Lost in the Middle, Context Rot) + Pomodoro Technique
197
-
198
- ## WARNING: Job Description Template (MANDATORY)
199
-
200
- **All Jobs must follow the template below.** Vague Job Descriptions are a leading cause of incomplete work.
201
-
202
- ### Template
203
-
204
- ```markdown
205
- **Deliverables:**
206
- 1. path/to/file1.tsx - description
207
- 2. path/to/file2.ts - description
208
- 3. Modify existing file: path/to/existing.tsx
209
-
210
- **Done Criteria:**
211
- - [ ] Verify component rendering
212
- - [ ] Verify store integration works
213
- - [ ] Verify route addition and navigation
214
-
215
- **References:**
216
- - docs/ui-screens/screens/XX.md
217
- - Wireframe/design links
218
- ```
219
-
220
- ### Usage Example
221
-
222
- ```bash
223
- # [BAD] BAD - Vague Job Description
224
- node wbs.js job add wbs-1 \
225
- --title "Agent settings screen" \
226
- --desc "Display crewx.yaml agent list. Model/provider/prompt editing UI." \
227
- --agent "@launcher_gemini_dev"
228
-
229
- # [OK] GOOD - Clear deliverables and done criteria
230
- node wbs.js job add wbs-1 \
231
- --title "Agent settings screen" \
232
- --desc "**Deliverables:**
233
- 1. src/renderer/components/AgentConfig/AgentConfigPage.tsx - Agent list page
234
- 2. src/renderer/components/AgentConfig/AgentEditModal.tsx - Edit modal
235
- 3. src/renderer/App.tsx - Add /agents route
236
- 4. src/renderer/components/Layout/Sidebar.tsx - Add menu item
237
-
238
- **Done Criteria:**
239
- - [ ] Agent list displays when navigating to /agents
240
- - [ ] Edit modal opens on button click
241
- - [ ] Changes saved to crewx.yaml on save
242
-
243
- **References:** docs/ui-screens/screens/03-agent.md" \
244
- --agent "@launcher_gemini_dev"
245
- ```
246
-
247
- ### Why Is This Mandatory?
248
-
249
- | Problem | Vague Job Description | With Template |
250
- |---------|----------------------|---------------|
251
- | **Scope interpretation** | Agent interprets arbitrarily | Clear file list |
252
- | **Completion judgment** | Manual "done" marking | Checklist verification |
253
- | **Preventing omissions** | Only Store without UI | All deliverables specified |
254
- | **Review ease** | Unclear what to verify | Checklist-based review |
255
-
256
- ### Integration Test Job Template
257
-
258
- Integration test Jobs must specify verification items in detail:
259
-
260
- ```bash
261
- node wbs.js job add wbs-1 \
262
- --title "Integration test" \
263
- --desc "**Verification Scenarios:**
264
- 1. Onboarding -> Preset selection -> Installation complete
265
- 2. Dashboard -> Agent list displays
266
- 3. Agent settings -> Edit -> Save
267
-
268
- **Verification Methods:**
269
- - [ ] Manual execution of each scenario
270
- - [ ] Screenshot capture (using skills/playwright-python)
271
- - [ ] Error log inspection
272
-
273
- **Pass Criteria:**
274
- - All scenarios work correctly
275
- - No console errors" \
276
- --agent "@launcher_codex_dev"
277
- ```
278
-
279
- ## Installation
280
-
281
- ```bash
282
- cd skills/wbs
283
- npm install
284
- ```
285
-
286
- Requires Node.js 16+.
287
-
288
- ## Commands Reference
289
-
290
- ### Project Management Commands
291
-
292
- | Command | Syntax | Description |
293
- |---------|--------|-------------|
294
- | **create** | `wbs.js create "Title" [--detail path]` | Create new WBS project with sequential ID (wbs-1, wbs-2, ...) |
295
- | **list** | `wbs.js list [--json]` | List all projects with status and progress |
296
- | **status** | `wbs.js status <wbs-id> [--json]` | Get detailed project info including all jobs and summary stats |
297
- | **delete** | `wbs.js delete <wbs-id>` | Delete project and all associated jobs/executions (irreversible) |
298
-
299
- ### Job Management Commands
300
-
301
- | Command | Syntax | Description |
302
- |---------|--------|-------------|
303
- | **job add** | `wbs.js job add <wbs-id> --title "Title" --agent "@agent" [options]` | Add new job to project. Options: `--desc`, `--seq`, `--issue` |
304
- | **job list** | `wbs.js job list <wbs-id> [--json]` | List all jobs ordered by sequence number |
305
- | **job update** | `wbs.js job update <job-id\|slug> [options]` | Update job properties. Options: `--status`, `--title`, `--desc`, `--agent`, `--seq`, `--issue` |
306
- | **job run** | `wbs.js job run <wbs-id>` | Execute all pending jobs sequentially (30-min timeout each) |
307
- | **job next** | `wbs.js job next <wbs-id>` | Execute only the next pending job (manual step-by-step) |
308
- | **job retry** | `wbs.js job retry <job-id\|slug>` | Retry a failed or completed job |
309
-
310
- ### Execution Management Commands
311
-
312
- | Command | Syntax | Description |
313
- |---------|--------|-------------|
314
- | **exec list** | `wbs.js exec list <job-id\|slug> [--json]` | List execution history for a job |
315
- | **exec status** | `wbs.js exec status <exec-id> [--json]` | Get detailed execution info |
316
- | **exec kill** | `wbs.js exec kill <exec-id>` | Kill a running execution |
317
- | **exec running** | `wbs.js exec running [--json]` | List all currently running executions |
318
-
319
- ### Coordinator Commands (Natural Language)
320
-
321
- | Command | Syntax | Description |
322
- |---------|--------|-------------|
323
- | **q** | `wbs.js q "question"` | Ask coordinator a question (via `@wbs_coordinator`) |
324
- | **x** | `wbs.js x "request"` | Request coordinator to execute an action |
325
-
326
- ### Daemon Commands (Background Scheduler)
327
-
328
- | Command | Syntax | Description |
329
- |---------|--------|-------------|
330
- | **daemon start** | `wbs.js daemon start` | Start background scheduler |
331
- | **daemon stop** | `wbs.js daemon stop` | Stop running daemon |
332
- | **daemon status** | `wbs.js daemon status` | Check daemon status |
333
- | **daemon tick** | `wbs.js daemon tick` | Manual tick for testing |
334
-
335
- ### Common Usage Patterns
336
-
337
- ```bash
338
- # Create and run a complete project
339
- wbs.js create "User Authentication"
340
- wbs.js job add wbs-1 --title "Design schema" --agent "@claude:sonnet" --seq 1
341
- wbs.js job add wbs-1 --title "Implement API" --agent "@copilot" --seq 2
342
- wbs.js job add wbs-1 --title "Write tests" --agent "@claude:sonnet" --seq 3
343
- wbs.js job run wbs-1
344
-
345
- # Check progress
346
- wbs.js status wbs-1
347
-
348
- # Handle failures (use job-id or slug)
349
- wbs.js job list wbs-1 --json | jq '.[] | select(.status=="failed")'
350
- wbs.js job retry wbs-1-3 # by slug
351
- wbs.js job retry job-5 # by job-id
352
-
353
- # Issue-based workflow
354
- wbs.js job add wbs-2 --title "Fix bug" --agent "@claude" --issue 42
355
- ```
356
-
357
- ### Output Formats
358
-
359
- - **Default**: Human-readable tables with emoji status icons
360
- - **--json**: Machine-parseable JSON for scripting and automation
361
-
362
- For detailed command documentation, see:
363
- - [COMMANDS.md](./COMMANDS.md) - Complete project commands reference
364
- - [job-management.md](./job-management.md) - Comprehensive job management guide
365
-
366
- ## Practical Usage Examples
367
-
368
- This section provides comprehensive real-world examples of using the WBS skill effectively.
369
-
370
- ### Example 1: Simple Workflow (Create -> Add Jobs -> Run)
371
-
372
- The most basic WBS workflow involves creating a project, adding jobs, and running them sequentially.
373
-
374
- **Scenario**: Build a simple REST API for a todo application
375
-
376
- ```bash
377
- # 1. Create the project
378
- node wbs.js create "Todo REST API"
379
- ```
380
-
381
- **Expected output:**
382
- ```json
383
- {
384
- "id": "wbs-1",
385
- "title": "Todo REST API",
386
- "status": "planning",
387
- "detailPath": "skills/wbs/details/wbs-1-detail.md",
388
- "created_at": "2025-12-18T08:00:00.000Z"
389
- }
390
- ```
391
-
392
- ```bash
393
- # 2. Add jobs for implementation
394
- node wbs.js job add wbs-1 \
395
- --title "Design database schema" \
396
- --agent "@claude:sonnet" \
397
- --seq 1 \
398
- --desc "Create SQLite schema for todos table with id, title, completed, created_at fields"
399
-
400
- node wbs.js job add wbs-1 \
401
- --title "Implement CRUD endpoints" \
402
- --agent "@copilot" \
403
- --seq 2 \
404
- --desc "Create Express routes: GET /todos, POST /todos, PUT /todos/:id, DELETE /todos/:id"
405
-
406
- node wbs.js job add wbs-1 \
407
- --title "Add input validation" \
408
- --agent "@claude:sonnet" \
409
- --seq 3 \
410
- --desc "Implement request validation middleware using express-validator"
411
-
412
- node wbs.js job add wbs-1 \
413
- --title "Write integration tests" \
414
- --agent "@copilot" \
415
- --seq 4 \
416
- --desc "Create test suite covering all CRUD operations using supertest"
417
- ```
418
-
419
- ```bash
420
- # 3. Review the planned jobs
421
- node wbs.js status wbs-1
422
- ```
423
-
424
- **Expected output:**
425
- ```
426
- [INFO] Todo REST API (wbs-1)
427
- Status: planning | Progress: 0% (0/4)
428
- Detail: skills/wbs/details/wbs-1-detail.md
429
-
430
- Jobs:
431
- | Status | # | Slug | ID | Task | Agent |
432
- |--------|----|-----------|-------|--------------------------|-----------------|
433
- | [ ] | 1 | wbs-1-1 | job-1 | Design database schema | @claude:sonnet |
434
- | [ ] | 2 | wbs-1-2 | job-2 | Implement CRUD endpoints | @copilot |
435
- | [ ] | 3 | wbs-1-3 | job-3 | Add input validation | @claude:sonnet |
436
- | [ ] | 4 | wbs-1-4 | job-4 | Write integration tests | @copilot |
437
- ```
438
-
439
- ```bash
440
- # 4. Run all jobs
441
- node wbs.js job run wbs-1
442
- ```
443
-
444
- **Expected output:**
445
- ```
446
- ==================================================
447
- [WBS] Starting project: Todo REST API
448
- ==================================================
449
-
450
- [WBS] Running job: Design database schema
451
- [WBS] Agent: @claude:sonnet
452
- [WBS] Description: Create SQLite schema for todos table...
453
- [WBS] Timeout: 30 minutes
454
- --------------------------------------------------
455
- [Agent executes and produces output...]
456
- --------------------------------------------------
457
- [WBS] Job completed: Design database schema
458
-
459
- [WBS] Running job: Implement CRUD endpoints
460
- [WBS] Agent: @copilot
461
- [WBS] Timeout: 30 minutes
462
- --------------------------------------------------
463
- [Agent executes and produces output...]
464
- --------------------------------------------------
465
- [WBS] Job completed: Implement CRUD endpoints
466
-
467
- [... continues for remaining jobs ...]
468
-
469
- ==================================================
470
- [WBS] Project completed: Todo REST API
471
- [WBS] Completed: 4, Failed: 0
472
- ==================================================
473
- ```
474
-
475
- ```bash
476
- # 5. Verify completion
477
- node wbs.js status wbs-1
478
- ```
479
-
480
- **Final output:**
481
- ```
482
- [INFO] Todo REST API (wbs-1)
483
- Status: completed | Progress: 100% (4/4)
484
- Detail: skills/wbs/details/wbs-1-detail.md
485
-
486
- Jobs:
487
- | Status | # | Slug | ID | Task | Agent | Status |
488
- |--------|----|-----------|-------|--------------------------|-----------------|-----------|
489
- | [OK] | 1 | wbs-1-1 | job-1 | Design database schema | @claude:sonnet | completed |
490
- | [OK] | 2 | wbs-1-2 | job-2 | Implement CRUD endpoints | @copilot | completed |
491
- | [OK] | 3 | wbs-1-3 | job-3 | Add input validation | @claude:sonnet | completed |
492
- | [OK] | 4 | wbs-1-4 | job-4 | Write integration tests | @copilot | completed |
493
- ```
494
-
495
- ---
496
-
497
- ### Example 2: Issue-Based Workflow
498
-
499
- Use WBS to manage multiple GitHub issues systematically.
500
-
501
- **Scenario**: Fix authentication-related bugs tracked in GitHub
502
-
503
- ```bash
504
- # 1. Create project for bug fixes
505
- node wbs.js create "Authentication Bug Fixes"
506
- ```
507
-
508
- **Output:**
509
- ```json
510
- {
511
- "id": "wbs-2",
512
- "title": "Authentication Bug Fixes",
513
- "status": "planning"
514
- }
515
- ```
516
-
517
- ```bash
518
- # 2. Add jobs linked to GitHub issues
519
- node wbs.js job add wbs-2 \
520
- --title "Fix: Login fails with special characters in password" \
521
- --agent "@claude:sonnet" \
522
- --issue 123 \
523
- --seq 1
524
-
525
- node wbs.js job add wbs-2 \
526
- --title "Fix: Session timeout not working" \
527
- --agent "@claude:sonnet" \
528
- --issue 124 \
529
- --seq 2
530
-
531
- node wbs.js job add wbs-2 \
532
- --title "Fix: Password reset email not sent" \
533
- --agent "@claude:sonnet" \
534
- --issue 125 \
535
- --seq 3
536
- ```
537
-
538
- **What happens during execution:**
539
-
540
- When you run `node wbs.js job run wbs-2`, each job receives these instructions:
541
-
542
- ```
543
- ## Task Instructions
544
- Process GitHub Issue #123.
545
-
546
- **Follow your existing development process:**
547
- 1. Check the issue with `gh issue view 123`
548
- 2. Create branch and work
549
- 3. Create PR
550
- 4. Comment results on the issue
551
-
552
- WBS Tracking Info:
553
- - WBS: wbs-2
554
- - Job: job-1
555
- ```
556
-
557
- **Advantages:**
558
- - Automatic issue-branch-PR linking
559
- - Agent follows its own development workflow
560
- - Easy progress tracking via GitHub
561
- - Issue comments document resolution
562
-
563
- ---
564
-
565
- ### Example 3: Step-by-Step Execution
566
-
567
- Execute jobs manually one at a time with review between each step.
568
-
569
- **Scenario**: Refactoring legacy code where each step needs verification
570
-
571
- ```bash
572
- # 1. Create project
573
- node wbs.js create "Legacy Code Refactoring"
574
-
575
- # 2. Add jobs
576
- node wbs.js job add wbs-3 \
577
- --title "Extract UserService from monolithic controller" \
578
- --agent "@claude:opus" \
579
- --seq 1 \
580
- --desc "Move user-related logic from AppController to new UserService class"
581
-
582
- node wbs.js job add wbs-3 \
583
- --title "Add dependency injection" \
584
- --agent "@claude:sonnet" \
585
- --seq 2 \
586
- --desc "Refactor UserService to use constructor injection for database"
587
-
588
- node wbs.js job add wbs-3 \
589
- --title "Update unit tests" \
590
- --agent "@copilot" \
591
- --seq 3 \
592
- --desc "Modify tests to work with new UserService architecture"
593
-
594
- node wbs.js job add wbs-3 \
595
- --title "Verify integration tests pass" \
596
- --agent "@copilot" \
597
- --seq 4 \
598
- --desc "Run full test suite and fix any integration issues"
599
- ```
600
-
601
- ```bash
602
- # 3. Execute first job only
603
- node wbs.js job next wbs-3
604
- ```
605
-
606
- **Output:**
607
- ```
608
- [WBS] Running job: Extract UserService from monolithic controller
609
- [WBS] Agent: @claude:opus
610
- [WBS] Timeout: 30 minutes
611
- --------------------------------------------------
612
- [Agent output...]
613
- --------------------------------------------------
614
- [WBS] Job completed: Extract UserService from monolithic controller
615
-
616
- {
617
- "success": true,
618
- "execId": "exec-1"
619
- }
620
- ```
621
-
622
- ```bash
623
- # 4. Review changes before continuing
624
- git diff
625
- npm test
626
-
627
- # 5. If satisfied, run next job
628
- node wbs.js job next wbs-3
629
- ```
630
-
631
- **Output:**
632
- ```
633
- [WBS] Running job: Add dependency injection
634
- [WBS] Agent: @claude:sonnet
635
- ...
636
- ```
637
-
638
- ```bash
639
- # 6. Continue step by step
640
- node wbs.js status wbs-3 # Check progress
641
- node wbs.js job next wbs-3 # Run next job
642
- ```
643
-
644
- **Use cases for step-by-step execution:**
645
- - Code reviews between steps
646
- - Testing after each change
647
- - Learning/understanding the codebase
648
- - High-risk refactoring
649
- - Debugging job configurations
650
-
651
- ---
652
-
653
- ### Example 4: Handling Failures
654
-
655
- Recover from failed jobs and retry with updated configurations.
656
-
657
- **Scenario**: API implementation where initial attempts fail
658
-
659
- ```bash
660
- # 1. Create project and add jobs
661
- node wbs.js create "Payment API Integration"
662
-
663
- node wbs.js job add wbs-4 \
664
- --title "Integrate Stripe SDK" \
665
- --agent "@copilot" \
666
- --seq 1
667
-
668
- node wbs.js job add wbs-4 \
669
- --title "Implement payment endpoint" \
670
- --agent "@claude:sonnet" \
671
- --seq 2
672
-
673
- node wbs.js job add wbs-4 \
674
- --title "Add webhook handler" \
675
- --agent "@claude:sonnet" \
676
- --seq 3
677
-
678
- # 2. Run all jobs
679
- node wbs.js job run wbs-4
680
- ```
681
-
682
- **Suppose job-2 fails:**
683
-
684
- ```
685
- [WBS] Running job: Implement payment endpoint
686
- [WBS] Agent: @claude:sonnet
687
- --------------------------------------------------
688
- Error: Missing API key configuration
689
- --------------------------------------------------
690
- [WBS] Job failed: Implement payment endpoint
691
- ```
692
-
693
- ```bash
694
- # 3. Check which jobs failed
695
- node wbs.js job list wbs-4 --json | jq '.[] | select(.status=="failed")'
696
- ```
697
-
698
- **Output:**
699
- ```json
700
- {
701
- "id": "job-2",
702
- "wbs_id": "wbs-4",
703
- "title": "Implement payment endpoint",
704
- "status": "failed",
705
- "agent": "@claude:sonnet",
706
- "seq": 2
707
- }
708
- ```
709
-
710
- ```bash
711
- # 4. Review execution history
712
- node wbs.js exec list job-2
713
- ```
714
-
715
- **Output:**
716
- ```
717
- [INFO] Executions for job-2
718
-
719
- | Status | ID | PID | Start | End | Code |
720
- |--------|---------|-------|---------------------|---------------------|------|
721
- | [BAD] | exec-2 | 45678 | 2025-12-18 09:15:00 | 2025-12-18 09:18:00 | 1 |
722
- ```
723
-
724
- ```bash
725
- # 5. Fix the issue (add environment variable or update job description)
726
- node wbs.js job update job-2 \
727
- --desc "Implement payment endpoint. Use STRIPE_API_KEY from .env file. Handle both test and production modes."
728
-
729
- # 6. Retry the failed job
730
- node wbs.js job retry job-2
731
- ```
732
-
733
- **Output:**
734
- ```
735
- [WBS] Retrying job: Implement payment endpoint
736
- [WBS] Running job: Implement payment endpoint
737
- [WBS] Agent: @claude:sonnet
738
- [WBS] Timeout: 30 minutes
739
- --------------------------------------------------
740
- [Agent output...]
741
- --------------------------------------------------
742
- [WBS] Job completed: Implement payment endpoint
743
-
744
- {
745
- "success": true,
746
- "execId": "exec-5"
747
- }
748
- ```
749
-
750
- ```bash
751
- # 7. Continue with remaining jobs
752
- node wbs.js job run wbs-4
753
- ```
754
-
755
- **Final status:**
756
- ```
757
- [INFO] Payment API Integration (wbs-4)
758
- Status: completed | Progress: 100% (3/3)
759
-
760
- Jobs:
761
- | Status | # | ID | Task | Status |
762
- |--------|----|----|--------------------------|-----------|
763
- | [OK] | 1 | job-1 | Integrate Stripe SDK | completed |
764
- | [OK] | 2 | job-2 | Implement payment endpoint| completed |
765
- | [OK] | 3 | job-3 | Add webhook handler | completed |
766
- ```
767
-
768
- **Batch retry all failed jobs:**
769
- ```bash
770
- # Find and retry all failed jobs in a project
771
- for job in $(node wbs.js job list wbs-4 --json | jq -r '.[] | select(.status=="failed") | .id'); do
772
- echo "Retrying $job..."
773
- node wbs.js job retry $job
774
- done
775
- ```
776
-
777
- ---
778
-
779
- ### Example 5: Complex Multi-Agent Coordination
780
-
781
- Distribute work across different AI agents based on their strengths.
782
-
783
- **Scenario**: Build a full-stack feature with frontend, backend, and tests
784
-
785
- ```bash
786
- # 1. Create project
787
- node wbs.js create "User Profile Feature"
788
-
789
- # 2. Add jobs with appropriate agent selection
790
- # Backend work - @claude:sonnet for complex logic
791
- node wbs.js job add wbs-5 \
792
- --title "Design User Profile data model" \
793
- --agent "@claude:sonnet" \
794
- --seq 1 \
795
- --desc "Create schema with fields: avatar, bio, social_links, preferences"
796
-
797
- # Implementation - @copilot for straightforward coding
798
- node wbs.js job add wbs-5 \
799
- --title "Implement profile CRUD API" \
800
- --agent "@copilot" \
801
- --seq 2 \
802
- --desc "REST endpoints for profile operations with validation"
803
-
804
- # Complex architecture - @claude:opus for advanced decisions
805
- node wbs.js job add wbs-5 \
806
- --title "Design avatar upload system" \
807
- --agent "@claude:opus" \
808
- --seq 3 \
809
- --desc "S3 integration with image processing, CDN, and caching strategy"
810
-
811
- # Implementation again
812
- node wbs.js job add wbs-5 \
813
- --title "Implement avatar upload" \
814
- --agent "@copilot" \
815
- --seq 4 \
816
- --desc "File upload endpoint with S3 SDK and image optimization"
817
-
818
- # Frontend - @claude:sonnet for React components
819
- node wbs.js job add wbs-5 \
820
- --title "Create profile edit form" \
821
- --agent "@claude:sonnet" \
822
- --seq 5 \
823
- --desc "React component with form validation and avatar preview"
824
-
825
- # Testing - @copilot excels at test generation
826
- node wbs.js job add wbs-5 \
827
- --title "Write comprehensive tests" \
828
- --agent "@copilot" \
829
- --seq 6 \
830
- --desc "Unit tests for API, integration tests, and React Testing Library tests"
831
-
832
- # 3. Run the entire pipeline
833
- node wbs.js job run wbs-5
834
- ```
835
-
836
- **Agent selection rationale:**
837
- - `@claude:sonnet`: Complex logic, architecture, React components
838
- - `@claude:opus`: Very complex architectural decisions
839
- - `@copilot`: Straightforward implementation, test generation
840
- - `@gemini`: Performance optimization, data analysis (not shown here)
841
-
842
- ---
843
-
844
- ### Example 6: Working with Detail Documents
845
-
846
- Use detail documents to provide comprehensive context to all jobs.
847
-
848
- ```bash
849
- # 1. Create project with detail document
850
- node wbs.js create "E-commerce Checkout Flow" --detail ./docs/checkout-spec.md
851
-
852
- # The system creates: skills/wbs/details/wbs-6-detail.md
853
- ```
854
-
855
- **Edit the detail document:**
856
-
857
- ```bash
858
- # Edit skills/wbs/details/wbs-6-detail.md
859
- ```
860
-
861
- **Content:**
862
- ```markdown
863
- # E-commerce Checkout Flow
864
-
865
- ## Overview
866
- Implement a secure checkout process for our e-commerce platform.
867
-
868
- ## Requirements
869
-
870
- ### Functional Requirements
871
- 1. Multi-step checkout (cart -> shipping -> payment -> confirmation)
872
- 2. Address validation with autocomplete
873
- 3. Multiple payment methods (credit card, PayPal)
874
- 4. Order summary with promo codes
875
- 5. Email confirmation
876
-
877
- ### Technical Requirements
878
- - Payment processing via Stripe
879
- - Address validation via Google Maps API
880
- - Session management for cart persistence
881
- - Transactional email via SendGrid
882
-
883
- ### Security
884
- - PCI compliance for credit card handling
885
- - HTTPS only
886
- - CSRF protection
887
- - Rate limiting on payment endpoints
888
-
889
- ### Performance
890
- - Checkout flow should complete in < 3 seconds
891
- - Optimize for mobile devices
892
-
893
- ## References
894
- - [Stripe API Docs](https://stripe.com/docs/api)
895
- - [Design Mockups](./figma-link)
896
- ```
897
-
898
- **Add jobs:**
899
- ```bash
900
- node wbs.js job add wbs-6 \
901
- --title "Implement multi-step form navigation" \
902
- --agent "@claude:sonnet" \
903
- --seq 1
904
-
905
- node wbs.js job add wbs-6 \
906
- --title "Integrate Stripe payment" \
907
- --agent "@copilot" \
908
- --seq 2
909
-
910
- # ... more jobs
911
- ```
912
-
913
- **When jobs run, they automatically receive the detail document content as context.**
914
-
915
- ---
916
-
917
- ### Example 7: Monitoring and JSON Output
918
-
919
- Automate WBS monitoring and integrate with other tools.
920
-
921
- **Check project status programmatically:**
922
- ```bash
923
- # Get JSON output for scripting
924
- node wbs.js status wbs-1 --json | jq '.summary'
925
- ```
926
-
927
- **Output:**
928
- ```json
929
- {
930
- "total_jobs": 4,
931
- "completed": 4,
932
- "failed": 0,
933
- "pending": 0,
934
- "running": 0,
935
- "progress": 100
936
- }
937
- ```
938
-
939
- **Create a monitoring script:**
940
- ```bash
941
- #!/bin/bash
942
- # monitor-wbs.sh
943
-
944
- WBS_ID="wbs-7"
945
-
946
- while true; do
947
- clear
948
- echo "======================================="
949
- echo " WBS Monitor - $WBS_ID"
950
- echo "======================================="
951
-
952
- node wbs.js status $WBS_ID
953
-
954
- PROGRESS=$(node wbs.js status $WBS_ID --json | jq -r '.summary.progress')
955
-
956
- if [ "$PROGRESS" -eq 100 ]; then
957
- echo ""
958
- echo "[OK] Project complete!"
959
- break
960
- fi
961
-
962
- echo ""
963
- echo "[WAIT] Checking again in 60 seconds..."
964
- sleep 60
965
- done
966
- ```
967
-
968
- **Run monitor:**
969
- ```bash
970
- chmod +x monitor-wbs.sh
971
- ./monitor-wbs.sh
972
- ```
973
-
974
- **Export jobs to CSV:**
975
- ```bash
976
- # Export job list
977
- echo "ID,Title,Status,Agent,Seq" > jobs-export.csv
978
- node wbs.js job list wbs-1 --json | \
979
- jq -r '.[] | [.id,.title,.status,.agent,.seq] | @csv' >> jobs-export.csv
980
- ```
981
-
982
- **Check specific job execution history:**
983
- ```bash
984
- # List all executions for a job
985
- node wbs.js exec list job-5 --json | jq '.'
986
- ```
987
-
988
- ---
989
-
990
- ### Example 8: Recovering from Interruptions
991
-
992
- Handle scenarios where execution is interrupted.
993
-
994
- **Scenario**: Long-running project interrupted by system crash
995
-
996
- ```bash
997
- # 1. Check current status
998
- node wbs.js list
999
- ```
1000
-
1001
- **Output:**
1002
- ```
1003
- [INFO] WBS Projects (3)
1004
-
1005
- | ID | Title | Status | Progress |
1006
- |-------|-----------------------|----------|----------|
1007
- | wbs-1 | Todo REST API | completed| 100% 4/4 |
1008
- | wbs-2 | Bug Fixes | running | 50% 2/4 |
1009
- | wbs-3 | Refactoring | planning | 0% 0/5 |
1010
- ```
1011
-
1012
- ```bash
1013
- # 2. Check which jobs were running
1014
- node wbs.js status wbs-2
1015
- ```
1016
-
1017
- **Output:**
1018
- ```
1019
- [INFO] Bug Fixes (wbs-2)
1020
- Status: running | Progress: 50% (2/4)
1021
-
1022
- Jobs:
1023
- | Status | # | ID | Task | Status |
1024
- |--------|----|----|---------------|-----------|
1025
- | [OK] | 1 | job-1 | Fix bug #123 | completed |
1026
- | [OK] | 2 | job-2 | Fix bug #124 | completed |
1027
- | [~] | 3 | job-3 | Fix bug #125 | running |
1028
- | [ ] | 4 | job-4 | Fix bug #126 | pending |
1029
- ```
1030
-
1031
- ```bash
1032
- # 3. Check if the running job actually completed
1033
- node wbs.js exec list job-3
1034
- ```
1035
-
1036
- **If the execution failed or timed out:**
1037
- ```
1038
- | Status | ID | PID | Start | End | Code |
1039
- |--------|---------|-------|---------------------|---------------------|------|
1040
- | [BAD] | exec-7 | 23456 | 2025-12-18 10:30:00 | N/A (timeout) | -1 |
1041
- ```
1042
-
1043
- ```bash
1044
- # 4. Reset the job and retry
1045
- node wbs.js job update job-3 --status pending
1046
- node wbs.js job retry job-3
1047
-
1048
- # 5. Continue with remaining jobs
1049
- node wbs.js job run wbs-2
1050
- ```
1051
-
1052
- ---
1053
-
1054
- ### Summary: Quick Command Reference
1055
-
1056
- **Basic workflow:**
1057
- ```bash
1058
- # Create -> Add -> Run -> Check
1059
- node wbs.js create "Project Name"
1060
- node wbs.js job add wbs-X --title "Task" --agent "@agent" --seq N
1061
- node wbs.js job run wbs-X
1062
- node wbs.js status wbs-X
1063
- ```
1064
-
1065
- **Issue-based workflow:**
1066
- ```bash
1067
- node wbs.js create "Bug Fixes"
1068
- node wbs.js job add wbs-X --title "Fix bug" --agent "@agent" --issue 123
1069
- node wbs.js job run wbs-X
1070
- ```
1071
-
1072
- **Step-by-step workflow:**
1073
- ```bash
1074
- node wbs.js job next wbs-X # Run one job
1075
- # Review changes...
1076
- node wbs.js job next wbs-X # Run next
1077
- ```
1078
-
1079
- **Handle failures (job-id or slug):**
1080
- ```bash
1081
- node wbs.js job list wbs-X --json | jq '.[] | select(.status=="failed")'
1082
- node wbs.js job update wbs-X-Y --desc "Updated instructions" # by slug
1083
- node wbs.js job retry wbs-X-Y # by slug
1084
- node wbs.js job retry job-Y # by job-id
1085
- ```
1086
-
1087
- **Monitoring:**
1088
- ```bash
1089
- node wbs.js list
1090
- node wbs.js status wbs-X
1091
- node wbs.js status wbs-X --json | jq '.summary'
1092
- ```
1093
-
1094
- For more examples, see:
1095
- - [EXAMPLE.md](./EXAMPLE.md) - Korean language detailed walkthrough
1096
- - [job-management.md](./job-management.md) - Job-specific examples and patterns
1097
-
1098
- ## Usage in Coordinator Agent
1099
-
1100
- The coordinator agent uses this skill programmatically:
1101
-
1102
- ```javascript
1103
- const wbs = require('./wbs.js');
1104
-
1105
- // 1. Create project
1106
- const id = wbs.create('User Authentication Implementation');
1107
-
1108
- // 2. Add jobs (AI decomposed)
1109
- wbs.addJob(id, { title: 'Design User model', agent: '@claude:sonnet', seq: 1 });
1110
- wbs.addJob(id, { title: 'Implement login API', agent: '@copilot', seq: 2 });
1111
- wbs.addJob(id, { title: 'Write tests', agent: '@claude:sonnet', seq: 3 });
1112
-
1113
- // 3. Execute
1114
- await wbs.run(id);
1115
-
1116
- // 4. Check status
1117
- console.log(wbs.status(id));
1118
- ```
1119
-
1120
- ## Job Status Flow
1121
-
1122
- ```
1123
- pending -> running -> completed
1124
- -> failed
1125
- ```
1126
-
1127
- ## Key Design Decisions
1128
-
1129
- 1. **AI makes intelligent decisions** - Complexity analysis, job decomposition
1130
- 2. **Code handles state only** - wbs.js does DB CRUD + worker execution
1131
- 3. **30-minute timeboxing** - Each job is 15-45 minutes
1132
- 4. **Start simple, improve iteratively** - MVP first
1133
-
1134
- ## API Reference
1135
-
1136
- ### Project Management
1137
-
1138
- #### `wbs.create(title, options?)`
1139
- Create a new WBS project. Returns project ID.
1140
- - `options.detailPath`: Path to detail document (auto-created if not specified)
1141
-
1142
- #### `wbs.list()`
1143
- List all WBS projects.
1144
-
1145
- #### `wbs.status(wbsId)`
1146
- Get project and all jobs status.
1147
-
1148
- #### `wbs.delete(wbsId)`
1149
- Delete a project and all associated jobs/executions.
1150
-
1151
- ### Job Management
1152
-
1153
- #### `wbs.addJob(wbsId, { title, description?, agent, seq?, issue_number? })`
1154
- Add a job to the project. Returns job ID.
1155
- - `title`: Job title (short name)
1156
- - `description`: Detailed instructions for the agent
1157
- - `agent`: Worker agent mention (e.g., `@crewx_claude_dev`)
1158
- - `seq`: Execution order (default: 0)
1159
- - `issue_number`: Related GitHub issue number
1160
-
1161
- #### `wbs.getNextJob(wbsId)`
1162
- Get the next pending job. Returns job object or null.
1163
-
1164
- #### `wbs.updateJob(jobId, status)`
1165
- Update job status. Status: `pending`, `running`, `completed`, `failed`.
1166
-
1167
- #### `wbs.runWorker(job)`
1168
- Execute a single worker. Returns `{ success, error?, execId }`.
1169
-
1170
- #### `wbs.run(wbsId)`
1171
- Execute all pending jobs sequentially.
1172
-
1173
- ### Execution Management
1174
-
1175
- #### `wbs.createExecution(jobId, pid)`
1176
- Create a new execution record. Returns execution ID.
1177
-
1178
- #### `wbs.updateExecution(execId, status, options?)`
1179
- Update execution status.
1180
- - `options.exitCode`: Process exit code
1181
- - `options.error`: Error message
1182
-
1183
- #### `wbs.getExecution(execId)`
1184
- Get execution by ID.
1185
-
1186
- #### `wbs.listExecutions(jobId)`
1187
- List all executions for a job.
1188
-
1189
- #### `wbs.killExecution(execId)`
1190
- Kill a running execution. Returns boolean success.
1191
-
1192
- #### `wbs.getRunningExecutions()`
1193
- Get all currently running executions.
1194
-
1195
- ## Related Documentation
1196
-
1197
- - [WBS Skill Spec](/docs/cto/designs/wbs-skill-spec.md)
1198
- - [CrewX CLI Documentation](/packages/cli/AGENTS.md)
1
+ ---
2
+ name: crewx/wbs
3
+ description: Work Breakdown Structure (WBS) management skill. Enables AI coordinators to decompose complex tasks into 30-minute timeboxed jobs and execute them via worker agents.
4
+ metadata:
5
+ version: 0.3.0
6
+ built-in: true
7
+ ---
8
+
9
+ # WBS Skill
10
+
11
+ Provides state management and worker execution for Work Breakdown Structure based task decomposition.
12
+
13
+ ## Core Principle
14
+
15
+ **System provides state management, AI agent makes intelligent decisions.**
16
+
17
+ ```
18
+ User Request
19
+ |
20
+ v
21
+ +-----------------------------------------------------+
22
+ | Coordinator Agent (with WBS skill) |
23
+ | - Analyze request (AI judgment) |
24
+ | - Decompose into 30-min Jobs (AI judgment) |
25
+ | - Execute workers: crewx x "@agent action" |
26
+ | - Track state: wbs.js |
27
+ +-----------------------------------------------------+
28
+ |
29
+ +---------------+--------------+
30
+ v v v
31
+ +---------+ +---------+ +---------+
32
+ | Worker1 | | Worker2 | | Worker3 |
33
+ | @claude | | @gemini | | @copilot|
34
+ +---------+ +---------+ +---------+
35
+ ```
36
+
37
+ ## What is WBS Skill?
38
+
39
+ The WBS (Work Breakdown Structure) skill is a **project management system for complex AI-driven tasks**. It enables coordinator agents to:
40
+
41
+ 1. **Decompose complex tasks** into manageable 30-minute jobs
42
+ 2. **Track progress** with state management (pending -> running -> completed/failed)
43
+ 3. **Coordinate multiple agents** by assigning different jobs to specialized workers
44
+ 4. **Manage context** through detail documents and structured workflow
45
+ 5. **Execute in parallel** by distributing jobs across multiple worker agents
46
+
47
+ ### Key Characteristics
48
+
49
+ - **Structured Approach**: Projects are broken down into jobs with clear status tracking
50
+ - **Time-Boxed Execution**: Each job targets 15-45 minutes (optimal: 25-30 min)
51
+ - **Multi-Agent Coordination**: Different jobs can be assigned to different AI agents
52
+ - **State Persistence**: All project data, jobs, and execution history are tracked in `.wbs-data.json`
53
+ - **Automated Workflow**: Git branching, PR templates, and issue tracking integration
54
+ - **Job Slug System**: Jobs are identified by intuitive slugs (`wbs-5-1`, `wbs-5-2`) computed from `wbs_id + seq`
55
+ - **Auto-generated Detail Files**: `job add` automatically generates/updates `wbs-details/wbs-{N}-detail.md` with job metadata
56
+
57
+ ## Job Slug System
58
+
59
+ Each job gets a **slug** computed from its WBS ID and sequence number: `wbs-{N}-{seq}`
60
+
61
+ | Internal ID | Slug | Meaning |
62
+ |------------|------|---------|
63
+ | `job-15` | `wbs-5-1` | 1st Job of WBS-5 |
64
+ | `job-16` | `wbs-5-2` | 2nd Job of WBS-5 |
65
+ | `job-17` | `wbs-5-3` | 3rd Job of WBS-5 |
66
+
67
+ - Slugs are **computed values** (not stored in DB) -- derived from `wbs_id` + `seq`
68
+ - All commands accepting `<job-id>` also accept `<slug>`: `wbs job update wbs-5-1 --status completed`
69
+ - Git branches use slug naming: `feature/wbs-5-1`
70
+ - Worktree directories align with slug naming
71
+
72
+ ## When to Use WBS Skill
73
+
74
+ ### Use WBS When
75
+
76
+ Choose WBS for tasks that meet **any** of these criteria:
77
+
78
+ - **Complex multi-step tasks** (> 45 minutes total)
79
+ - Feature implementations spanning multiple files/modules
80
+ - Large-scale refactoring projects
81
+ - Bug fix sprints with multiple related issues
82
+
83
+ - **30-minute timeboxing needed**
84
+ - Tasks prone to context loss (LLM "Lost in the Middle" problem)
85
+ - Work requiring periodic checkpoints and validation
86
+ - Projects where partial progress needs to be tracked
87
+
88
+ - **Parallel execution beneficial**
89
+ - Jobs that can be distributed across multiple worker agents
90
+ - Tasks where different agents excel at different subtasks
91
+ - Work that benefits from concurrent execution
92
+
93
+ - **Progress tracking important**
94
+ - Team collaboration requiring visibility into task status
95
+ - Projects with external stakeholders needing updates
96
+ - Work where partial failure recovery is critical
97
+
98
+ - **GitHub integration needed**
99
+ - Tasks linked to GitHub issues
100
+ - Projects requiring structured PR workflows
101
+ - Work following standardized git branching strategies
102
+
103
+ ### Use Direct Delegation When
104
+
105
+ Skip WBS for simpler scenarios:
106
+
107
+ - Single-step tasks (< 15 minutes)
108
+ - One-off file modifications
109
+ - Quick code analysis or queries
110
+ - Rapid prototyping without tracking needs
111
+ - Tasks with no need for state persistence
112
+
113
+ ### Decision Flow
114
+
115
+ ```
116
+ Task received
117
+ |
118
+ v
119
+ Expected duration?
120
+ |
121
+ +--- < 15 min ----------------------> Direct Delegation
122
+ |
123
+ +--- 15-45 min -+- Single step ------> Direct Delegation
124
+ | +- Multi-step --------> WBS Skill
125
+ |
126
+ +--- > 45 min ----------------------> WBS Skill (required)
127
+ ```
128
+
129
+ ## Use Case Examples
130
+
131
+ ### 1. Complex Feature Implementation
132
+
133
+ **Scenario**: Implement user authentication system
134
+
135
+ ```bash
136
+ # WBS approach - structured and tracked
137
+ wbs.js create "User Authentication Implementation"
138
+ wbs.js job add wbs-1 --title "Design User model" --agent "@claude:sonnet" --seq 1
139
+ wbs.js job add wbs-1 --title "Implement login API" --agent "@copilot" --seq 2
140
+ wbs.js job add wbs-1 --title "Add JWT handling" --agent "@copilot" --seq 3
141
+ wbs.js job add wbs-1 --title "Write unit tests" --agent "@claude:sonnet" --seq 4
142
+ wbs.js job run wbs-1
143
+ ```
144
+
145
+ **Why WBS**: Multi-step process, multiple agents, progress tracking needed
146
+
147
+ ### 2. Bug Fix Sprint
148
+
149
+ **Scenario**: Fix multiple related authentication bugs
150
+
151
+ ```bash
152
+ # WBS approach - organized issue resolution
153
+ wbs.js create "Bug Fix Sprint"
154
+ wbs.js job add wbs-2 --title "Fix login bug" --agent "@claude" --issue 42 --seq 1
155
+ wbs.js job add wbs-2 --title "Fix session timeout" --agent "@claude" --issue 43 --seq 2
156
+ wbs.js job add wbs-2 --title "Fix password reset" --agent "@claude" --issue 44 --seq 3
157
+ wbs.js job run wbs-2
158
+ ```
159
+
160
+ **Why WBS**: Multiple issues, GitHub integration, failure recovery important
161
+
162
+ ### 3. Large Refactoring
163
+
164
+ **Scenario**: Refactor API layer across multiple modules
165
+
166
+ ```bash
167
+ # WBS approach - context preservation across modules
168
+ wbs.js create "API Refactoring"
169
+ wbs.js job add wbs-3 --title "Refactor auth module" --agent "@claude" --seq 1
170
+ wbs.js job add wbs-3 --title "Refactor user module" --agent "@claude" --seq 2
171
+ wbs.js job add wbs-3 --title "Update tests" --agent "@copilot" --seq 3
172
+ wbs.js job run wbs-3
173
+ ```
174
+
175
+ **Why WBS**: Context preservation critical, step-by-step validation needed
176
+
177
+ ### 4. Simple Code Fix (No WBS)
178
+
179
+ **Scenario**: Fix a typo in documentation
180
+
181
+ ```bash
182
+ # Direct delegation - immediate execution
183
+ crewx x "@claude Fix typo in README.md line 42"
184
+ ```
185
+
186
+ **Why Direct**: Single-step, < 15 minutes, no tracking needed
187
+
188
+ ## 30-Minute Timeboxing
189
+
190
+ | Category | Time | Description |
191
+ |----------|------|-------------|
192
+ | Minimum | 15 min | Below this -> don't separate as Job |
193
+ | Optimal | 25-30 min | Target duration |
194
+ | Maximum | 45 min | Above this -> re-decompose |
195
+
196
+ **Rationale**: LLM context limits (Lost in the Middle, Context Rot) + Pomodoro Technique
197
+
198
+ ## WARNING: Job Description Template (MANDATORY)
199
+
200
+ **All Jobs must follow the template below.** Vague Job Descriptions are a leading cause of incomplete work.
201
+
202
+ ### Template
203
+
204
+ ```markdown
205
+ **Deliverables:**
206
+ 1. path/to/file1.tsx - description
207
+ 2. path/to/file2.ts - description
208
+ 3. Modify existing file: path/to/existing.tsx
209
+
210
+ **Done Criteria:**
211
+ - [ ] Verify component rendering
212
+ - [ ] Verify store integration works
213
+ - [ ] Verify route addition and navigation
214
+
215
+ **References:**
216
+ - docs/ui-screens/screens/XX.md
217
+ - Wireframe/design links
218
+ ```
219
+
220
+ ### Usage Example
221
+
222
+ ```bash
223
+ # [BAD] BAD - Vague Job Description
224
+ node wbs.js job add wbs-1 \
225
+ --title "Agent settings screen" \
226
+ --desc "Display crewx.yaml agent list. Model/provider/prompt editing UI." \
227
+ --agent "@launcher_gemini_dev"
228
+
229
+ # [OK] GOOD - Clear deliverables and done criteria
230
+ node wbs.js job add wbs-1 \
231
+ --title "Agent settings screen" \
232
+ --desc "**Deliverables:**
233
+ 1. src/renderer/components/AgentConfig/AgentConfigPage.tsx - Agent list page
234
+ 2. src/renderer/components/AgentConfig/AgentEditModal.tsx - Edit modal
235
+ 3. src/renderer/App.tsx - Add /agents route
236
+ 4. src/renderer/components/Layout/Sidebar.tsx - Add menu item
237
+
238
+ **Done Criteria:**
239
+ - [ ] Agent list displays when navigating to /agents
240
+ - [ ] Edit modal opens on button click
241
+ - [ ] Changes saved to crewx.yaml on save
242
+
243
+ **References:** docs/ui-screens/screens/03-agent.md" \
244
+ --agent "@launcher_gemini_dev"
245
+ ```
246
+
247
+ ### Why Is This Mandatory?
248
+
249
+ | Problem | Vague Job Description | With Template |
250
+ |---------|----------------------|---------------|
251
+ | **Scope interpretation** | Agent interprets arbitrarily | Clear file list |
252
+ | **Completion judgment** | Manual "done" marking | Checklist verification |
253
+ | **Preventing omissions** | Only Store without UI | All deliverables specified |
254
+ | **Review ease** | Unclear what to verify | Checklist-based review |
255
+
256
+ ### Integration Test Job Template
257
+
258
+ Integration test Jobs must specify verification items in detail:
259
+
260
+ ```bash
261
+ node wbs.js job add wbs-1 \
262
+ --title "Integration test" \
263
+ --desc "**Verification Scenarios:**
264
+ 1. Onboarding -> Preset selection -> Installation complete
265
+ 2. Dashboard -> Agent list displays
266
+ 3. Agent settings -> Edit -> Save
267
+
268
+ **Verification Methods:**
269
+ - [ ] Manual execution of each scenario
270
+ - [ ] Screenshot capture (using skills/playwright-python)
271
+ - [ ] Error log inspection
272
+
273
+ **Pass Criteria:**
274
+ - All scenarios work correctly
275
+ - No console errors" \
276
+ --agent "@launcher_codex_dev"
277
+ ```
278
+
279
+ ## Installation
280
+
281
+ ```bash
282
+ cd skills/wbs
283
+ npm install
284
+ ```
285
+
286
+ Requires Node.js 16+.
287
+
288
+ ## Commands Reference
289
+
290
+ ### Project Management Commands
291
+
292
+ | Command | Syntax | Description |
293
+ |---------|--------|-------------|
294
+ | **create** | `wbs.js create "Title" [--detail path]` | Create new WBS project with sequential ID (wbs-1, wbs-2, ...) |
295
+ | **list** | `wbs.js list [--json]` | List all projects with status and progress |
296
+ | **status** | `wbs.js status <wbs-id> [--json]` | Get detailed project info including all jobs and summary stats |
297
+ | **delete** | `wbs.js delete <wbs-id>` | Delete project and all associated jobs/executions (irreversible) |
298
+
299
+ ### Job Management Commands
300
+
301
+ | Command | Syntax | Description |
302
+ |---------|--------|-------------|
303
+ | **job add** | `wbs.js job add <wbs-id> --title "Title" --agent "@agent" [options]` | Add new job to project. Options: `--desc`, `--seq`, `--issue` |
304
+ | **job list** | `wbs.js job list <wbs-id> [--json]` | List all jobs ordered by sequence number |
305
+ | **job update** | `wbs.js job update <job-id\|slug> [options]` | Update job properties. Options: `--status`, `--title`, `--desc`, `--agent`, `--seq`, `--issue` |
306
+ | **job run** | `wbs.js job run <wbs-id>` | Execute all pending jobs sequentially (30-min timeout each) |
307
+ | **job next** | `wbs.js job next <wbs-id>` | Execute only the next pending job (manual step-by-step) |
308
+ | **job retry** | `wbs.js job retry <job-id\|slug>` | Retry a failed or completed job |
309
+
310
+ ### Execution Management Commands
311
+
312
+ | Command | Syntax | Description |
313
+ |---------|--------|-------------|
314
+ | **exec list** | `wbs.js exec list <job-id\|slug> [--json]` | List execution history for a job |
315
+ | **exec status** | `wbs.js exec status <exec-id> [--json]` | Get detailed execution info |
316
+ | **exec kill** | `wbs.js exec kill <exec-id>` | Kill a running execution |
317
+ | **exec running** | `wbs.js exec running [--json]` | List all currently running executions |
318
+
319
+ ### Coordinator Commands (Natural Language)
320
+
321
+ | Command | Syntax | Description |
322
+ |---------|--------|-------------|
323
+ | **q** | `wbs.js q "question"` | Ask coordinator a question (via `@wbs_coordinator`) |
324
+ | **x** | `wbs.js x "request"` | Request coordinator to execute an action |
325
+
326
+ ### Daemon Commands (Background Scheduler)
327
+
328
+ | Command | Syntax | Description |
329
+ |---------|--------|-------------|
330
+ | **daemon start** | `wbs.js daemon start` | Start background scheduler |
331
+ | **daemon stop** | `wbs.js daemon stop` | Stop running daemon |
332
+ | **daemon status** | `wbs.js daemon status` | Check daemon status |
333
+ | **daemon tick** | `wbs.js daemon tick` | Manual tick for testing |
334
+
335
+ ### Common Usage Patterns
336
+
337
+ ```bash
338
+ # Create and run a complete project
339
+ wbs.js create "User Authentication"
340
+ wbs.js job add wbs-1 --title "Design schema" --agent "@claude:sonnet" --seq 1
341
+ wbs.js job add wbs-1 --title "Implement API" --agent "@copilot" --seq 2
342
+ wbs.js job add wbs-1 --title "Write tests" --agent "@claude:sonnet" --seq 3
343
+ wbs.js job run wbs-1
344
+
345
+ # Check progress
346
+ wbs.js status wbs-1
347
+
348
+ # Handle failures (use job-id or slug)
349
+ wbs.js job list wbs-1 --json | jq '.[] | select(.status=="failed")'
350
+ wbs.js job retry wbs-1-3 # by slug
351
+ wbs.js job retry job-5 # by job-id
352
+
353
+ # Issue-based workflow
354
+ wbs.js job add wbs-2 --title "Fix bug" --agent "@claude" --issue 42
355
+ ```
356
+
357
+ ### Output Formats
358
+
359
+ - **Default**: Human-readable tables with emoji status icons
360
+ - **--json**: Machine-parseable JSON for scripting and automation
361
+
362
+ For detailed command documentation, see:
363
+ - [COMMANDS.md](./COMMANDS.md) - Complete project commands reference
364
+ - [job-management.md](./job-management.md) - Comprehensive job management guide
365
+
366
+ ## Practical Usage Examples
367
+
368
+ This section provides comprehensive real-world examples of using the WBS skill effectively.
369
+
370
+ ### Example 1: Simple Workflow (Create -> Add Jobs -> Run)
371
+
372
+ The most basic WBS workflow involves creating a project, adding jobs, and running them sequentially.
373
+
374
+ **Scenario**: Build a simple REST API for a todo application
375
+
376
+ ```bash
377
+ # 1. Create the project
378
+ node wbs.js create "Todo REST API"
379
+ ```
380
+
381
+ **Expected output:**
382
+ ```json
383
+ {
384
+ "id": "wbs-1",
385
+ "title": "Todo REST API",
386
+ "status": "planning",
387
+ "detailPath": "skills/wbs/details/wbs-1-detail.md",
388
+ "created_at": "2025-12-18T08:00:00.000Z"
389
+ }
390
+ ```
391
+
392
+ ```bash
393
+ # 2. Add jobs for implementation
394
+ node wbs.js job add wbs-1 \
395
+ --title "Design database schema" \
396
+ --agent "@claude:sonnet" \
397
+ --seq 1 \
398
+ --desc "Create SQLite schema for todos table with id, title, completed, created_at fields"
399
+
400
+ node wbs.js job add wbs-1 \
401
+ --title "Implement CRUD endpoints" \
402
+ --agent "@copilot" \
403
+ --seq 2 \
404
+ --desc "Create Express routes: GET /todos, POST /todos, PUT /todos/:id, DELETE /todos/:id"
405
+
406
+ node wbs.js job add wbs-1 \
407
+ --title "Add input validation" \
408
+ --agent "@claude:sonnet" \
409
+ --seq 3 \
410
+ --desc "Implement request validation middleware using express-validator"
411
+
412
+ node wbs.js job add wbs-1 \
413
+ --title "Write integration tests" \
414
+ --agent "@copilot" \
415
+ --seq 4 \
416
+ --desc "Create test suite covering all CRUD operations using supertest"
417
+ ```
418
+
419
+ ```bash
420
+ # 3. Review the planned jobs
421
+ node wbs.js status wbs-1
422
+ ```
423
+
424
+ **Expected output:**
425
+ ```
426
+ [INFO] Todo REST API (wbs-1)
427
+ Status: planning | Progress: 0% (0/4)
428
+ Detail: skills/wbs/details/wbs-1-detail.md
429
+
430
+ Jobs:
431
+ | Status | # | Slug | ID | Task | Agent |
432
+ |--------|----|-----------|-------|--------------------------|-----------------|
433
+ | [ ] | 1 | wbs-1-1 | job-1 | Design database schema | @claude:sonnet |
434
+ | [ ] | 2 | wbs-1-2 | job-2 | Implement CRUD endpoints | @copilot |
435
+ | [ ] | 3 | wbs-1-3 | job-3 | Add input validation | @claude:sonnet |
436
+ | [ ] | 4 | wbs-1-4 | job-4 | Write integration tests | @copilot |
437
+ ```
438
+
439
+ ```bash
440
+ # 4. Run all jobs
441
+ node wbs.js job run wbs-1
442
+ ```
443
+
444
+ **Expected output:**
445
+ ```
446
+ ==================================================
447
+ [WBS] Starting project: Todo REST API
448
+ ==================================================
449
+
450
+ [WBS] Running job: Design database schema
451
+ [WBS] Agent: @claude:sonnet
452
+ [WBS] Description: Create SQLite schema for todos table...
453
+ [WBS] Timeout: 30 minutes
454
+ --------------------------------------------------
455
+ [Agent executes and produces output...]
456
+ --------------------------------------------------
457
+ [WBS] Job completed: Design database schema
458
+
459
+ [WBS] Running job: Implement CRUD endpoints
460
+ [WBS] Agent: @copilot
461
+ [WBS] Timeout: 30 minutes
462
+ --------------------------------------------------
463
+ [Agent executes and produces output...]
464
+ --------------------------------------------------
465
+ [WBS] Job completed: Implement CRUD endpoints
466
+
467
+ [... continues for remaining jobs ...]
468
+
469
+ ==================================================
470
+ [WBS] Project completed: Todo REST API
471
+ [WBS] Completed: 4, Failed: 0
472
+ ==================================================
473
+ ```
474
+
475
+ ```bash
476
+ # 5. Verify completion
477
+ node wbs.js status wbs-1
478
+ ```
479
+
480
+ **Final output:**
481
+ ```
482
+ [INFO] Todo REST API (wbs-1)
483
+ Status: completed | Progress: 100% (4/4)
484
+ Detail: skills/wbs/details/wbs-1-detail.md
485
+
486
+ Jobs:
487
+ | Status | # | Slug | ID | Task | Agent | Status |
488
+ |--------|----|-----------|-------|--------------------------|-----------------|-----------|
489
+ | [OK] | 1 | wbs-1-1 | job-1 | Design database schema | @claude:sonnet | completed |
490
+ | [OK] | 2 | wbs-1-2 | job-2 | Implement CRUD endpoints | @copilot | completed |
491
+ | [OK] | 3 | wbs-1-3 | job-3 | Add input validation | @claude:sonnet | completed |
492
+ | [OK] | 4 | wbs-1-4 | job-4 | Write integration tests | @copilot | completed |
493
+ ```
494
+
495
+ ---
496
+
497
+ ### Example 2: Issue-Based Workflow
498
+
499
+ Use WBS to manage multiple GitHub issues systematically.
500
+
501
+ **Scenario**: Fix authentication-related bugs tracked in GitHub
502
+
503
+ ```bash
504
+ # 1. Create project for bug fixes
505
+ node wbs.js create "Authentication Bug Fixes"
506
+ ```
507
+
508
+ **Output:**
509
+ ```json
510
+ {
511
+ "id": "wbs-2",
512
+ "title": "Authentication Bug Fixes",
513
+ "status": "planning"
514
+ }
515
+ ```
516
+
517
+ ```bash
518
+ # 2. Add jobs linked to GitHub issues
519
+ node wbs.js job add wbs-2 \
520
+ --title "Fix: Login fails with special characters in password" \
521
+ --agent "@claude:sonnet" \
522
+ --issue 123 \
523
+ --seq 1
524
+
525
+ node wbs.js job add wbs-2 \
526
+ --title "Fix: Session timeout not working" \
527
+ --agent "@claude:sonnet" \
528
+ --issue 124 \
529
+ --seq 2
530
+
531
+ node wbs.js job add wbs-2 \
532
+ --title "Fix: Password reset email not sent" \
533
+ --agent "@claude:sonnet" \
534
+ --issue 125 \
535
+ --seq 3
536
+ ```
537
+
538
+ **What happens during execution:**
539
+
540
+ When you run `node wbs.js job run wbs-2`, each job receives these instructions:
541
+
542
+ ```
543
+ ## Task Instructions
544
+ Process GitHub Issue #123.
545
+
546
+ **Follow your existing development process:**
547
+ 1. Check the issue with `gh issue view 123`
548
+ 2. Create branch and work
549
+ 3. Create PR
550
+ 4. Comment results on the issue
551
+
552
+ WBS Tracking Info:
553
+ - WBS: wbs-2
554
+ - Job: job-1
555
+ ```
556
+
557
+ **Advantages:**
558
+ - Automatic issue-branch-PR linking
559
+ - Agent follows its own development workflow
560
+ - Easy progress tracking via GitHub
561
+ - Issue comments document resolution
562
+
563
+ ---
564
+
565
+ ### Example 3: Step-by-Step Execution
566
+
567
+ Execute jobs manually one at a time with review between each step.
568
+
569
+ **Scenario**: Refactoring legacy code where each step needs verification
570
+
571
+ ```bash
572
+ # 1. Create project
573
+ node wbs.js create "Legacy Code Refactoring"
574
+
575
+ # 2. Add jobs
576
+ node wbs.js job add wbs-3 \
577
+ --title "Extract UserService from monolithic controller" \
578
+ --agent "@claude:opus" \
579
+ --seq 1 \
580
+ --desc "Move user-related logic from AppController to new UserService class"
581
+
582
+ node wbs.js job add wbs-3 \
583
+ --title "Add dependency injection" \
584
+ --agent "@claude:sonnet" \
585
+ --seq 2 \
586
+ --desc "Refactor UserService to use constructor injection for database"
587
+
588
+ node wbs.js job add wbs-3 \
589
+ --title "Update unit tests" \
590
+ --agent "@copilot" \
591
+ --seq 3 \
592
+ --desc "Modify tests to work with new UserService architecture"
593
+
594
+ node wbs.js job add wbs-3 \
595
+ --title "Verify integration tests pass" \
596
+ --agent "@copilot" \
597
+ --seq 4 \
598
+ --desc "Run full test suite and fix any integration issues"
599
+ ```
600
+
601
+ ```bash
602
+ # 3. Execute first job only
603
+ node wbs.js job next wbs-3
604
+ ```
605
+
606
+ **Output:**
607
+ ```
608
+ [WBS] Running job: Extract UserService from monolithic controller
609
+ [WBS] Agent: @claude:opus
610
+ [WBS] Timeout: 30 minutes
611
+ --------------------------------------------------
612
+ [Agent output...]
613
+ --------------------------------------------------
614
+ [WBS] Job completed: Extract UserService from monolithic controller
615
+
616
+ {
617
+ "success": true,
618
+ "execId": "exec-1"
619
+ }
620
+ ```
621
+
622
+ ```bash
623
+ # 4. Review changes before continuing
624
+ git diff
625
+ npm test
626
+
627
+ # 5. If satisfied, run next job
628
+ node wbs.js job next wbs-3
629
+ ```
630
+
631
+ **Output:**
632
+ ```
633
+ [WBS] Running job: Add dependency injection
634
+ [WBS] Agent: @claude:sonnet
635
+ ...
636
+ ```
637
+
638
+ ```bash
639
+ # 6. Continue step by step
640
+ node wbs.js status wbs-3 # Check progress
641
+ node wbs.js job next wbs-3 # Run next job
642
+ ```
643
+
644
+ **Use cases for step-by-step execution:**
645
+ - Code reviews between steps
646
+ - Testing after each change
647
+ - Learning/understanding the codebase
648
+ - High-risk refactoring
649
+ - Debugging job configurations
650
+
651
+ ---
652
+
653
+ ### Example 4: Handling Failures
654
+
655
+ Recover from failed jobs and retry with updated configurations.
656
+
657
+ **Scenario**: API implementation where initial attempts fail
658
+
659
+ ```bash
660
+ # 1. Create project and add jobs
661
+ node wbs.js create "Payment API Integration"
662
+
663
+ node wbs.js job add wbs-4 \
664
+ --title "Integrate Stripe SDK" \
665
+ --agent "@copilot" \
666
+ --seq 1
667
+
668
+ node wbs.js job add wbs-4 \
669
+ --title "Implement payment endpoint" \
670
+ --agent "@claude:sonnet" \
671
+ --seq 2
672
+
673
+ node wbs.js job add wbs-4 \
674
+ --title "Add webhook handler" \
675
+ --agent "@claude:sonnet" \
676
+ --seq 3
677
+
678
+ # 2. Run all jobs
679
+ node wbs.js job run wbs-4
680
+ ```
681
+
682
+ **Suppose job-2 fails:**
683
+
684
+ ```
685
+ [WBS] Running job: Implement payment endpoint
686
+ [WBS] Agent: @claude:sonnet
687
+ --------------------------------------------------
688
+ Error: Missing API key configuration
689
+ --------------------------------------------------
690
+ [WBS] Job failed: Implement payment endpoint
691
+ ```
692
+
693
+ ```bash
694
+ # 3. Check which jobs failed
695
+ node wbs.js job list wbs-4 --json | jq '.[] | select(.status=="failed")'
696
+ ```
697
+
698
+ **Output:**
699
+ ```json
700
+ {
701
+ "id": "job-2",
702
+ "wbs_id": "wbs-4",
703
+ "title": "Implement payment endpoint",
704
+ "status": "failed",
705
+ "agent": "@claude:sonnet",
706
+ "seq": 2
707
+ }
708
+ ```
709
+
710
+ ```bash
711
+ # 4. Review execution history
712
+ node wbs.js exec list job-2
713
+ ```
714
+
715
+ **Output:**
716
+ ```
717
+ [INFO] Executions for job-2
718
+
719
+ | Status | ID | PID | Start | End | Code |
720
+ |--------|---------|-------|---------------------|---------------------|------|
721
+ | [BAD] | exec-2 | 45678 | 2025-12-18 09:15:00 | 2025-12-18 09:18:00 | 1 |
722
+ ```
723
+
724
+ ```bash
725
+ # 5. Fix the issue (add environment variable or update job description)
726
+ node wbs.js job update job-2 \
727
+ --desc "Implement payment endpoint. Use STRIPE_API_KEY from .env file. Handle both test and production modes."
728
+
729
+ # 6. Retry the failed job
730
+ node wbs.js job retry job-2
731
+ ```
732
+
733
+ **Output:**
734
+ ```
735
+ [WBS] Retrying job: Implement payment endpoint
736
+ [WBS] Running job: Implement payment endpoint
737
+ [WBS] Agent: @claude:sonnet
738
+ [WBS] Timeout: 30 minutes
739
+ --------------------------------------------------
740
+ [Agent output...]
741
+ --------------------------------------------------
742
+ [WBS] Job completed: Implement payment endpoint
743
+
744
+ {
745
+ "success": true,
746
+ "execId": "exec-5"
747
+ }
748
+ ```
749
+
750
+ ```bash
751
+ # 7. Continue with remaining jobs
752
+ node wbs.js job run wbs-4
753
+ ```
754
+
755
+ **Final status:**
756
+ ```
757
+ [INFO] Payment API Integration (wbs-4)
758
+ Status: completed | Progress: 100% (3/3)
759
+
760
+ Jobs:
761
+ | Status | # | ID | Task | Status |
762
+ |--------|----|----|--------------------------|-----------|
763
+ | [OK] | 1 | job-1 | Integrate Stripe SDK | completed |
764
+ | [OK] | 2 | job-2 | Implement payment endpoint| completed |
765
+ | [OK] | 3 | job-3 | Add webhook handler | completed |
766
+ ```
767
+
768
+ **Batch retry all failed jobs:**
769
+ ```bash
770
+ # Find and retry all failed jobs in a project
771
+ for job in $(node wbs.js job list wbs-4 --json | jq -r '.[] | select(.status=="failed") | .id'); do
772
+ echo "Retrying $job..."
773
+ node wbs.js job retry $job
774
+ done
775
+ ```
776
+
777
+ ---
778
+
779
+ ### Example 5: Complex Multi-Agent Coordination
780
+
781
+ Distribute work across different AI agents based on their strengths.
782
+
783
+ **Scenario**: Build a full-stack feature with frontend, backend, and tests
784
+
785
+ ```bash
786
+ # 1. Create project
787
+ node wbs.js create "User Profile Feature"
788
+
789
+ # 2. Add jobs with appropriate agent selection
790
+ # Backend work - @claude:sonnet for complex logic
791
+ node wbs.js job add wbs-5 \
792
+ --title "Design User Profile data model" \
793
+ --agent "@claude:sonnet" \
794
+ --seq 1 \
795
+ --desc "Create schema with fields: avatar, bio, social_links, preferences"
796
+
797
+ # Implementation - @copilot for straightforward coding
798
+ node wbs.js job add wbs-5 \
799
+ --title "Implement profile CRUD API" \
800
+ --agent "@copilot" \
801
+ --seq 2 \
802
+ --desc "REST endpoints for profile operations with validation"
803
+
804
+ # Complex architecture - @claude:opus for advanced decisions
805
+ node wbs.js job add wbs-5 \
806
+ --title "Design avatar upload system" \
807
+ --agent "@claude:opus" \
808
+ --seq 3 \
809
+ --desc "S3 integration with image processing, CDN, and caching strategy"
810
+
811
+ # Implementation again
812
+ node wbs.js job add wbs-5 \
813
+ --title "Implement avatar upload" \
814
+ --agent "@copilot" \
815
+ --seq 4 \
816
+ --desc "File upload endpoint with S3 SDK and image optimization"
817
+
818
+ # Frontend - @claude:sonnet for React components
819
+ node wbs.js job add wbs-5 \
820
+ --title "Create profile edit form" \
821
+ --agent "@claude:sonnet" \
822
+ --seq 5 \
823
+ --desc "React component with form validation and avatar preview"
824
+
825
+ # Testing - @copilot excels at test generation
826
+ node wbs.js job add wbs-5 \
827
+ --title "Write comprehensive tests" \
828
+ --agent "@copilot" \
829
+ --seq 6 \
830
+ --desc "Unit tests for API, integration tests, and React Testing Library tests"
831
+
832
+ # 3. Run the entire pipeline
833
+ node wbs.js job run wbs-5
834
+ ```
835
+
836
+ **Agent selection rationale:**
837
+ - `@claude:sonnet`: Complex logic, architecture, React components
838
+ - `@claude:opus`: Very complex architectural decisions
839
+ - `@copilot`: Straightforward implementation, test generation
840
+ - `@gemini`: Performance optimization, data analysis (not shown here)
841
+
842
+ ---
843
+
844
+ ### Example 6: Working with Detail Documents
845
+
846
+ Use detail documents to provide comprehensive context to all jobs.
847
+
848
+ ```bash
849
+ # 1. Create project with detail document
850
+ node wbs.js create "E-commerce Checkout Flow" --detail ./docs/checkout-spec.md
851
+
852
+ # The system creates: skills/wbs/details/wbs-6-detail.md
853
+ ```
854
+
855
+ **Edit the detail document:**
856
+
857
+ ```bash
858
+ # Edit skills/wbs/details/wbs-6-detail.md
859
+ ```
860
+
861
+ **Content:**
862
+ ```markdown
863
+ # E-commerce Checkout Flow
864
+
865
+ ## Overview
866
+ Implement a secure checkout process for our e-commerce platform.
867
+
868
+ ## Requirements
869
+
870
+ ### Functional Requirements
871
+ 1. Multi-step checkout (cart -> shipping -> payment -> confirmation)
872
+ 2. Address validation with autocomplete
873
+ 3. Multiple payment methods (credit card, PayPal)
874
+ 4. Order summary with promo codes
875
+ 5. Email confirmation
876
+
877
+ ### Technical Requirements
878
+ - Payment processing via Stripe
879
+ - Address validation via Google Maps API
880
+ - Session management for cart persistence
881
+ - Transactional email via SendGrid
882
+
883
+ ### Security
884
+ - PCI compliance for credit card handling
885
+ - HTTPS only
886
+ - CSRF protection
887
+ - Rate limiting on payment endpoints
888
+
889
+ ### Performance
890
+ - Checkout flow should complete in < 3 seconds
891
+ - Optimize for mobile devices
892
+
893
+ ## References
894
+ - [Stripe API Docs](https://stripe.com/docs/api)
895
+ - [Design Mockups](./figma-link)
896
+ ```
897
+
898
+ **Add jobs:**
899
+ ```bash
900
+ node wbs.js job add wbs-6 \
901
+ --title "Implement multi-step form navigation" \
902
+ --agent "@claude:sonnet" \
903
+ --seq 1
904
+
905
+ node wbs.js job add wbs-6 \
906
+ --title "Integrate Stripe payment" \
907
+ --agent "@copilot" \
908
+ --seq 2
909
+
910
+ # ... more jobs
911
+ ```
912
+
913
+ **When jobs run, they automatically receive the detail document content as context.**
914
+
915
+ ---
916
+
917
+ ### Example 7: Monitoring and JSON Output
918
+
919
+ Automate WBS monitoring and integrate with other tools.
920
+
921
+ **Check project status programmatically:**
922
+ ```bash
923
+ # Get JSON output for scripting
924
+ node wbs.js status wbs-1 --json | jq '.summary'
925
+ ```
926
+
927
+ **Output:**
928
+ ```json
929
+ {
930
+ "total_jobs": 4,
931
+ "completed": 4,
932
+ "failed": 0,
933
+ "pending": 0,
934
+ "running": 0,
935
+ "progress": 100
936
+ }
937
+ ```
938
+
939
+ **Create a monitoring script:**
940
+ ```bash
941
+ #!/bin/bash
942
+ # monitor-wbs.sh
943
+
944
+ WBS_ID="wbs-7"
945
+
946
+ while true; do
947
+ clear
948
+ echo "======================================="
949
+ echo " WBS Monitor - $WBS_ID"
950
+ echo "======================================="
951
+
952
+ node wbs.js status $WBS_ID
953
+
954
+ PROGRESS=$(node wbs.js status $WBS_ID --json | jq -r '.summary.progress')
955
+
956
+ if [ "$PROGRESS" -eq 100 ]; then
957
+ echo ""
958
+ echo "[OK] Project complete!"
959
+ break
960
+ fi
961
+
962
+ echo ""
963
+ echo "[WAIT] Checking again in 60 seconds..."
964
+ sleep 60
965
+ done
966
+ ```
967
+
968
+ **Run monitor:**
969
+ ```bash
970
+ chmod +x monitor-wbs.sh
971
+ ./monitor-wbs.sh
972
+ ```
973
+
974
+ **Export jobs to CSV:**
975
+ ```bash
976
+ # Export job list
977
+ echo "ID,Title,Status,Agent,Seq" > jobs-export.csv
978
+ node wbs.js job list wbs-1 --json | \
979
+ jq -r '.[] | [.id,.title,.status,.agent,.seq] | @csv' >> jobs-export.csv
980
+ ```
981
+
982
+ **Check specific job execution history:**
983
+ ```bash
984
+ # List all executions for a job
985
+ node wbs.js exec list job-5 --json | jq '.'
986
+ ```
987
+
988
+ ---
989
+
990
+ ### Example 8: Recovering from Interruptions
991
+
992
+ Handle scenarios where execution is interrupted.
993
+
994
+ **Scenario**: Long-running project interrupted by system crash
995
+
996
+ ```bash
997
+ # 1. Check current status
998
+ node wbs.js list
999
+ ```
1000
+
1001
+ **Output:**
1002
+ ```
1003
+ [INFO] WBS Projects (3)
1004
+
1005
+ | ID | Title | Status | Progress |
1006
+ |-------|-----------------------|----------|----------|
1007
+ | wbs-1 | Todo REST API | completed| 100% 4/4 |
1008
+ | wbs-2 | Bug Fixes | running | 50% 2/4 |
1009
+ | wbs-3 | Refactoring | planning | 0% 0/5 |
1010
+ ```
1011
+
1012
+ ```bash
1013
+ # 2. Check which jobs were running
1014
+ node wbs.js status wbs-2
1015
+ ```
1016
+
1017
+ **Output:**
1018
+ ```
1019
+ [INFO] Bug Fixes (wbs-2)
1020
+ Status: running | Progress: 50% (2/4)
1021
+
1022
+ Jobs:
1023
+ | Status | # | ID | Task | Status |
1024
+ |--------|----|----|---------------|-----------|
1025
+ | [OK] | 1 | job-1 | Fix bug #123 | completed |
1026
+ | [OK] | 2 | job-2 | Fix bug #124 | completed |
1027
+ | [~] | 3 | job-3 | Fix bug #125 | running |
1028
+ | [ ] | 4 | job-4 | Fix bug #126 | pending |
1029
+ ```
1030
+
1031
+ ```bash
1032
+ # 3. Check if the running job actually completed
1033
+ node wbs.js exec list job-3
1034
+ ```
1035
+
1036
+ **If the execution failed or timed out:**
1037
+ ```
1038
+ | Status | ID | PID | Start | End | Code |
1039
+ |--------|---------|-------|---------------------|---------------------|------|
1040
+ | [BAD] | exec-7 | 23456 | 2025-12-18 10:30:00 | N/A (timeout) | -1 |
1041
+ ```
1042
+
1043
+ ```bash
1044
+ # 4. Reset the job and retry
1045
+ node wbs.js job update job-3 --status pending
1046
+ node wbs.js job retry job-3
1047
+
1048
+ # 5. Continue with remaining jobs
1049
+ node wbs.js job run wbs-2
1050
+ ```
1051
+
1052
+ ---
1053
+
1054
+ ### Summary: Quick Command Reference
1055
+
1056
+ **Basic workflow:**
1057
+ ```bash
1058
+ # Create -> Add -> Run -> Check
1059
+ node wbs.js create "Project Name"
1060
+ node wbs.js job add wbs-X --title "Task" --agent "@agent" --seq N
1061
+ node wbs.js job run wbs-X
1062
+ node wbs.js status wbs-X
1063
+ ```
1064
+
1065
+ **Issue-based workflow:**
1066
+ ```bash
1067
+ node wbs.js create "Bug Fixes"
1068
+ node wbs.js job add wbs-X --title "Fix bug" --agent "@agent" --issue 123
1069
+ node wbs.js job run wbs-X
1070
+ ```
1071
+
1072
+ **Step-by-step workflow:**
1073
+ ```bash
1074
+ node wbs.js job next wbs-X # Run one job
1075
+ # Review changes...
1076
+ node wbs.js job next wbs-X # Run next
1077
+ ```
1078
+
1079
+ **Handle failures (job-id or slug):**
1080
+ ```bash
1081
+ node wbs.js job list wbs-X --json | jq '.[] | select(.status=="failed")'
1082
+ node wbs.js job update wbs-X-Y --desc "Updated instructions" # by slug
1083
+ node wbs.js job retry wbs-X-Y # by slug
1084
+ node wbs.js job retry job-Y # by job-id
1085
+ ```
1086
+
1087
+ **Monitoring:**
1088
+ ```bash
1089
+ node wbs.js list
1090
+ node wbs.js status wbs-X
1091
+ node wbs.js status wbs-X --json | jq '.summary'
1092
+ ```
1093
+
1094
+ For more examples, see:
1095
+ - [EXAMPLE.md](./EXAMPLE.md) - Korean language detailed walkthrough
1096
+ - [job-management.md](./job-management.md) - Job-specific examples and patterns
1097
+
1098
+ ## Usage in Coordinator Agent
1099
+
1100
+ The coordinator agent uses this skill programmatically:
1101
+
1102
+ ```javascript
1103
+ const wbs = require('./wbs.js');
1104
+
1105
+ // 1. Create project
1106
+ const id = wbs.create('User Authentication Implementation');
1107
+
1108
+ // 2. Add jobs (AI decomposed)
1109
+ wbs.addJob(id, { title: 'Design User model', agent: '@claude:sonnet', seq: 1 });
1110
+ wbs.addJob(id, { title: 'Implement login API', agent: '@copilot', seq: 2 });
1111
+ wbs.addJob(id, { title: 'Write tests', agent: '@claude:sonnet', seq: 3 });
1112
+
1113
+ // 3. Execute
1114
+ await wbs.run(id);
1115
+
1116
+ // 4. Check status
1117
+ console.log(wbs.status(id));
1118
+ ```
1119
+
1120
+ ## Job Status Flow
1121
+
1122
+ ```
1123
+ pending -> running -> completed
1124
+ -> failed
1125
+ ```
1126
+
1127
+ ## Key Design Decisions
1128
+
1129
+ 1. **AI makes intelligent decisions** - Complexity analysis, job decomposition
1130
+ 2. **Code handles state only** - wbs.js does DB CRUD + worker execution
1131
+ 3. **30-minute timeboxing** - Each job is 15-45 minutes
1132
+ 4. **Start simple, improve iteratively** - MVP first
1133
+
1134
+ ## API Reference
1135
+
1136
+ ### Project Management
1137
+
1138
+ #### `wbs.create(title, options?)`
1139
+ Create a new WBS project. Returns project ID.
1140
+ - `options.detailPath`: Path to detail document (auto-created if not specified)
1141
+
1142
+ #### `wbs.list()`
1143
+ List all WBS projects.
1144
+
1145
+ #### `wbs.status(wbsId)`
1146
+ Get project and all jobs status.
1147
+
1148
+ #### `wbs.delete(wbsId)`
1149
+ Delete a project and all associated jobs/executions.
1150
+
1151
+ ### Job Management
1152
+
1153
+ #### `wbs.addJob(wbsId, { title, description?, agent, seq?, issue_number? })`
1154
+ Add a job to the project. Returns job ID.
1155
+ - `title`: Job title (short name)
1156
+ - `description`: Detailed instructions for the agent
1157
+ - `agent`: Worker agent mention (e.g., `@crewx_claude_dev`)
1158
+ - `seq`: Execution order (default: 0)
1159
+ - `issue_number`: Related GitHub issue number
1160
+
1161
+ #### `wbs.getNextJob(wbsId)`
1162
+ Get the next pending job. Returns job object or null.
1163
+
1164
+ #### `wbs.updateJob(jobId, status)`
1165
+ Update job status. Status: `pending`, `running`, `completed`, `failed`.
1166
+
1167
+ #### `wbs.runWorker(job)`
1168
+ Execute a single worker. Returns `{ success, error?, execId }`.
1169
+
1170
+ #### `wbs.run(wbsId)`
1171
+ Execute all pending jobs sequentially.
1172
+
1173
+ ### Execution Management
1174
+
1175
+ #### `wbs.createExecution(jobId, pid)`
1176
+ Create a new execution record. Returns execution ID.
1177
+
1178
+ #### `wbs.updateExecution(execId, status, options?)`
1179
+ Update execution status.
1180
+ - `options.exitCode`: Process exit code
1181
+ - `options.error`: Error message
1182
+
1183
+ #### `wbs.getExecution(execId)`
1184
+ Get execution by ID.
1185
+
1186
+ #### `wbs.listExecutions(jobId)`
1187
+ List all executions for a job.
1188
+
1189
+ #### `wbs.killExecution(execId)`
1190
+ Kill a running execution. Returns boolean success.
1191
+
1192
+ #### `wbs.getRunningExecutions()`
1193
+ Get all currently running executions.
1194
+
1195
+ ## Related Documentation
1196
+
1197
+ - [WBS Skill Spec](/docs/cto/designs/wbs-skill-spec.md)
1198
+ - [CrewX CLI Documentation](/packages/cli/AGENTS.md)