@drafthq/draft 3.5.3 → 3.7.1

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 (143) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/.cursor-plugin/plugin.json +1 -1
  4. package/README.md +28 -49
  5. package/bin/README.md +47 -1
  6. package/cli/src/hosts/cursor.js +3 -0
  7. package/cli/src/installer.js +8 -4
  8. package/cli/src/lib/cursor-registry.js +10 -0
  9. package/cli/src/lib/fsx.js +3 -0
  10. package/cli/src/lib/marker.js +8 -3
  11. package/core/agents/architect.md +21 -9
  12. package/core/agents/debugger.md +5 -0
  13. package/core/agents/ops.md +7 -2
  14. package/core/agents/planner.md +7 -0
  15. package/core/agents/rca.md +14 -3
  16. package/core/agents/reviewer.md +1 -0
  17. package/core/agents/writer.md +6 -0
  18. package/core/knowledge-base.md +22 -3
  19. package/core/methodology.md +30 -5
  20. package/core/shared/condensation.md +28 -18
  21. package/core/shared/context-verify.md +3 -1
  22. package/core/shared/cross-skill-dispatch.md +7 -3
  23. package/core/shared/draft-context-loading.md +3 -0
  24. package/core/shared/git-report-metadata.md +2 -1
  25. package/core/shared/graph-query.md +24 -26
  26. package/core/shared/graph-usage-report.md +1 -1
  27. package/core/shared/jira-sync.md +10 -6
  28. package/core/shared/okf-retrieval.md +1 -1
  29. package/core/shared/parallel-analysis.md +14 -7
  30. package/core/shared/pattern-learning.md +2 -0
  31. package/core/shared/template-contract.md +1 -1
  32. package/core/shared/tool-resolver.md +20 -15
  33. package/core/shared/vcs-commands.md +5 -2
  34. package/core/templates/ai-context.md +3 -2
  35. package/core/templates/ai-profile.md +7 -0
  36. package/core/templates/architecture.md +6 -2
  37. package/core/templates/discovery.md +1 -1
  38. package/core/templates/guardrails.md +9 -0
  39. package/core/templates/hld.md +5 -4
  40. package/core/templates/intake-questions.md +45 -0
  41. package/core/templates/jira.md +11 -2
  42. package/core/templates/lld.md +8 -5
  43. package/core/templates/okf/concept.md +0 -1
  44. package/core/templates/plan.md +1 -1
  45. package/core/templates/product.md +11 -2
  46. package/core/templates/rca.md +6 -0
  47. package/core/templates/service-index.md +1 -0
  48. package/core/templates/spec.md +15 -0
  49. package/core/templates/tech-stack.md +12 -0
  50. package/core/templates/workflow.md +20 -0
  51. package/integrations/agents/AGENTS.md +1449 -817
  52. package/integrations/copilot/.github/copilot-instructions.md +1449 -817
  53. package/package.json +1 -1
  54. package/scripts/fetch-memory-engine.sh +25 -7
  55. package/scripts/lib.sh +90 -6
  56. package/scripts/tools/_graph_queries.sh +22 -8
  57. package/scripts/tools/_lib.sh +81 -11
  58. package/scripts/tools/adr-index.sh +1 -1
  59. package/scripts/tools/check-repo-size.sh +125 -0
  60. package/scripts/tools/check-skill-line-caps.sh +3 -4
  61. package/scripts/tools/check-template-noop.sh +0 -1
  62. package/scripts/tools/check-track-hygiene.sh +41 -21
  63. package/scripts/tools/classify-files.sh +3 -3
  64. package/scripts/tools/cycle-detect.sh +18 -17
  65. package/scripts/tools/detect-test-framework.sh +1 -1
  66. package/scripts/tools/emit-skill-metrics.sh +7 -2
  67. package/scripts/tools/fix-whitespace.sh +3 -0
  68. package/scripts/tools/freshness-check.sh +2 -2
  69. package/scripts/tools/git-metadata.sh +12 -6
  70. package/scripts/tools/graph-arch.sh +5 -11
  71. package/scripts/tools/graph-callers.sh +10 -15
  72. package/scripts/tools/graph-deps.sh +3 -10
  73. package/scripts/tools/graph-errors.sh +4 -11
  74. package/scripts/tools/graph-hierarchy.sh +4 -11
  75. package/scripts/tools/graph-impact.sh +21 -19
  76. package/scripts/tools/graph-init.sh +13 -9
  77. package/scripts/tools/graph-preflight.sh +4 -1
  78. package/scripts/tools/graph-query.sh +74 -18
  79. package/scripts/tools/graph-risk.sh +3 -10
  80. package/scripts/tools/graph-search.sh +4 -11
  81. package/scripts/tools/graph-snapshot.sh +38 -9
  82. package/scripts/tools/graph-snippet.sh +3 -10
  83. package/scripts/tools/graph-tests.sh +3 -10
  84. package/scripts/tools/graph-traces.sh +3 -10
  85. package/scripts/tools/hotspot-rank.sh +6 -12
  86. package/scripts/tools/install-smoke-test.sh +223 -0
  87. package/scripts/tools/mermaid-from-graph.sh +5 -11
  88. package/scripts/tools/migrate-track-frontmatter.sh +11 -10
  89. package/scripts/tools/okf-coverage-check.sh +8 -7
  90. package/scripts/tools/okf-emit-catalog.sh +256 -0
  91. package/scripts/tools/okf-fix-links.sh +251 -0
  92. package/scripts/tools/okf-plan-concepts.sh +242 -14
  93. package/scripts/tools/okf-render-views.sh +63 -21
  94. package/scripts/tools/okf-validate-all.sh +20 -9
  95. package/scripts/tools/okf-validate-quality.sh +15 -10
  96. package/scripts/tools/okf-validate.sh +20 -6
  97. package/scripts/tools/parse-git-log.sh +23 -5
  98. package/scripts/tools/parse-reports.sh +1 -1
  99. package/scripts/tools/render-track.sh +1 -1
  100. package/scripts/tools/resolve-tools.sh +24 -8
  101. package/scripts/tools/run-coverage.sh +1 -1
  102. package/scripts/tools/scan-markers.sh +4 -4
  103. package/scripts/tools/validate-frontmatter.sh +2 -2
  104. package/scripts/tools/verify-citations.sh +3 -4
  105. package/scripts/tools/verify-doc-anchors.sh +14 -34
  106. package/scripts/tools/verify-graph-binary.sh +15 -5
  107. package/skills/GRAPH.md +21 -10
  108. package/skills/adr/SKILL.md +25 -7
  109. package/skills/assist-review/SKILL.md +2 -1
  110. package/skills/bughunt/SKILL.md +55 -12
  111. package/skills/bughunt/references/regression-tests.md +14 -4
  112. package/skills/change/SKILL.md +19 -9
  113. package/skills/coverage/SKILL.md +28 -12
  114. package/skills/debug/SKILL.md +13 -3
  115. package/skills/decompose/SKILL.md +42 -12
  116. package/skills/deep-review/SKILL.md +19 -6
  117. package/skills/deploy-checklist/SKILL.md +10 -3
  118. package/skills/documentation/SKILL.md +12 -1
  119. package/skills/draft/SKILL.md +40 -29
  120. package/skills/draft/context-files.md +8 -1
  121. package/skills/draft/quality-guide.md +10 -2
  122. package/skills/graph/SKILL.md +2 -2
  123. package/skills/impact/SKILL.md +4 -2
  124. package/skills/implement/SKILL.md +62 -20
  125. package/skills/incident-response/SKILL.md +5 -2
  126. package/skills/init/SKILL.md +112 -30
  127. package/skills/init/references/architecture-spec.md +32 -8
  128. package/skills/init/references/okf-emitter.md +42 -78
  129. package/skills/jira/SKILL.md +33 -13
  130. package/skills/jira/references/review.md +61 -19
  131. package/skills/learn/SKILL.md +30 -7
  132. package/skills/new-track/SKILL.md +73 -18
  133. package/skills/quick-review/SKILL.md +8 -3
  134. package/skills/revert/SKILL.md +11 -5
  135. package/skills/review/SKILL.md +126 -27
  136. package/skills/review/references/zero-setup-mode.md +117 -0
  137. package/skills/standup/SKILL.md +10 -2
  138. package/skills/status/SKILL.md +7 -7
  139. package/skills/tech-debt/SKILL.md +9 -3
  140. package/skills/testing-strategy/SKILL.md +10 -2
  141. package/skills/tour/SKILL.md +2 -1
  142. package/skills/upload/SKILL.md +4 -3
  143. package/core/templates/track-architecture.md +0 -311
