@amsterdamdatalabs/enact-extensions 0.1.3 → 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.
Files changed (105) hide show
  1. package/README.md +2 -2
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1 -0
  5. package/dist/index.js.map +1 -1
  6. package/dist/install.d.ts.map +1 -1
  7. package/dist/install.js +15 -1
  8. package/dist/install.js.map +1 -1
  9. package/dist/internal/agents.d.ts +29 -0
  10. package/dist/internal/agents.d.ts.map +1 -0
  11. package/dist/internal/agents.js +83 -0
  12. package/dist/internal/agents.js.map +1 -0
  13. package/extensions/enact-context/hooks/hooks.json +17 -7
  14. package/extensions/enact-core/.agents/plugin.json +39 -0
  15. package/extensions/enact-core/hooks/hooks.json +14 -0
  16. package/extensions/enact-factory/.agents/plugin.json +9 -3
  17. package/extensions/enact-factory/agents/architect.toml +30 -0
  18. package/extensions/enact-factory/agents/code-reviewer.toml +29 -0
  19. package/extensions/enact-factory/agents/critic.toml +35 -0
  20. package/extensions/enact-factory/agents/executor.toml +23 -0
  21. package/extensions/enact-factory/agents/explore.toml +22 -0
  22. package/extensions/enact-factory/agents/planner.toml +23 -0
  23. package/extensions/enact-factory/agents/verifier.toml +29 -0
  24. package/extensions/enact-factory/skills/ai-slop-cleaner/SKILL.md +52 -0
  25. package/extensions/enact-factory/skills/azdo-ci-strategy/SKILL.md +262 -0
  26. package/extensions/enact-factory/skills/azdo-ci-strategy/references/build-failures.md +60 -0
  27. package/extensions/enact-factory/skills/azdo-ci-strategy/references/cli-reference.md +87 -0
  28. package/extensions/enact-factory/skills/azdo-ci-strategy/references/policies-and-pipelines.md +132 -0
  29. package/extensions/enact-factory/skills/azdo-ci-strategy/references/troubleshooting.md +53 -0
  30. package/extensions/enact-factory/skills/deep-interview/SKILL.md +72 -0
  31. package/extensions/enact-factory/skills/drive-loop/SKILL.md +259 -0
  32. package/extensions/enact-factory/skills/drive-loop/references/contract-schema.md +107 -0
  33. package/extensions/enact-factory/skills/hyperplan/SKILL.md +51 -0
  34. package/extensions/enact-factory/skills/looplan/SKILL.md +103 -0
  35. package/extensions/enact-factory/skills/plan/SKILL.md +71 -0
  36. package/extensions/enact-factory/skills/remove-deadcode/SKILL.md +41 -0
  37. package/extensions/enact-factory/skills/research/SKILL.md +73 -0
  38. package/extensions/enact-factory/skills/review/SKILL.md +48 -0
  39. package/extensions/enact-factory/skills/security-research/SKILL.md +54 -0
  40. package/extensions/enact-factory/skills/tdd/SKILL.md +56 -0
  41. package/extensions/enact-factory/skills/trace/SKILL.md +37 -0
  42. package/extensions/enact-factory/skills/ultraqa/SKILL.md +79 -0
  43. package/extensions/enact-factory/skills/work-with-workitem/SKILL.md +51 -0
  44. package/extensions/enact-factory/skills/workitem-triage/SKILL.md +15 -0
  45. package/extensions/enact-loop/.agents/plugin.json +46 -0
  46. package/extensions/enact-loop/.mcp.json +1 -0
  47. package/extensions/enact-loop/hooks/hooks.json +27 -0
  48. package/extensions/enact-loop/skills/enact-loop/SKILL.md +327 -0
  49. package/extensions/enact-operator/.agents/plugin.json +0 -1
  50. package/extensions/enact-operator/hooks/hooks.json +0 -55
  51. package/extensions/enact-wiki/skills/wiki/SKILL.md +42 -0
  52. package/extensions/plugin-dev/.agents/plugin.json +4 -6
  53. package/extensions/plugin-dev/agents/plugin-validator.md +1 -1
  54. package/extensions/plugin-dev/skills/agent-development/SKILL.md +7 -7
  55. package/extensions/plugin-dev/{commands/create-plugin.md → skills/create-plugin/SKILL.md} +44 -37
  56. package/extensions/plugin-dev/skills/plugin-dev-guide/SKILL.md +13 -14
  57. package/extensions/plugin-dev/skills/skill-development/SKILL.md +0 -2
  58. package/extensions/plugin-dev/{commands/start.md → skills/start/SKILL.md} +7 -6
  59. package/package.json +11 -6
  60. package/scripts/check-hooks.mjs +174 -0
  61. package/scripts/check-principles.mjs +101 -0
  62. package/scripts/enact-extensions.mjs +87 -3
  63. package/scripts/lib/run-validate.mjs +36 -2
  64. package/scripts/lib/ups-router.mjs +432 -0
  65. package/spec/enact.json +4 -0
  66. package/spec/enact.md +5 -2
  67. package/extensions/cmux/.agents/plugin.json +0 -37
  68. package/extensions/cmux/skills/cmux/SKILL.md +0 -82
  69. package/extensions/cmux/skills/cmux/agents/openai.yaml +0 -4
  70. package/extensions/cmux/skills/cmux/references/handles-and-identify.md +0 -35
  71. package/extensions/cmux/skills/cmux/references/panes-surfaces.md +0 -37
  72. package/extensions/cmux/skills/cmux/references/trigger-flash-and-health.md +0 -23
  73. package/extensions/cmux/skills/cmux/references/windows-workspaces.md +0 -31
  74. package/extensions/cmux/skills/cmux-vm-monitor/SKILL.md +0 -122
  75. package/extensions/cmux/skills/cmux-vm-monitor/agents/openai.yaml +0 -4
  76. package/extensions/cmux/skills/cmux-vm-monitor/references/cmux-commands.md +0 -66
  77. package/extensions/cmux/skills/cmux-vm-monitor/scripts/codex_vm_monitor.sh +0 -45
  78. package/extensions/cmux/skills/cmux-workspace/SKILL.md +0 -93
  79. package/extensions/devops/.agents/plugin.json +0 -36
  80. package/extensions/devops/skills/azure-devops-cli/SKILL.md +0 -431
  81. package/extensions/devops/skills/azure-devops-cli/agents/openai.yaml +0 -4
  82. package/extensions/devops/skills/ci-pipeline-strategy/SKILL.md +0 -217
  83. package/extensions/devops/skills/ci-pipeline-strategy/agents/openai.yaml +0 -4
  84. package/extensions/enact-factory/hooks/user-prompt-submit.mjs +0 -67
  85. package/extensions/enact-operator/commands/doctor.md +0 -39
  86. package/extensions/enact-operator/commands/setup.md +0 -51
  87. package/extensions/plugin-dev/.mcp.json +0 -3
  88. package/extensions/plugin-dev/commands/_archive/create-marketplace.md +0 -427
  89. package/extensions/plugin-dev/commands/_archive/plugin-dev-guide.md +0 -12
  90. package/extensions/plugin-dev/hooks/hooks.json +0 -3
  91. package/extensions/plugin-dev/skills/command-development/SKILL.md +0 -763
  92. package/extensions/plugin-dev/skills/command-development/examples/plugin-commands.md +0 -612
  93. package/extensions/plugin-dev/skills/command-development/examples/simple-commands.md +0 -527
  94. package/extensions/plugin-dev/skills/command-development/references/advanced-workflows.md +0 -762
  95. package/extensions/plugin-dev/skills/command-development/references/documentation-patterns.md +0 -769
  96. package/extensions/plugin-dev/skills/command-development/references/frontmatter-reference.md +0 -508
  97. package/extensions/plugin-dev/skills/command-development/references/interactive-commands.md +0 -966
  98. package/extensions/plugin-dev/skills/command-development/references/marketplace-considerations.md +0 -943
  99. package/extensions/plugin-dev/skills/command-development/references/plugin-features-reference.md +0 -637
  100. package/extensions/plugin-dev/skills/command-development/references/plugin-integration.md +0 -191
  101. package/extensions/plugin-dev/skills/command-development/references/skill-tool.md +0 -447
  102. package/extensions/plugin-dev/skills/command-development/references/testing-strategies.md +0 -723
  103. package/extensions/plugin-dev/skills/command-development/scripts/check-frontmatter.sh +0 -234
  104. package/extensions/plugin-dev/skills/command-development/scripts/validate-command.sh +0 -160
  105. /package/extensions/enact-operator/{skills/_variants.md → docs/skill-variants.md} +0 -0