@@ -9,7 +9,7 @@ Create a new track (feature, bug fix, or refactor) for Context-Driven Developmen
9
9
 
10
10
  **Feature Description:** $ARGUMENTS
11
11
 
12
- ## Red Flags - STOP if you're:
12
+ ## Red Flags - STOP if you're
13
13
 
14
14
  - Creating a track without reading existing Draft context (product.md, tech-stack.md, .ai-context.md)
15
15
  - Asking questions without contributing expertise or trade-off analysis
@@ -25,6 +25,7 @@ Create a new track (feature, bug fix, or refactor) for Context-Driven Developmen
25
25
  ## Pre-Check
26
26
 
27
27
  1. Verify Draft is initialized:
28
+
28
29
  ```bash
29
30
  ls draft/product.md draft/tech-stack.md draft/workflow.md draft/tracks.md 2>/dev/null
30
31
  ```
@@ -36,6 +37,7 @@ If missing, tell user: "Project not initialized. Run `/draft:init` first."
36
37
  - Quick mode is for: hotfixes, tiny isolated changes, work scoped to 1-3 hours
37
38
 
38
39
  3. Load full project context (these documents ARE the big picture — every track must be grounded in them):
40
+
39
41
  - Read `draft/product.md` — product vision, users, goals, constraints, guidelines (optional section)
40
42
  - Read `draft/tech-stack.md` — languages, frameworks, patterns, code style, accepted patterns
41
43
  - Read `draft/.ai-context.md` (if exists) — system map, modules, data flows, invariants, security architecture. Falls back to `draft/architecture.md` for legacy projects.
@@ -43,19 +45,23 @@ If missing, tell user: "Project not initialized. Run `/draft:init` first."
43
45
  - Read `draft/guardrails.md` (if exists) — hard guardrails, learned conventions, learned anti-patterns
44
46
  - Read `draft/tracks.md` — existing tracks to check for overlap or dependencies
45
47
  - **Scan recent track impact memory** (overlap detection): for each completed track in `draft/tracks/*/metadata.json` updated within the last 30 days, read the `impact` block (if present). Build a map `module → [recent_track_ids]`. After Step 4 (scope distillation), once the candidate modules for the new track are known, intersect them with this map. If overlap exists, surface it in the intake summary:
46
- ```
48
+
49
+ ```text
47
50
  Overlap warning: track <id> recently touched modules <A>, <B>.
48
51
  Review draft/tracks/<id>/metadata.json#impact before proceeding.
49
52
  ```
53
+
50
54
  This is informational, not blocking — the user decides whether to proceed, depend on the prior track, or rebase scope.
51
55
 
52
56
  4. Load guidance references:
57
+
53
58
  - Read `core/templates/intake-questions.md` — structured questions for intake
54
59
  - Read `core/knowledge-base.md` — vetted sources for AI guidance
55
60
 
56
61
  ## Step 1: Generate Track ID
57
62
 
58
63
  Create a short, kebab-case ID from the description (use the stripped description if `--quick` was present):
64
+
59
65
  - "Add user authentication" → `add-user-auth`
60
66
  - "Fix login bug" → `fix-login-bug`
61
67
 
@@ -124,13 +130,15 @@ mkdir -p draft/tracks/<track_id>
124
130
  ```
125
131
 
126
132
  Then execute **Step 8** (Create Metadata & Update Tracks) with these overrides for quick tracks:
133
+
127
134
  - `"type": "quick"` (not `feature|bugfix|refactor`)
128
135
  - `"phases": {"total": 1, "completed": 0}` (plan has exactly 1 phase)
129
136
 
130
137
  Skip Steps 2–7.
131
138
 
132
139
  After Step 8 completes, announce:
133
- ```
140
+
141
+ ```text
134
142
  Quick track created: <track_id>
135
143
 
136
144
  Files: spec.md (minimal), plan.md (flat)
@@ -143,7 +151,7 @@ Next: /draft:implement
143
151
 
144
152
  Create the track directory and draft files immediately with skeleton structure:
145
153
 
146
- ### Create `draft/tracks/<track_id>/spec-draft.md`:
154
+ ### Create `draft/tracks/<track_id>/spec-draft.md`
147
155
 
148
156
  **MANDATORY: Include YAML frontmatter with git metadata.** Gather git info first:
149
157
 
@@ -283,7 +291,7 @@ synced_to_commit: "{FULL_SHA}"
283
291
  [Conversation summary will be added here]