@@ -1,762 +0,0 @@
1
- # Advanced Workflow Patterns
2
-
3
- Multi-step command sequences and composition patterns for complex workflows.
4
-
5
- ## Overview
6
-
7
- Advanced workflows combine multiple commands, coordinate state across invocations, and create sophisticated automation sequences. These patterns enable building complex functionality from simple command building blocks.
8
-
9
- ## Multi-Step Command Patterns
10
-
11
- ### Sequential Workflow Command
12
-
13
- Commands that guide users through multi-step processes:
14
-
15
- ```markdown
16
- ---
17
- description: Complete PR review workflow
18
- argument-hint: [pr-number]
19
- allowed-tools: Bash(gh:*), Read, Grep
20
- ---
21
-
22
- # PR Review Workflow for #$1
23
-
24
- ## Step 1: Fetch PR Details
25
-
26
- `gh pr view $1 --json title,body,author,files`
27
-
28
- ## Step 2: Review Files
29
-
30
- Files changed: `gh pr diff $1 --name-only`
31
-
32
- For each file:
33
-
34
- - Check code quality
35
- - Verify tests exist
36
- - Review documentation
37
-
38
- ## Step 3: Run Checks
39
-
40
- Test status: `gh pr checks $1`
41
-
42
- Verify:
43
-
44
- - All tests passing
45
- - No merge conflicts
46
- - CI/CD successful
47
-
48
- ## Step 4: Provide Feedback
49
-
50
- Summarize:
51
-
52
- - Issues found (critical/minor)
53
- - Suggestions for improvement
54
- - Approval recommendation
55
-
56
- Would you like to:
57
-
58
- 1. Approve PR
59
- 2. Request changes
60
- 3. Leave comments only
61
-
62
- Reply with your choice and I'll help complete the action.
63
- ```
64
-
65
- **Key features:**
66
-
67
- - Numbered steps for clarity
68
- - Bash execution for context
69
- - Decision points for user input
70
- - Next action suggestions
71
-
72
- ### State-Carrying Workflow
73
-
74
- Commands that maintain state between invocations:
75
-
76
- ```markdown
77
- ---
78
- description: Initialize deployment workflow
79
- allowed-tools: Write, Bash(git:*)
80
- ---
81
-
82
- # Initialize Deployment
83
-
84
- Creating deployment tracking file...
85
-
86
- Current branch: `git branch --show-current`
87
- Latest commit: `git log -1 --format=%H`
88
-
89
- Deployment state saved to `.claude/deployment-state.local.md`:
90
-
91
- ## \`\`\`markdown
92
-
93
- initialized: true
94
- branch: $(git branch --show-current)
95
- commit: $(git log -1 --format=%H)
96
- timestamp: $(date -u +%Y-%m-%dT%H:%M:%SZ)
97
- status: initialized
98
-
99
- ---
100
-
101
- # Deployment Tracking
102
-
103
- Branch: $(git branch --show-current)
104
- Started: $(date)
105
-
106
- Next steps:
107
-
108
- 1. Run tests: /deploy-test
109
- 2. Build: /deploy-build
110
- 3. Deploy: /deploy-execute
111
- \`\`\`
112
-
113
- State saved. Run `/deploy-test` to continue.
114
- ```
115
-
116
- **Next command** (`/deploy-test`):
117
-
118
- ```markdown
119
- ---
120
- description: Run deployment tests
121
- allowed-tools: Read, Bash(npm:*)
122
- ---
123
-
124
- Reading deployment state from `.claude/deployment-state.local.md`...
125
-
126
- Running tests: `npm test`
127
-
128
- Updating state to 'tested'...
129
-
130
- Tests complete. Run `/deploy-build` to continue.
131
- ```
132
-
133
- **Pattern benefits:**
134
-
135
- - Persistent state across commands
136
- - Clear workflow progression
137
- - Safety checkpoints
138
- - Resume capability
139
-
140
- ### Conditional Workflow Branching
141
-
142
- Commands that adapt based on conditions:
143
-
144
- ```markdown
145
- ---
146
- description: Smart deployment workflow
147
- argument-hint: [environment]
148
- allowed-tools: Bash(git:*), Bash(npm:*), Read
149
- ---
150
-
151
- # Deploy to $1
152
-
153
- ## Pre-flight Checks
154
-
155
- Branch: `git branch --show-current`
156
- Status: `git status --short`
157
-
158
- **Checking conditions:**
159
-
160
- 1. Branch status:
161
- - If main/master: Require approval
162
- - If feature branch: Warning about target
163
- - If hotfix: Fast-track process
164
-
165
- 2. Tests:
166
- `npm test`
167
- - If tests fail: STOP - fix tests first
168
- - If tests pass: Continue
169
-
170
- 3. Environment:
171
- - If $1 = 'production': Extra validation
172
- - If $1 = 'staging': Standard process
173
- - If $1 = 'dev': Minimal checks
174
-
175
- **Workflow decision:**
176
- Based on above, proceeding with: [determined workflow]
177
-
178
- [Conditional steps based on environment and status]
179
-
180
- Ready to deploy? (yes/no)
181
- ```
182
-
183
- ## Command Composition Patterns
184
-
185
- ### Command Chaining
186
-
187
- Commands designed to work together:
188
-
189
- ```markdown
190
- ---
191
- description: Prepare for code review
192
- ---
193
-
194
- # Prepare Code Review
195
-
196
- Running preparation sequence:
197
-
198
- 1. Format code: /format-code
199
- 2. Run linter: /lint-code
200
- 3. Run tests: /test-all
201
- 4. Generate coverage: /coverage-report
202
- 5. Create review summary: /review-summary
203
-
204
- This is a meta-command. After completing each step above,
205
- I'll compile results and prepare comprehensive review materials.
206
-
207
- Starting sequence...
208
- ```
209
-
210
- **Individual commands** are simple:
211
-
212
- - `/format-code` - Just formats
213
- - `/lint-code` - Just lints
214
- - `/test-all` - Just tests
215
-
216
- **Composition command** orchestrates them.
217
-
218
- ### Pipeline Pattern
219
-
220
- Commands that process output from previous commands:
221
-
222
- ```markdown
223
- ---
224
- description: Analyze test failures
225
- ---
226
-
227
- # Analyze Test Failures
228
-
229
- ## Step 1: Get test results
230
-
231
- (Run /test-all first if not done)
232
-
233
- Reading test output...
234
-
235
- ## Step 2: Categorize failures
236
-
237
- - Flaky tests (random failures)
238
- - Consistent failures
239
- - New failures vs existing
240
-
241
- ## Step 3: Prioritize
242
-
243
- Rank by:
244
-
245
- - Impact (critical path vs edge case)
246
- - Frequency (always fails vs sometimes)
247
- - Effort (quick fix vs major work)
248
-
249
- ## Step 4: Generate fix plan
250
-
251
- For each failure:
252
-
253
- - Root cause hypothesis
254
- - Suggested fix approach
255
- - Estimated effort
256
-
257
- Would you like me to:
258
-
259
- 1. Fix highest priority failure
260
- 2. Generate detailed fix plans for all
261
- 3. Create GitHub issues for each
262
- ```
263
-
264
- ### Parallel Execution Pattern
265
-
266
- Commands that coordinate multiple simultaneous operations:
267
-
268
- ```markdown
269
- ---
270
- description: Run comprehensive validation
271
- allowed-tools: Bash(*), Read
272
- ---
273
-
274
- # Comprehensive Validation
275
-
276
- Running validations in parallel...
277
-
278
- Starting:
279
-
280
- - Code quality checks
281
- - Security scanning
282
- - Dependency audit
283
- - Performance profiling
284
-
285
- This will take 2-3 minutes. I'll monitor all processes
286
- and report when complete.
287
-
288
- [Poll each process and report progress]
289
-
290
- All validations complete. Summary:
291
-
292
- - Quality: PASS (0 issues)
293
- - Security: WARN (2 minor issues)
294
- - Dependencies: PASS
295
- - Performance: PASS (baseline met)
296
-
297
- Details:
298
- [Collated results from all checks]
299
- ```
300
-
301
- ## Workflow State Management
302
-
303
- ### Using .local.md Files
304
-
305
- Store workflow state in plugin-specific files:
306
-
307
- ```markdown
308
- .claude/plugin-name-workflow.local.md:
309
-
310
- ---
311
-
312
- workflow: deployment
313
- stage: testing
314
- started: 2025-01-15T10:30:00Z
315
- environment: staging
316
- branch: feature/new-api
317
- commit: abc123def
318
- tests_passed: false
319
- build_complete: false
320
-
321
- ---
322
-
323
- # Deployment Workflow State
324
-
325
- Current stage: Testing
326
- Started: 2025-01-15 10:30 UTC
327
-
328
- Completed steps:
329
-
330
- - ✅ Validation
331
- - ✅ Branch check
332
- - ⏳ Testing (in progress)
333
-
334
- Pending steps:
335
-
336
- - Build
337
- - Deploy
338
- - Smoke tests
339
- ```
340
-
341
- **Reading state in commands:**
342
-
343
- ```markdown
344
- ---
345
- description: Continue deployment workflow
346
- allowed-tools: Read, Write
347
- ---
348
-
349
- Reading workflow state from .claude/plugin-name-workflow.local.md...
350
-
351
- Current stage: @.claude/plugin-name-workflow.local.md
352
-
353
- [Parse YAML frontmatter to determine next step]
354
-
355
- Next action based on state: [determined action]
356
- ```
357
-
358
- ### Workflow Recovery
359
-
360
- Handle interrupted workflows:
361
-
362
- ```markdown
363
- ---
364
- description: Resume deployment workflow
365
- allowed-tools: Read
366
- ---
367
-
368
- # Resume Deployment
369
-
370
- Checking for interrupted workflow...
371
-
372
- State file: @.claude/plugin-name-workflow.local.md
373
-
374
- **Workflow found:**
375
-
376
- - Started: [timestamp]
377
- - Environment: [env]
378
- - Last completed: [step]
379
-
380
- **Recovery options:**
381
-
382
- 1. Resume from last step
383
- 2. Restart from beginning
384
- 3. Abort and clean up
385
-
386
- Which would you like? (1/2/3)
387
- ```
388
-
389
- ## Workflow Coordination Patterns
390
-
391
- ### Cross-Command Communication
392
-
393
- Commands that signal each other:
394
-
395
- ```markdown
396
- ---
397
- description: Mark feature complete
398
- allowed-tools: Write
399
- ---
400
-
401
- # Mark Feature Complete
402
-
403
- Writing completion marker...
404
-
405
- Creating: .claude/feature-complete.flag
406
-
407
- This signals other commands that feature is ready for:
408
-
409
- - Integration testing (/integration-test will auto-detect)
410
- - Documentation generation (/docs-generate will include)
411
- - Release notes (/release-notes will add)
412
-
413
- Feature marked complete.
414
- ```
415
-
416
- **Other commands check for flag:**
417
-
418
- ```markdown
419
- ---
420
- description: Generate release notes
421
- allowed-tools: Read, Bash(git:*)
422
- ---
423
-
424
- Checking for completed features...
425
-
426
- if [ -f .claude/feature-complete.flag ]; then
427
- Feature ready for release notes
428
- fi
429
-
430
- [Include in release notes]
431
- ```
432
-
433
- ### Workflow Locking
434
-
435
- Prevent concurrent workflow execution:
436
-
437
- ```markdown
438
- ---
439
- description: Start deployment
440
- allowed-tools: Read, Write, Bash
441
- ---
442
-
443
- # Start Deployment
444
-
445
- Checking for active deployments...
446
-
447
- if [ -f .claude/deployment.lock ]; then
448
- ERROR: Deployment already in progress
449
- Started: [timestamp from lock file]
450
-
451
- Cannot start concurrent deployment.
452
- Wait for completion or run /deployment-abort
453
-
454
- Exit.
455
- fi
456
-
457
- Creating deployment lock...
458
-
459
- Deployment started. Lock created.
460
- [Proceed with deployment]
461
- ```
462
-
463
- **Lock cleanup:**
464
-
465
- ```markdown
466
- ---
467
- description: Complete deployment
468
- allowed-tools: Write, Bash
469
- ---
470
-
471
- Deployment complete.
472
-
473
- Removing deployment lock...
474
- rm .claude/deployment.lock
475
-
476
- Ready for next deployment.
477
- ```
478
-
479
- ## Advanced Argument Handling
480
-
481
- ### Optional Arguments with Defaults
482
-
483
- ```markdown
484
- ---
485
- description: Deploy with optional version
486
- argument-hint: [environment] [version]
487
- ---
488
-
489
- Environment: ${1:-staging}
490
- Version: ${2:-latest}
491
-
492
- Deploying ${2:-latest} to ${1:-staging}...
493
-
494
- Note: Using defaults for missing arguments:
495
-
496
- - Environment defaults to 'staging'
497
- - Version defaults to 'latest'
498
- ```
499
-
500
- ### Argument Validation
501
-
502
- ```markdown
503
- ---
504
- description: Deploy to validated environment
505
- argument-hint: [environment]
506
- ---
507
-
508
- Environment: $1
509
-
510
- Validating environment...
511
-
512
- valid_envs="dev staging production"
513
- if ! echo "$valid_envs" | grep -w "$1" > /dev/null; then
514
- ERROR: Invalid environment '$1'
515
- Valid options: dev, staging, production
516
- Exit.
517
- fi
518
-
519
- Environment validated. Proceeding...
520
- ```
521
-
522
- ### Argument Transformation
523
-
524
- ```markdown
525
- ---
526
- description: Deploy with shorthand
527
- argument-hint: [env-shorthand]
528
- ---
529
-
530
- Input: $1
531
-
532
- Expanding shorthand:
533
-
534
- - d/dev → development
535
- - s/stg → staging
536
- - p/prod → production
537
-
538
- case "$1" in
539
- d|dev) ENV="development";;
540
- s|stg) ENV="staging";;
541
- p|prod) ENV="production";;
542
- \*) ENV="$1";;
543
- esac
544
-
545
- Deploying to: $ENV
546
- ```
547
-
548
- ## Error Handling in Workflows
549
-
550
- ### Graceful Failure
551
-
552
- ```markdown
553
- ---
554
- description: Resilient deployment workflow
555
- ---
556
-
557
- # Deployment Workflow
558
-
559
- Running steps with error handling...
560
-
561
- ## Step 1: Tests
562
-
563
- `npm test`
564
-
565
- if [ $? -ne 0 ]; then
566
- ERROR: Tests failed
567
-
568
- Options:
569
-
570
- 1. Fix tests and retry
571
- 2. Skip tests (NOT recommended)
572
- 3. Abort deployment
573
-
574
- What would you like to do?
575
-
576
- [Wait for user input before continuing]
577
- fi
578
-
579
- ## Step 2: Build
580
-
581
- [Continue only if Step 1 succeeded]
582
- ```
583
-
584
- ### Rollback on Failure
585
-
586
- ```markdown
587
- ---
588
- description: Deployment with rollback
589
- ---
590
-
591
- # Deploy with Rollback
592
-
593
- Saving current state for rollback...
594
- Previous version: `current-version.sh`
595
-
596
- Deploying new version...
597
-
598
- `deploy.sh`
599
-
600
- if [ $? -ne 0 ]; then
601
- DEPLOYMENT FAILED
602
-
603
- Initiating automatic rollback...
604
- `rollback.sh`
605
-
606
- Rolled back to previous version.
607
- Check logs for failure details.
608
- fi
609
-
610
- Deployment complete.
611
- ```
612
-
613
- ### Checkpoint Recovery
614
-
615
- ```markdown
616
- ---
617
- description: Workflow with checkpoints
618
- ---
619
-
620
- # Multi-Stage Deployment
621
-
622
- ## Checkpoint 1: Validation
623
-
624
- `validate.sh`
625
- echo "checkpoint:validation" >> .claude/deployment-checkpoints.log
626
-
627
- ## Checkpoint 2: Build
628
-
629
- `build.sh`
630
- echo "checkpoint:build" >> .claude/deployment-checkpoints.log
631
-
632
- ## Checkpoint 3: Deploy
633
-
634
- `deploy.sh`
635
- echo "checkpoint:deploy" >> .claude/deployment-checkpoints.log
636
-
637
- If any step fails, resume with:
638
- /deployment-resume [last-successful-checkpoint]
639
- ```
640
-
641
- ## Best Practices
642
-
643
- ### Workflow Design
644
-
645
- 1. **Clear progression**: Number steps, show current position
646
- 2. **Explicit state**: Don't rely on implicit state
647
- 3. **User control**: Provide decision points
648
- 4. **Error recovery**: Handle failures gracefully
649
- 5. **Progress indication**: Show what's done, what's pending
650
-
651
- ### Command Composition
652
-
653
- 1. **Single responsibility**: Each command does one thing well
654
- 2. **Composable design**: Commands work together easily
655
- 3. **Standard interfaces**: Consistent input/output formats
656
- 4. **Loose coupling**: Commands don't depend on each other's internals
657
-
658
- ### State Management
659
-
660
- 1. **Persistent state**: Use .local.md files
661
- 2. **Atomic updates**: Write complete state files atomically
662
- 3. **State validation**: Check state file format/completeness
663
- 4. **Cleanup**: Remove stale state files
664
- 5. **Documentation**: Document state file formats
665
-
666
- ### Error Handling
667
-
668
- 1. **Fail fast**: Detect errors early
669
- 2. **Clear messages**: Explain what went wrong
670
- 3. **Recovery options**: Provide clear next steps
671
- 4. **State preservation**: Keep state for recovery
672
- 5. **Rollback capability**: Support undoing changes
673
-
674
- ## Example: Complete Deployment Workflow
675
-
676
- ### Initialize Command
677
-
678
- ```markdown
679
- ---
680
- description: Initialize deployment
681
- argument-hint: [environment]
682
- allowed-tools: Write, Bash(git:*)
683
- ---
684
-
685
- # Initialize Deployment to $1
686
-
687
- Creating workflow state...
688
-
689
- ## \`\`\`yaml
690
-
691
- workflow: deployment
692
- environment: $1
693
- branch: `git branch --show-current`
694
- commit: `git rev-parse HEAD`
695
- stage: initialized
696
- timestamp: `date -u +%Y-%m-%dT%H:%M:%SZ`
697
-
698
- ---
699
-
700
- \`\`\`
701
-
702
- Written to .claude/deployment-state.local.md
703
-
704
- Next: Run /deployment-validate
705
- ```
706
-
707
- ### Validation Command
708
-
709
- ```markdown
710
- ---
711
- description: Validate deployment
712
- allowed-tools: Read, Bash
713
- ---
714
-
715
- Reading state: @.claude/deployment-state.local.md
716
-
717
- Running validation...
718
-
719
- - Branch check: PASS
720
- - Tests: PASS
721
- - Build: PASS
722
-
723
- Updating state to 'validated'...
724
-
725
- Next: Run /deployment-execute
726
- ```
727
-
728
- ### Execution Command
729
-
730
- ```markdown
731
- ---
732
- description: Execute deployment
733
- allowed-tools: Read, Bash, Write
734
- ---
735
-
736
- Reading state: @.claude/deployment-state.local.md
737
-
738
- Executing deployment to [environment]...
739
-
740
- `deploy.sh [environment]`
741
-
742
- Deployment complete.
743
- Updating state to 'completed'...
744
-
745
- Cleanup: /deployment-cleanup
746
- ```
747
-
748
- ### Cleanup Command
749
-
750
- ```markdown
751
- ---
752
- description: Clean up deployment
753
- allowed-tools: Bash
754
- ---
755
-
756
- Removing deployment state...
757
- rm .claude/deployment-state.local.md
758
-
759
- Deployment workflow complete.
760
- ```
761
-
762
- This complete workflow demonstrates state management, sequential execution, error handling, and clean separation of concerns across multiple commands.