284
292
  ```
285
293
 
286
- ### Create `draft/tracks/<track_id>/plan-draft.md`:
294
+ ### Create `draft/tracks/<track_id>/plan-draft.md`
287
295
 
288
296
  **MANDATORY: Include YAML frontmatter with git metadata** (same git info as spec-draft.md):
289
297
 
@@ -341,6 +349,7 @@ Follow the structured intake from `core/templates/intake-questions.md`. You are
341
349
  ### Your Role as AI Collaborator
342
350
 
343
351
  For each question:
352
+
344
353
  1. **Ask** the question clearly
345
354
  2. **Listen** to the user's response
346
355
  3. **Contribute** your expertise:
@@ -355,12 +364,13 @@ For each question:
355
364
  ### Citation Style
356
365
 
357
366
  Ground advice in vetted sources:
367
+
358
368
  - "Consider CQRS here (DDIA, Ch. 11) — separates read/write concerns."
359
369
  - "This could violate the Dependency Rule (Clean Architecture)."
360
370
  - "Circuit breaker pattern (Release It!) would help prevent cascade failures."
361
371
  - "Watch for OWASP A01:2021 — Broken Access Control."
362
372
 
363
- ### Red Flags - STOP if you're:
373
+ ### Red Flags - STOP if you're
364
374
 
365
375
  - Asking questions without contributing expertise
366
376
  - Accepting answers without probing deeper with "why"
@@ -377,18 +387,22 @@ Ground advice in vetted sources:
377
387
  ## Step 3A: Intake Flow (Feature / Refactor)
378
388
 
379
389
  ### Phase 1: Existing Documentation
390
+
380
391
  - "Do you have existing documentation for this work? (PRD, RFC, design doc, Jira ticket)"
381
392
  - If yes: Ingest, extract key points, identify gaps
382
393
  - AI contribution: "I've extracted [X, Y, Z]. I notice [gap] isn't covered yet."
383
394
 
384
395
  ### Phase 2: Problem Space
396
+
385
397
  Walk through problem questions from intake-questions.md:
398
+
386
399
  - What problem are we solving?
387
400
  - Why does this problem matter now?
388
401
  - Who experiences this pain?
389
402
  - What's the scope boundary?
390
403
 
391
404
  After each answer:
405
+
392
406
  - Contribute relevant patterns, similar problems, domain concepts
393
407
  - Challenge assumptions with "why" questions
394
408
  - Update spec-draft.md Problem Statement section
@@ -396,13 +410,16 @@ After each answer:
396
410
  **Checkpoint:** "Here's the problem as I understand it: [summary]. Does this capture it?"
397
411
 
398
412
  ### Phase 3: Solution Space
413
+
399
414
  Walk through solution questions:
415
+
400
416
  - What's the simplest version that solves this?
401
417
  - Why this approach over alternatives?
402
418
  - What are we explicitly NOT doing?
403
419
  - How does this fit with current architecture?
404
420
 
405
421
  After each answer:
422
+
406
423
  - Present 2-3 alternative approaches with trade-offs
407
424
  - Cross-reference .ai-context.md (or architecture.md) for integration points
408
425
  - Suggest tech-stack.md patterns to leverage
@@ -411,13 +428,16 @@ After each answer:
411
428
  **Checkpoint:** "The proposed approach is [summary]. I've identified these alternatives: [list]. Your reasoning for this choice is [X]. Correct?"
412
429
 
413
430
  ### Phase 4: Risk & Constraints
431
+
414
432
  Walk through risk questions:
433
+
415
434
  - What could go wrong?
416
435
  - What dependencies or blockers exist?
417
436
  - Why might this fail?
418
437
  - Security or compliance considerations?
419
438
 
420
439
  After each answer:
440
+
421
441
  - Surface risks user may not have considered
422
442
  - Reference OWASP, distributed systems fallacies, failure modes
423
443
  - Fact-check assumptions against project context
@@ -426,12 +446,15 @@ After each answer:
426
446
  **Checkpoint:** "Key risks identified: [list]. Are there others you're aware of?"
427
447
 
428
448
  ### Phase 5: Success Criteria
449
+
429
450
  Walk through success questions:
451
+
430
452
  - How do we know this is complete?
431
453
  - How will we verify it works?
432
454
  - What would make stakeholders accept this?
433
455
 
434
456
  After each answer:
457
+
435
458
  - Suggest measurable, testable acceptance criteria
436
459
  - Recommend testing strategies appropriate to feature type
437
460
  - Align with product.md goals
@@ -446,17 +469,20 @@ After each answer:
446
469
  #### Refactor Tracks → Tech-Debt Offer
447
470
 
448
471
  If track type is refactor:
449
- ```
472
+
473
+ ```text
450
474
  "Want to run a tech-debt analysis to prioritize what to address?
451
475
  → /draft:tech-debt scans 6 debt categories with prioritization
452
476
  Run tech-debt analysis? [Y/n]"
453
477
  ```
478
+
454
479
  If accepted: invoke `/draft:plan "tech debt for this refactor"`, use its prioritized output to scope the refactor spec.
455
480
 
456
481
  #### Design Decision Detection → ADR Suggestion
457
482
 
458
483
  If spec introduces technology not in `tech-stack.md` or changes service boundaries in `.ai-context.md`:
459
- ```
484
+
485
+ ```text
460
486
  "This involves a significant design decision. Consider running:
461
487
  → /draft:plan \"adr ...\" to document the architectural decision"
462
488
  ```
@@ -468,6 +494,7 @@ If spec introduces technology not in `tech-stack.md` or changes service boundari
468
494
  For bugs, incidents, or Jira-sourced issues. Tighter scope, investigation-focused.
469
495
 
470
496
  ### Phase 1: Symptoms & Context
497
+
471
498
  - "What's the exact error or unexpected behavior?"
472
499
  - "Who is affected? How often does this occur?"
473
500
  - "When did this start? Any recent changes?"
@@ -475,6 +502,7 @@ For bugs, incidents, or Jira-sourced issues. Tighter scope, investigation-focuse
475
502
  AI contribution: Pattern recognition for common bug types, severity assessment.
476
503
 
477
504
  ### Phase 2: Reproduction
505
+
478
506
  - "What are the exact steps to reproduce?"
479
507
  - "What environment conditions are required?"
480
508
  - "What's the expected vs actual behavior?"
@@ -482,12 +510,14 @@ AI contribution: Pattern recognition for common bug types, severity assessment.
482
510
  AI contribution: Suggest additional reproduction scenarios, edge cases to check.
483
511
 
484
512
  ### Phase 3: Blast Radius
513
+
485
514
  - "What still works correctly?"
486
515
  - "Where does the failure boundary lie?"
487
516
 
488
517
  AI contribution: Help narrow investigation scope, reference architecture.md for module boundaries.
489
518
 
490
519
  ### Phase 4: Code Locality
520
+
491
521
  - "Where do you suspect the bug is?"
492
522
  - "What's the entry point and failure point?"
493
523
 
@@ -504,6 +534,7 @@ When triggered, execute the auto-triage pipeline before proceeding to Step 4:
504
534
  #### Triage Step 1: Gather External Context
505
535
 
506
536
  If Jira ticket provided:
537
+
507
538
  1. Pull ticket via Jira MCP: `get_issue()`, `get_issue_description()`, `get_issue_comments()`
508
539
  2. Extract from ticket: URLs, log paths, stack traces, reproduction steps, affected services
509
540
  3. Use `curl`/`wget` to fetch any URLs mentioned (dashboards, error pages, API responses)
@@ -512,19 +543,21 @@ If Jira ticket provided:
512
543
 
513
544
  #### Triage Step 2: Offer Debug Session
514
545
 
515
- ```
546
+ ```text
516
547
  "Bug track detected with [Jira context / error description]. Run a structured debug session before writing the spec?
517
548
  → /draft:discover debug will help reproduce and isolate the issue
518
549
  Run debug session? [Y/n]"
519
550
  ```
520
551
 
521
552
  If accepted:
553
+
522
554
  - Invoke `/draft:discover "debug ..."` (routes to debug) with gathered triage context
523
555
  - Feed the Debug Report into spec-draft.md "Reproduction" and "Root Cause Hypothesis" sections
524
556
 
525
557
  #### Triage Step 3: RCA Analysis
526
558
 
527
559
  If debug session produced findings:
560
+
528
561
  - Invoke RCA agent methodology from `core/agents/rca.md`
529
562
  - Perform 5 Whys analysis using debug findings
530
563
  - Assess blast radius from `.ai-context.md`
@@ -533,6 +566,7 @@ If debug session produced findings:
533
566
  #### Triage Step 4: Generate rca.md
534
567
 
535
568
  Create `draft/tracks/<track_id>/rca.md` using the template from `core/templates/rca.md`:
569
+
536
570
  - Include root cause, classification, timeline, evidence, prevention items
537
571
  - Include YAML frontmatter with git metadata
538
572
  - Link to debug report and gathered evidence
@@ -540,12 +574,13 @@ Create `draft/tracks/<track_id>/rca.md` using the template from `core/templates/
540
574
  #### Triage Step 5: Sync to Jira
541
575
 
542
576
  If Jira ticket linked, sync via `core/shared/jira-sync.md`:
577
+
543
578
  - Attach `rca.md` to ticket
544
579
  - Post comment: "[draft] rca-complete: Root cause identified — {1-line summary}. Prevention: {count} items."
545
580
 
546
581
  #### Triage Step 6: Developer Checkpoint
547
582
 
548
- ```
583
+ ```text
549
584
  "RCA complete. Findings:
550
585
  Root cause: {summary}
551
586
  Classification: {type}
@@ -560,6 +595,7 @@ Only proceed to spec/plan generation after developer approval.
560
595
  ### Step 3B.6: Incident Context Detection
561
596
 
562
597
  If track description contains "incident", "outage", "SEV", or "postmortem":
598
+
563
599
  - Check for existing postmortem: `ls draft/tracks/*/incident-*.md 2>/dev/null`
564
600
  - If none found, suggest: "Run `/draft:ops incident-response postmortem` first to capture incident context."
565
601
  - If found, feed postmortem findings into spec-draft.md.
@@ -575,6 +611,7 @@ After completing intake sections:
575
611
  3. Ask: "Want to refine any section, or ready to finalize?"
576
612
 
577
613
  If refining:
614
+
578
615
  - Continue conversation on specific sections
579
616
  - Update drafts as discussion progresses
580
617
  - Return to this step when ready
@@ -588,23 +625,26 @@ Before finalizing, offer a quick spec stress-test. This takes 2 minutes and ofte
588
625
  Based on the track type (feature / bug / refactor), present 3 pre-selected challenge techniques:
589
626
 
590
627
  **Feature tracks:**
628
+
591
629
  1. **Pre-mortem** — "It's 6 months later and this feature failed. What went wrong?"
592
630
  2. **Scope Boundary** — "What's the smallest version that still achieves the core goal?"
593
631
  3. **Edge Case Storm** — Surface 5 boundary conditions not yet in the ACs
594
632
 
595
633
  **Bug tracks:**
634
+
596
635
  1. **Root Cause Depth** — "Is the reported symptom the real bug, or a symptom of something deeper?"
597
636
  2. **Blast Radius** — "What else could this fix inadvertently break?"
598
637
  3. **Regression Risk** — "What existing behavior might this change inadvertently affect?"
599
638
 
600
639
  **Refactor tracks:**
640
+
601
641
  1. **Behavior Preservation** — "List every externally visible behavior that must be identical before and after"
602
642
  2. **Integration Impact** — "Which callers will break if this interface changes?"
603
643
  3. **Rollback Complexity** — "If this refactor needs reverting mid-flight, what's the path?"
604
644
 
605
645
  Present to the user:
606
646
 
607
- ```
647
+ ```text
608
648
  Quick stress-test before finalizing — pick one or skip:
609
649
 
610
650
  1. [Technique name] — [one-line prompt]
@@ -640,25 +680,31 @@ Present final spec.md for acknowledgment.
640
680
 
641
681
  Based on finalized spec, build out plan-draft.md:
642
682
 
643
- ### For Feature / Refactor:
683
+ ### For Feature / Refactor
684
+
644
685
  Create phased breakdown:
686
+
645
687
  - Phase 1: Foundation / Setup
646
688
  - Phase 2: Core Implementation
647
689
  - Phase 3: Integration & Polish
648
690
 
649
691
  For each phase:
692
+
650
693
  - Define Goal and Verification criteria
651
694
  - Break into specific Tasks with file references
652
695
  - Identify dependencies between tasks
653
696
 
654
697
  AI contribution:
698
+
655
699
  - Suggest task ordering based on dependencies
656
700
  - Reference tech-stack.md for implementation patterns
657
701
  - Identify testing requirements per task
658
702
  - Flag integration points with .ai-context.md modules
659
703
 
660
- ### For Bug & RCA:
704
+ ### For Bug & RCA
705
+
661
706
  Use fixed 3-phase structure:
707
+
662
708
  - Phase 1: Investigate & Reproduce
663
709
  - Phase 2: Root Cause Analysis
664
710
  - Phase 3: Fix & Verify
@@ -706,11 +752,12 @@ ls draft/tracks/<track_id>/spec.md draft/tracks/<track_id>/plan.md 2>/dev/null
706
752
  ```
707
753
 
708
754
  If either missing:
755
+
709
756
  - ERROR: "Track creation incomplete. Missing files: [list missing]"
710
757
  - "Expected: spec.md and plan.md in draft/tracks/<track_id>/"
711
758
  - Halt - do not create metadata.json or update tracks.md
712
759
 
713
- ### Create `draft/tracks/<track_id>/metadata.json`:
760
+ ### Create `draft/tracks/<track_id>/metadata.json`
714
761
 
715
762
  ```json
716
763
  {
@@ -744,10 +791,11 @@ cat draft/tracks/<track_id>/metadata.json | python3 -c "import sys,json; json.lo
744
791
  ```
745
792
 
746
793
  If invalid or missing:
794
+
747
795
  - ERROR: "Failed to write valid metadata.json for track <track_id>"
748
796
  - Halt - do not update tracks.md (prevents orphaned track entries)
749
797
 
750
- ### Update `draft/tracks.md`:
798
+ ### Update `draft/tracks.md`
751
799
 
752
800
  Add under Active:
753
801
 
@@ -781,6 +829,7 @@ grep "<track_id>" draft/tracks.md
781
829
  ```
782
830
 
783
831
  If not found:
832
+
784
833
  - ERROR: "Failed to update tracks.md with new track entry"
785
834
  - "Expected track_id '<track_id>' in draft/tracks.md Active section"
786
835
  - Provide recovery: "Manually add track entry to draft/tracks.md or remove draft/tracks/<track_id>/ and retry"
@@ -793,11 +842,13 @@ Announce:
793
842
  "Track created: <track_id>
794
843
 
795
844
  Created:
845
+
796
846
  - draft/tracks/<track_id>/spec.md
797
847
  - draft/tracks/<track_id>/plan.md
798
848
  - draft/tracks/<track_id>/metadata.json
799
849
 
800
850
  Updated:
851
+
801
852
  - draft/tracks.md
802
853
 
803
854
  Key decisions documented in spec.md Conversation Log.
@@ -811,6 +862,7 @@ Next: Review the spec and plan, then run `/draft:implement` to begin."
811
862
  ### Jira Sync at Completion
812
863
 
813
864
  If Jira ticket is linked (from spec.md or metadata.json), sync via `core/shared/jira-sync.md`:
865
+
814
866
  - Attach `spec.md` and `plan.md` to ticket
815
867
  - Post comment: "[draft] spec-complete: Specification and plan generated for track {id}. {phase_count} phases, {task_count} tasks."
816
868
 
@@ -819,7 +871,8 @@ If Jira ticket is linked (from spec.md or metadata.json), sync via `core/shared/
819
871
  Based on track type, suggest relevant follow-ups:
820
872
 
821
873
  **Bug tracks:**
822
- ```
874
+
875
+ ```text
823
876
  "Track ready for implementation. Also consider:
824
877
  → /draft:ops incident-response postmortem — If this bug caused an incident
825
878
  → /draft:discover debug — Structured investigation
@@ -827,14 +880,16 @@ Based on track type, suggest relevant follow-ups:
827
880
  ```
828
881
 
829
882
  **Feature tracks:**
830
- ```
883
+
884
+ ```text
831
885
  "Track ready for implementation.
832
886
  Next: /draft:implement
833
887
  Also: /draft:discover \"test strategy\" — Define test approach for this feature"
834
888
  ```
835
889
 
836
890
  **Refactor tracks:**
837
- ```
891
+
892
+ ```text
838
893
  "Track ready for implementation.
839
894
  Next: /draft:implement
840
895
  Also: /draft:plan \"adr ...\" — Document refactoring decisions"
@@ -12,10 +12,11 @@ You are performing a lightweight, ad-hoc code review. This is the fast alternati
12
12
  When `draft/graph/schema.yaml` exists, this skill **must** follow the graph-first lookup contract in [core/shared/graph-query.md](../../core/shared/graph-query.md) §Mandatory Lookup Contract. Quick-review keeps the graph load light:
13
13
 
14
14
  First resolve the bundled helpers:
15
+
15
16
  ```bash
16
17
  # Locate Draft's bundled helpers (cwd is the user's project; ${CLAUDE_PLUGIN_ROOT}
17
18
  # is not exported into skill Bash). See core/shared/tool-resolver.md.
18
- DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
19
+ DRAFT_TOOLS="${DRAFT_PLUGIN_ROOT:-$(cat ~/.cache/draft/plugin-root 2>/dev/null)}/scripts/tools"
19
20
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/cache/*/draft/*/scripts/tools 2>/dev/null | sort -V | tail -1)"
20
21
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$(ls -d ~/.claude/plugins/marketplaces/*draft*/scripts/tools 2>/dev/null | tail -1)"
21
22
  [ -d "$DRAFT_TOOLS" ] || DRAFT_TOOLS="$PWD/scripts/tools"
@@ -26,11 +27,12 @@ DRAFT_TOOLS="$(cat ~/.cache/draft/plugin-root 2>/dev/null)/scripts/tools"
26
27
 
27
28
  Filesystem `grep` is reserved for source-text scans (literal strings, regex patterns). Symbol and caller discovery go through the graph.
28
29
 
29
- ## Red Flags — STOP if you're:
30
+ ## Red Flags — STOP if you're
30
31
 
31
32
  See [shared red flags](../../core/shared/red-flags.md) — applies to all code-touching skills.
32
33
 
33
34
  Skill-specific:
35
+
34
36
  - Reviewing without reading the code first
35
37
  - Providing generic feedback not grounded in the actual code
36
38
  - Missing security implications in authentication/authorization code
@@ -67,12 +69,14 @@ If no draft context, proceed with generic review — still valuable.
67
69
  ## Step 1: Parse Arguments
68
70
 
69
71
  Check for arguments:
72
+
70
73
  - `/draft:quick-review` — Review staged changes (`git diff --cached`) or current branch diff
71
74
  - `/draft:quick-review <file>` — Review specific file(s)
72
75
  - `/draft:quick-review <PR-URL>` — Review a pull request (via GitHub/GitHub MCP)
73
76
  - `/draft:quick-review <commit-range>` — Review specific commits
74
77
 
75
78
  Determine the diff to review:
79
+
76
80
  1. If PR URL: fetch via GitHub MCP (`get_change_detail`, `get_change_diff`) or GitHub
77
81
  2. If file path: read the file(s)
78
82
  3. If commit range: `git diff <range>`
@@ -82,7 +86,7 @@ Determine the diff to review:
82
86
 
83
87
  Before the four-dimension review, run `"$DRAFT_TOOLS/hotspot-rank.sh" --repo .` and check if any files in scope appear in the output. If any file has a `fanIn` in the top 20% of the list, add this warning at the top of the review report:
84
88
 
85
- ```
89
+ ```text
86
90
  ⚠ HIGH IMPACT: {file} is a high-fanIn hotspot (fanIn={N}). Changes here propagate to many callers — review with extra care.
87
91
  ```
88
92
 
@@ -209,6 +213,7 @@ If `draft/graph/schema.yaml` does not exist, set `Graph files queried: NONE` and
209
213
  ## Graph Usage Report (append to review report)
210
214
 
211
215
  Emit the canonical footer from [core/shared/graph-usage-report.md](../../core/shared/graph-usage-report.md) §Canonical footer. The lint hook `scripts/tools/check-graph-usage-report.sh` validates the section on save.
216
+
212
217
  ## Cross-Skill Dispatch
213
218
 
214
219
  - **Offered by:** `/draft:implement` at phase boundaries as lightweight alternative to full review
@@ -7,7 +7,7 @@ description: "Git-aware revert that understands Draft tracks, phases, and tasks.
7
7
 
8
8
  Perform intelligent git revert that understands Draft's logical units of work.
9
9
 
10
- ## Red Flags - STOP if you're:
10
+ ## Red Flags - STOP if you're
11
11
 
12
12
  - Reverting without showing preview first
13
13
  - Skipping user confirmation
@@ -23,9 +23,11 @@ Perform intelligent git revert that understands Draft's logical units of work.
23
23
  ## Step 0: Pre-flight Check
24
24
 
25
25
  1. **Verify Draft context exists:**
26
+
26
27
  ```bash
27
28
  ls draft/tracks.md 2>/dev/null
28
29
  ```
30
+
29
31
  If `draft/` does not exist: **STOP** — "No Draft context found. Run `/draft:init` first."
30
32
 
31
33
  2. **Check working tree:**
@@ -52,6 +54,7 @@ If user specifies by name/description, find the matching commits.
52
54
  **Fallback method (if SHAs missing but completed tasks exist):** Search git log by track ID pattern:
53
55
 
54
56
  For Draft-managed work, commits follow pattern:
57
+
55
58
  - `feat(<track_id>): <description>`
56
59
  - `fix(<track_id>): <description>`
57
60
  - `test(<track_id>): <description>`
@@ -71,7 +74,7 @@ git log --oneline --since="<phase_start>" --until="<phase_end>" --grep="<track_i
71
74
 
72
75
  Show user what will be reverted:
73
76
 
74
- ```
77
+ ```text
75
78
  ═══════════════════════════════════════════════════════════
76
79
  REVERT PREVIEW
77
80
  ═══════════════════════════════════════════════════════════
@@ -105,6 +108,7 @@ Maintain a list of successfully reverted commits during execution.
105
108
  Read `draft/workflow.md` → `## Toolchain` section for VCS CLI. See `core/shared/vcs-commands.md` for the full command mapping.
106
109
 
107
110
  **git mode:**
111
+
108
112
  ```bash
109
113
  # Revert each commit in reverse order (newest first)
110
114
  git revert --no-commit <commit1>
@@ -136,7 +140,7 @@ On conflict, report: "Successfully reverted: [list]. Conflict on: [sha]. Run `gi
136
140
 
137
141
  ## Step 6: Confirm
138
142
 
139
- ```
143
+ ```text
140
144
  Revert complete
141
145
 
142
146
  Reverted:
@@ -162,12 +166,14 @@ If the process is interrupted between git revert and Draft state update, the rec
162
166
  ## Abort Handling
163
167
 
164
168
  If user says no to preview:
165
- ```
169
+
170
+ ```text
166
171
  Revert cancelled. No changes made.
167
172
  ```
168
173
 
169
174
  If git revert has conflicts:
170
- ```
175
+
176
+ ```text
171
177
  Revert conflict detected in: [files]
172
178
 
173
179
  Options: