compound-workflow 0.1.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 (55) hide show
  1. package/.claude-plugin/marketplace.json +11 -0
  2. package/.claude-plugin/plugin.json +12 -0
  3. package/.cursor-plugin/plugin.json +12 -0
  4. package/README.md +155 -0
  5. package/package.json +22 -0
  6. package/scripts/install-cli.mjs +313 -0
  7. package/scripts/sync-into-repo.sh +103 -0
  8. package/src/.agents/agents/research/best-practices-researcher.md +132 -0
  9. package/src/.agents/agents/research/framework-docs-researcher.md +134 -0
  10. package/src/.agents/agents/research/git-history-analyzer.md +62 -0
  11. package/src/.agents/agents/research/learnings-researcher.md +288 -0
  12. package/src/.agents/agents/research/repo-research-analyst.md +146 -0
  13. package/src/.agents/agents/review/agent-native-reviewer.md +299 -0
  14. package/src/.agents/agents/workflow/bug-reproduction-validator.md +87 -0
  15. package/src/.agents/agents/workflow/lint.md +20 -0
  16. package/src/.agents/agents/workflow/spec-flow-analyzer.md +149 -0
  17. package/src/.agents/commands/assess.md +60 -0
  18. package/src/.agents/commands/install.md +53 -0
  19. package/src/.agents/commands/metrics.md +59 -0
  20. package/src/.agents/commands/setup.md +9 -0
  21. package/src/.agents/commands/sync.md +9 -0
  22. package/src/.agents/commands/test-browser.md +393 -0
  23. package/src/.agents/commands/workflow/brainstorm.md +252 -0
  24. package/src/.agents/commands/workflow/compound.md +142 -0
  25. package/src/.agents/commands/workflow/plan.md +737 -0
  26. package/src/.agents/commands/workflow/review-v2.md +148 -0
  27. package/src/.agents/commands/workflow/review.md +110 -0
  28. package/src/.agents/commands/workflow/triage.md +54 -0
  29. package/src/.agents/commands/workflow/work.md +439 -0
  30. package/src/.agents/references/README.md +12 -0
  31. package/src/.agents/references/standards/README.md +9 -0
  32. package/src/.agents/scripts/self-check.mjs +227 -0
  33. package/src/.agents/scripts/sync-opencode.mjs +355 -0
  34. package/src/.agents/skills/agent-browser/SKILL.md +223 -0
  35. package/src/.agents/skills/audit-traceability/SKILL.md +260 -0
  36. package/src/.agents/skills/brainstorming/SKILL.md +250 -0
  37. package/src/.agents/skills/compound-docs/SKILL.md +533 -0
  38. package/src/.agents/skills/compound-docs/assets/critical-pattern-template.md +34 -0
  39. package/src/.agents/skills/compound-docs/assets/resolution-template.md +97 -0
  40. package/src/.agents/skills/compound-docs/references/yaml-schema.md +87 -0
  41. package/src/.agents/skills/compound-docs/schema.project.yaml +18 -0
  42. package/src/.agents/skills/compound-docs/schema.yaml +119 -0
  43. package/src/.agents/skills/data-foundations/SKILL.md +185 -0
  44. package/src/.agents/skills/document-review/SKILL.md +108 -0
  45. package/src/.agents/skills/file-todos/SKILL.md +177 -0
  46. package/src/.agents/skills/file-todos/assets/todo-template.md +106 -0
  47. package/src/.agents/skills/financial-workflow-integrity/SKILL.md +423 -0
  48. package/src/.agents/skills/git-worktree/SKILL.md +268 -0
  49. package/src/.agents/skills/pii-protection-prisma/SKILL.md +629 -0
  50. package/src/.agents/skills/process-metrics/SKILL.md +46 -0
  51. package/src/.agents/skills/process-metrics/assets/daily-template.md +37 -0
  52. package/src/.agents/skills/process-metrics/assets/monthly-template.md +21 -0
  53. package/src/.agents/skills/process-metrics/assets/weekly-template.md +25 -0
  54. package/src/.agents/skills/technical-review/SKILL.md +83 -0
  55. package/src/AGENTS.md +213 -0
@@ -0,0 +1,737 @@
1
+ ---
2
+ name: plan
3
+ invocation: workflow:plan
4
+ description: Transform feature descriptions into well-structured project plans using an explicit fidelity and confidence model
5
+ argument-hint: "[feature description, bug report, improvement idea, or brainstorm doc path]"
6
+ ---
7
+
8
+ # Create a plan for a new feature or bug fix
9
+
10
+ ## Introduction
11
+
12
+ **Note: The current year is 2026.** Use this when dating plans and searching for recent documentation.
13
+
14
+ Transform feature descriptions, bug reports, or improvement ideas into well-structured markdown plan files that follow project conventions and best practices. This command provides flexible detail levels to match your needs.
15
+
16
+ This workflow MUST choose a planning fidelity and confidence level before final plan construction:
17
+
18
+ - Fidelity: `Low | Medium | High`
19
+ - Confidence: `High | Medium | Low`
20
+
21
+ ## Feature Description
22
+
23
+ <feature_description> #$ARGUMENTS </feature_description>
24
+
25
+ **If the feature description above is empty, ask the user:** "What would you like to plan? Please describe the feature, bug fix, or improvement you have in mind."
26
+
27
+ Do not proceed until you have a clear feature description from the user.
28
+
29
+ ## Guardrails
30
+
31
+ - Do not write or modify application code.
32
+ - Do not create commits, push branches, or create PRs.
33
+ - Output is the plan file only; post-generation options are user-driven actions on that file.
34
+
35
+ ## Resolve Repo Defaults (ALWAYS FIRST)
36
+
37
+ Read `AGENTS.md` and look for the "Repo Config Block" YAML.
38
+
39
+ Use it to resolve optional defaults used by this command:
40
+
41
+ - `default_branch`
42
+ - `project_tracker`
43
+
44
+ If not present, proceed with safe defaults and state what you assumed.
45
+
46
+ ### 0. Idea Refinement
47
+
48
+ **Check for brainstorm output first:**
49
+
50
+ Before asking questions, look for recent brainstorm documents in `docs/brainstorms/` that match this feature:
51
+
52
+ Use file discovery tools (Glob/Read) to locate and read recent brainstorm documents under `docs/brainstorms/`.
53
+
54
+ **Relevance criteria:** A brainstorm is relevant if:
55
+
56
+ - The topic (from filename or YAML frontmatter) semantically matches the feature description
57
+ - Created within the last 14 days
58
+ - If multiple candidates match, use the most recent one
59
+
60
+ **If a relevant brainstorm exists:**
61
+
62
+ 1. Read the brainstorm document
63
+ 2. Announce: "Found brainstorm from [date]: [topic]. Using as context for planning."
64
+ 3. Extract key decisions, chosen approach, and open questions
65
+ 4. **Skip the idea refinement questions below** - the brainstorm already answered WHAT to build
66
+ 5. Use brainstorm decisions as input to the research phase
67
+
68
+ **If multiple brainstorms could match:**
69
+ Use **AskQuestion** to ask which brainstorm to use, or whether to proceed without one.
70
+
71
+ **If no brainstorm found (or not relevant), run idea refinement:**
72
+
73
+ Refine the idea through collaborative dialogue using **AskQuestion**:
74
+
75
+ - Ask questions one at a time to understand the idea fully
76
+ - Prefer multiple choice questions when natural options exist
77
+ - Focus on understanding: purpose, constraints and success criteria
78
+ - Continue until the idea is clear OR user says "proceed"
79
+
80
+ **Gather signals for research decision.** During refinement, note:
81
+
82
+ - **User's familiarity**: Do they know the codebase patterns? Are they pointing to examples?
83
+ - **User's intent**: Speed vs thoroughness? Exploration vs execution?
84
+ - **Topic risk**: Security, payments, external APIs warrant more caution
85
+ - **Uncertainty level**: Is the approach clear or open-ended?
86
+
87
+ **Skip option:** If the feature description is already detailed, offer:
88
+ "Your description is clear. Should I proceed with research, or would you like to refine it further?"
89
+
90
+ ## Main Tasks
91
+
92
+ ### 1. Local Research (Always Runs - Parallel)
93
+
94
+ <thinking>
95
+ First, I need to understand the project's conventions, existing patterns, and any documented learnings. This is fast and local - it informs whether external research is needed.
96
+ </thinking>
97
+
98
+ Run these agents **in parallel** to gather local context:
99
+
100
+ - Task repo-research-analyst(feature_description)
101
+ - Task learnings-researcher(feature_description)
102
+
103
+ **What to look for:**
104
+
105
+ - **Repo research:** existing patterns, AGENTS.md guidance, technology familiarity, pattern consistency
106
+ - Also consider repo-level guidance files such as `AGENTS.md`.
107
+ - **Learnings:** documented solutions in `docs/solutions/` that might apply (gotchas, patterns, lessons learned)
108
+
109
+ These findings inform the next step.
110
+
111
+ ### 1.5. Planning Fidelity + Confidence + Research Mode (REQUIRED)
112
+
113
+ After Step 0 and local research, you MUST choose planning fidelity and confidence, then decide whether to run external research.
114
+
115
+ #### Fidelity
116
+
117
+ Select one: `Low | Medium | High`
118
+
119
+ - Select `High` if any high-risk trigger exists (security, payments, privacy, schema/data migrations or backfills, production infra/deployment risk, hard-to-reverse changes).
120
+ - Default to `Medium` when signals are mixed or unclear.
121
+ - Otherwise select `Low`.
122
+
123
+ #### Confidence
124
+
125
+ Select one: `High | Medium | Low`
126
+
127
+ - `High`: clear scope + strong pattern match + low ambiguity.
128
+ - `Medium`: some ambiguity but enough to proceed.
129
+ - `Low`: key constraints missing or major unresolved decisions.
130
+
131
+ If confidence is `Low`, ask 1-2 focused clarifying questions before finalizing the plan.
132
+
133
+ #### Research Mode
134
+
135
+ Decide whether to run external research.
136
+
137
+ Baseline policy (by fidelity):
138
+
139
+ - `Low`: optional
140
+ - `Medium`: recommended
141
+ - `High`: required
142
+
143
+ Override: high-risk topics always require external research, even if the user prefers speed.
144
+
145
+ **Required sections by fidelity** (ensure the chosen template includes these; see Step 4):
146
+
147
+ - **Low**: problem, constraints, acceptance criteria, implementation outline, verification checklist
148
+ - **Medium**: all Low + alternatives/tradeoffs, dependency/risk table, rollout notes, observability/test notes
149
+ - **High**: all Medium + failure modes, rollback plan, deployment gates, migration/data safety checks, expanded test matrix
150
+
151
+ Required announcement format:
152
+
153
+ ```
154
+ Fidelity selected: <Low|Medium|High>
155
+ Confidence: <High|Medium|Low>
156
+
157
+ Why this fidelity:
158
+ 1) ...
159
+ 2) ...
160
+
161
+ Research mode: local only | local + external
162
+ Open questions: none | <list>
163
+ ```
164
+
165
+ **When Open questions is not "none":** You MUST materialize them in the plan body as actionable items (see Step 2.5). If an unknown blocks implementation feasibility, prefer **Spike Candidates**. If confidence is `Low`, the plan MUST include at least one checkbox under Discussion Points or Spike Candidates so `/workflow:work` can create pending todos and triage can resolve them.
166
+
167
+ ### 1.5b. External Research (Conditional)
168
+
169
+ Run external research when Step 1.5 selected `local + external`.
170
+
171
+ Run these agents in parallel:
172
+
173
+ - Task best-practices-researcher(feature_description)
174
+ - Task framework-docs-researcher(feature_description)
175
+
176
+ ### 1.5c. Git History Research (Conditional)
177
+
178
+ Use git history research when historical context is likely to change the plan.
179
+
180
+ Policy:
181
+
182
+ - Fidelity `High`: recommended by default.
183
+ - Fidelity `Medium`: run when touching existing behavior, refactoring legacy areas, debugging regressions, or when repo patterns are unclear.
184
+ - Fidelity `Low`: usually skip.
185
+
186
+ If selected, run:
187
+
188
+ - Task git-history-analyzer(feature_description)
189
+
190
+ ### 1.6. Consolidate Research
191
+
192
+ After all research steps complete, consolidate findings:
193
+
194
+ - Document relevant file paths from repo research (e.g., `src/services/example_service.ts:42`)
195
+ - **Include relevant institutional learnings** from `docs/solutions/` (key insights, gotchas to avoid)
196
+ - Note external documentation URLs and best practices (if external research was done)
197
+ - List related issues or PRs discovered
198
+ - Capture AGENTS.md conventions
199
+
200
+ **Optional validation:** Briefly summarize findings and ask if anything looks off or missing before proceeding to planning.
201
+
202
+ ### 1.7. SpecFlow Analysis (by fidelity)
203
+
204
+ Run flow/gap analysis to surface missing requirements before locking structure:
205
+
206
+ - **Low fidelity:** optional (skip if scope is trivial)
207
+ - **Medium fidelity:** recommended
208
+ - **High fidelity:** required
209
+
210
+ When running: Task spec-flow-analyzer(feature_description, research_findings). Then incorporate identified gaps and edge cases into the upcoming issue structure and acceptance criteria.
211
+
212
+ ### 2. Issue Planning & Structure
213
+
214
+ <thinking>
215
+ Think like a product manager - what would make this issue clear and actionable? Consider multiple perspectives
216
+ </thinking>
217
+
218
+ **Title & Categorization (single contract):**
219
+
220
+ - [ ] **type**: one of `feat | fix | refactor` (used in filename and for issue prefix)
221
+ - [ ] **title**: clear, searchable human title **without** a type prefix (e.g., "Add user authentication", "Cart total calculation")
222
+ - [ ] **Filename**: `YYYY-MM-DD-<type>-<slug>-plan.md` where `<slug>` is kebab-case of the title (3–5 words, descriptive)
223
+ - Example: type `feat`, title "User authentication flow" → `2026-01-21-feat-user-authentication-flow-plan.md`
224
+ - Never embed a colon or space in the filename; keep plans findable by context
225
+
226
+ **Stakeholder Analysis:**
227
+
228
+ - [ ] Identify who will be affected by this issue (end users, developers, operations)
229
+ - [ ] Consider implementation complexity and required expertise
230
+
231
+ **Content Planning:**
232
+
233
+ - [ ] Choose appropriate detail level based on issue complexity and audience
234
+ - [ ] List all necessary sections for the chosen template
235
+ - [ ] Gather supporting materials (error logs, screenshots, design mockups)
236
+ - [ ] Prepare code examples or reproduction steps if applicable, name the mock filenames in the lists
237
+
238
+ ### 3. Incorporate SpecFlow (if Step 1.7 ran)
239
+
240
+ If SpecFlow was run in Step 1.7:
241
+
242
+ - [ ] Review SpecFlow analysis results
243
+ - [ ] Ensure any identified gaps or edge cases are reflected in the issue structure and acceptance criteria
244
+
245
+ ### 3.5. Discussion Points & Spike Candidates (REQUIRED when Open questions ≠ none)
246
+
247
+ When you declared Open questions in Step 1.5 (other than "none"), the plan file MUST include one or both of these sections with checkboxes so `/workflow:work` and `file-todos` can create pending todos for triage:
248
+
249
+ - **## Discussion Points (resolve/decide)** — Decisions to make (no code). Use `- [ ]` items (e.g. "Decide: X or Y?", "Confirm constraint Z").
250
+ - **## Spike Candidates (timeboxed)** — Timeboxed investigations to de-risk. Use `- [ ] Spike: <short description>` items.
251
+
252
+ Rules:
253
+
254
+ - If an unknown blocks implementation feasibility, prefer listing it under **Spike Candidates**.
255
+ - If confidence is `Low`, include at least one checkbox in one of these sections.
256
+ - These sections may appear after the main implementation content (e.g. after Acceptance Criteria or References) or in a dedicated "Unknowns & decisions" area; ensure they are in the written plan file when Open questions exist.
257
+
258
+ **When presenting Discussion Points (to the user or during triage):** (1) List a **concise numbered summary** of the points. (2) Walk through **each point one by one**; for each, discuss and align with the user; only then move on. Do not resolve all points in one turn.
259
+
260
+ ### 4. Choose Implementation Detail Level
261
+
262
+ Select how comprehensive you want the issue to be. Fidelity should drive this choice.
263
+
264
+ Mapping:
265
+
266
+ - Fidelity `Low` -> MINIMAL by default
267
+ - Fidelity `Medium` -> MORE by default
268
+ - Fidelity `High` -> A LOT by default
269
+
270
+ If the user explicitly requests a different level, allow it, but keep required fidelity sections.
271
+
272
+ #### 📄 MINIMAL (Quick Issue)
273
+
274
+ **Best for:** Simple bugs, small improvements, clear features
275
+
276
+ **Includes (required for Low fidelity):**
277
+
278
+ - Problem statement or feature description
279
+ - Constraints
280
+ - Basic acceptance criteria
281
+ - Implementation outline (e.g., MVP)
282
+ - Verification checklist
283
+ - Essential context only
284
+
285
+ **Structure:**
286
+
287
+ ````markdown
288
+ ---
289
+ title: [Issue Title]
290
+ type: [feat|fix|refactor]
291
+ status: active
292
+ date: YYYY-MM-DD
293
+ ---
294
+
295
+ # [Issue Title]
296
+
297
+ [Brief problem/feature description]
298
+
299
+ ## Constraints
300
+
301
+ [Key constraints (technical, scope, or policy)]
302
+
303
+ ## Acceptance Criteria
304
+
305
+ - [ ] Core requirement 1
306
+ - [ ] Core requirement 2
307
+
308
+ ## Context
309
+
310
+ [Any critical information]
311
+
312
+ ## MVP
313
+
314
+ ### example.ext
315
+
316
+ ```text
317
+ [Minimal pseudo code illustrating the MVP]
318
+ ```
319
+
320
+ ## Verification Checklist
321
+
322
+ - [ ] How to verify requirement 1
323
+ - [ ] How to verify requirement 2
324
+
325
+ ## References
326
+
327
+ - Related issue: #[issue_number]
328
+ - Documentation: [relevant_docs_url]
329
+ ````
330
+
331
+ #### 📋 MORE (Standard Issue)
332
+
333
+ **Best for:** Most features, complex bugs, team collaboration
334
+
335
+ **Includes everything from MINIMAL plus (required for Medium fidelity):**
336
+
337
+ - Detailed background and motivation
338
+ - Alternatives/tradeoffs
339
+ - Dependency/risk table
340
+ - Rollout notes
341
+ - Observability and test notes
342
+ - Success metrics
343
+ - Basic implementation suggestions
344
+
345
+ **Structure:**
346
+
347
+ ```markdown
348
+ ---
349
+ title: [Issue Title]
350
+ type: [feat|fix|refactor]
351
+ status: active
352
+ date: YYYY-MM-DD
353
+ ---
354
+
355
+ # [Issue Title]
356
+
357
+ ## Overview
358
+
359
+ [Comprehensive description]
360
+
361
+ ## Problem Statement / Motivation
362
+
363
+ [Why this matters]
364
+
365
+ ## Proposed Solution
366
+
367
+ [High-level approach]
368
+
369
+ ## Alternatives / Tradeoffs
370
+
371
+ [Other options considered and why this approach]
372
+
373
+ ## Technical Considerations
374
+
375
+ - Architecture impacts
376
+ - Performance implications
377
+ - Security considerations
378
+
379
+ ## Acceptance Criteria
380
+
381
+ - [ ] Detailed requirement 1
382
+ - [ ] Detailed requirement 2
383
+ - [ ] Testing requirements
384
+
385
+ ## Success Metrics
386
+
387
+ [How we measure success]
388
+
389
+ ## Dependencies & Risks (table)
390
+
391
+ | Dependency / Risk | Impact | Mitigation |
392
+ |-------------------|--------|------------|
393
+ | ... | ... | ... |
394
+
395
+ ## Rollout
396
+
397
+ [Phased rollout or release notes]
398
+
399
+ ## Observability & Test Plan
400
+
401
+ [What to monitor; how to test and validate]
402
+
403
+ ## References & Research
404
+
405
+ - Similar implementations: [file_path:line_number]
406
+ - Best practices: [documentation_url]
407
+ - Related PRs: #[pr_number]
408
+ ```
409
+
410
+ #### 📚 A LOT (Comprehensive Issue)
411
+
412
+ **Best for:** Major features, architectural changes, complex integrations
413
+
414
+ **Includes everything from MORE plus (required for High fidelity):**
415
+
416
+ - Detailed implementation plan with phases
417
+ - Failure modes and rollback plan
418
+ - Deployment gates and migration/data safety
419
+ - Expanded test matrix
420
+ - Resource requirements and timeline
421
+ - Future considerations and extensibility
422
+ - Documentation requirements
423
+
424
+ **Structure:**
425
+
426
+ ```markdown
427
+ ---
428
+ title: [Issue Title]
429
+ type: [feat|fix|refactor]
430
+ status: active
431
+ date: YYYY-MM-DD
432
+ ---
433
+
434
+ # [Issue Title]
435
+
436
+ ## Overview
437
+
438
+ [Executive summary]
439
+
440
+ ## Problem Statement
441
+
442
+ [Detailed problem analysis]
443
+
444
+ ## Proposed Solution
445
+
446
+ [Comprehensive solution design]
447
+
448
+ ## Technical Approach
449
+
450
+ ### Architecture
451
+
452
+ [Detailed technical design]
453
+
454
+ ### Implementation Phases
455
+
456
+ #### Phase 1: [Foundation]
457
+
458
+ - Tasks and deliverables
459
+ - Success criteria
460
+ - Estimated effort
461
+
462
+ #### Phase 2: [Core Implementation]
463
+
464
+ - Tasks and deliverables
465
+ - Success criteria
466
+ - Estimated effort
467
+
468
+ #### Phase 3: [Polish & Optimization]
469
+
470
+ - Tasks and deliverables
471
+ - Success criteria
472
+ - Estimated effort
473
+
474
+ ## Alternative Approaches Considered
475
+
476
+ [Other solutions evaluated and why rejected]
477
+
478
+ ## Acceptance Criteria
479
+
480
+ ### Functional Requirements
481
+
482
+ - [ ] Detailed functional criteria
483
+
484
+ ### Non-Functional Requirements
485
+
486
+ - [ ] Performance targets
487
+ - [ ] Security requirements
488
+ - [ ] Accessibility standards
489
+
490
+ ### Quality Gates
491
+
492
+ - [ ] Test coverage requirements
493
+ - [ ] Documentation completeness
494
+ - [ ] Code review approval
495
+
496
+ ## Success Metrics
497
+
498
+ [Detailed KPIs and measurement methods]
499
+
500
+ ## Dependencies & Prerequisites
501
+
502
+ [Detailed dependency analysis]
503
+
504
+ ## Risk Analysis & Mitigation
505
+
506
+ [Comprehensive risk assessment]
507
+
508
+ ## Failure Modes
509
+
510
+ [Key failure modes and how they manifest]
511
+
512
+ ## Rollback Plan
513
+
514
+ [How to roll back safely; triggers and steps]
515
+
516
+ ## Deployment Gates
517
+
518
+ [Pre-deploy checks and gates]
519
+
520
+ ## Migration / Data Safety
521
+
522
+ [Data migrations, backfills, and safety checks]
523
+
524
+ ## Expanded Test Matrix
525
+
526
+ [Test scenarios by dimension: env, role, data, edge cases]
527
+
528
+ ## Resource Requirements
529
+
530
+ [Team, time, infrastructure needs]
531
+
532
+ ## Future Considerations
533
+
534
+ [Extensibility and long-term vision]
535
+
536
+ ## Documentation Plan
537
+
538
+ [What docs need updating]
539
+
540
+ ## References & Research
541
+
542
+ ### Internal References
543
+
544
+ - Architecture decisions: [file_path:line_number]
545
+ - Similar features: [file_path:line_number]
546
+ - Configuration: [file_path:line_number]
547
+
548
+ ### External References
549
+
550
+ - Framework documentation: [url]
551
+ - Best practices guide: [url]
552
+ - Industry standards: [url]
553
+
554
+ ### Related Work
555
+
556
+ - Previous PRs: #[pr_numbers]
557
+ - Related issues: #[issue_numbers]
558
+ - Design documents: [links]
559
+ ```
560
+
561
+ ### 5. Issue Creation & Formatting
562
+
563
+ <thinking>
564
+ Apply best practices for clarity and actionability, making the issue easy to scan and understand
565
+ </thinking>
566
+
567
+ **Content Formatting:**
568
+
569
+ - [ ] Use clear, descriptive headings with proper hierarchy (##, ###)
570
+ - [ ] Include code examples in triple backticks with language syntax highlighting
571
+ - [ ] Add screenshots/mockups if UI-related (drag & drop or use image hosting)
572
+ - [ ] Use task lists (- [ ]) for trackable items that can be checked off
573
+ - [ ] Add collapsible sections for lengthy logs or optional details using `<details>` tags
574
+ - [ ] Apply appropriate emoji for visual scanning (🐛 bug, ✨ feature, 📚 docs, ♻️ refactor)
575
+ - If working in a repo/style that avoids emoji, omit them.
576
+
577
+ **Cross-Referencing:**
578
+
579
+ - [ ] Link to related issues/PRs using #number format
580
+ - [ ] Reference specific commits with SHA hashes when relevant
581
+ - [ ] Link to code using GitHub's permalink feature (press 'y' for permanent link)
582
+ - [ ] Mention relevant team members with @username if needed
583
+ - [ ] Add links to external resources with descriptive text
584
+
585
+ **Code & Examples:**
586
+
587
+ ````markdown
588
+ # Good example with syntax highlighting and line references
589
+
590
+ ```text
591
+ # path/to/file.ext:42
592
+ [Code snippet]
593
+ ```
594
+
595
+ # Collapsible error logs
596
+
597
+ <details>
598
+ <summary>Full error stacktrace</summary>
599
+
600
+ `Error details here...`
601
+
602
+ </details>
603
+ ````
604
+
605
+ **AI-Era Considerations:**
606
+
607
+ - [ ] Account for accelerated development with AI pair programming
608
+ - [ ] Include prompts or instructions that worked well during research
609
+ - [ ] Note which AI tools were used for initial exploration (Claude, Copilot, etc.)
610
+ - [ ] Emphasize comprehensive testing given rapid implementation
611
+ - [ ] Document any AI-generated code that needs human review
612
+
613
+ ### 6. Final Review & Submission
614
+
615
+ **Pre-submission Checklist:**
616
+
617
+ - [ ] Title is searchable and descriptive
618
+ - [ ] Labels accurately categorize the issue
619
+ - [ ] All template sections are complete
620
+ - [ ] Links and references are working
621
+ - [ ] Acceptance criteria are measurable
622
+ - [ ] Add names of files in pseudo code examples and todo lists
623
+ - [ ] Add an ERD mermaid diagram if applicable for new model changes
624
+
625
+ ## Write Plan File
626
+
627
+ **REQUIRED: Write the plan file to disk before presenting any options.**
628
+
629
+ ```bash
630
+ mkdir -p docs/plans/
631
+ ```
632
+
633
+ Write the complete plan file to `docs/plans/YYYY-MM-DD-<type>-<slug>-plan.md`. This step is mandatory and cannot be skipped — even when running as part of LFG/SLFG or other automated pipelines.
634
+
635
+ **When Open questions were declared (Step 1.5):** The written plan MUST include at least one of: `## Discussion Points (resolve/decide)` with `- [ ]` items, or `## Spike Candidates (timeboxed)` with `- [ ] Spike: ...` items. If confidence is `Low`, at least one checkbox is required in one of these sections. This ensures `file-todos` can create pending discussion/spike todos for `/workflow:triage`.
636
+
637
+ Confirm: "Plan written to docs/plans/[filename]"
638
+
639
+ **Non-interactive mode:** When the invocation is non-interactive (e.g., `workflow:plan` run by automation, CI, or with an explicit non-interactive flag/convention), skip AskQuestion calls and do not present Post-Generation Options. For determinism, the repo should define the flag or convention (e.g., in `AGENTS.md` Repo Config Block or a documented env var). Still **declare** Fidelity, Confidence, Research mode, and Open questions in the required announcement format before writing the plan. Use these defaults when user input is unavailable: fidelity = Medium, confidence = Medium, research mode = local + external for Medium/High risk topics else local only. Proceed directly to writing the plan file and then exit or return the plan path as output.
640
+
641
+ **Required in plan frontmatter:** Add these fields to the plan file:
642
+
643
+ - `fidelity: low|medium|high`
644
+ - `confidence: high|medium|low`
645
+
646
+ ## Output Format
647
+
648
+ **Filename:** Use the filename from Step 2 (Title & Categorization): `YYYY-MM-DD-<type>-<slug>-plan.md` with type and slug from the single contract.
649
+
650
+ ```
651
+ docs/plans/YYYY-MM-DD-<type>-<slug>-plan.md
652
+ ```
653
+
654
+ Examples:
655
+
656
+ - ✅ `docs/plans/2026-01-15-feat-user-authentication-flow-plan.md`
657
+ - ✅ `docs/plans/2026-02-03-fix-checkout-race-condition-plan.md`
658
+ - ✅ `docs/plans/2026-03-10-refactor-api-client-extraction-plan.md`
659
+ - ❌ `docs/plans/2026-01-15-feat-thing-plan.md` (not descriptive - what "thing"?)
660
+ - ❌ `docs/plans/2026-01-15-feat-new-feature-plan.md` (too vague - what feature?)
661
+ - ❌ `docs/plans/2026-01-15-feat: user auth-plan.md` (invalid characters - colon and space)
662
+ - ❌ `docs/plans/feat-user-auth-plan.md` (missing date prefix)
663
+
664
+ ## Post-Generation Options
665
+
666
+ After writing the plan file, use **AskQuestion** to present these options:
667
+
668
+ **Question:** "Plan ready at `docs/plans/YYYY-MM-DD-<type>-<slug>-plan.md`. What would you like to do next?"
669
+
670
+ **Options:**
671
+
672
+ 1. **Open plan in editor** - Open the plan file for review
673
+ 2. **Review and refine** - Improve the document through structured self-review
674
+ 3. **Start `/workflow:work`** - Begin implementing this plan locally
675
+ 4. **Create Issue** - Create issue in project tracker (GitHub/Linear)
676
+ 5. **Other** - Adjust the plan
677
+
678
+ Optional (only if those workflows exist in this repo):
679
+
680
+ - `/deepen-plan` - Enhance each section with parallel research agents
681
+ - **Technical review** - Load `technical-review` skill for technical correctness (no edits). Pair with `document-review` to apply any agreed changes to the plan.
682
+
683
+ Based on selection:
684
+
685
+ - **Open plan in editor** → Open the plan file in the editor (navigate to `docs/plans/<plan_filename>.md`)
686
+ - **Review and refine** → Load `document-review` skill.
687
+ - **Technical review** → Load `technical-review` skill; then if user agrees to changes, load `document-review` to update the plan.
688
+ - **Create Issue** → See "Issue Creation" section below
689
+ - **Other** → Accept free text for rework or specific changes
690
+
691
+ **Note:** Only if `/deepen-plan` exists in this repo and the user has enabled it (e.g., ultrathink), you may run `/deepen-plan` after plan creation for extra depth; it is optional, not required.
692
+
693
+ Loop back to options after changes until user selects `/workflow:work` or ends the session.
694
+
695
+ ## Issue Creation
696
+
697
+ When user selects "Create Issue", detect their project tracker from repo guidance (e.g., `AGENTS.md`):
698
+
699
+ 1. **Check for tracker preference** in guidance files (project or global):
700
+
701
+ - Look for `project_tracker: github` or `project_tracker: linear`
702
+ - Or look for mentions of "GitHub Issues" or "Linear" in their workflow section
703
+
704
+ 2. **If GitHub:**
705
+
706
+ Use **type** and **title** from Step 2 (title has no prefix). Compose issue title as `"<type>: <title>"` (e.g., `feat: User authentication flow`).
707
+
708
+ If the `gh` CLI is available, create the issue via:
709
+
710
+ ```bash
711
+ gh issue create --title "<type>: <title>" --body-file <plan_path>
712
+ ```
713
+
714
+ Otherwise, provide the composed title + body for manual issue creation.
715
+
716
+ 3. **If Linear:**
717
+
718
+ Use **type** and **title** from Step 2. For Linear, use either the full title or `"<type>: <title>"` per team convention.
719
+
720
+ If the `linear` CLI is available, create the issue via:
721
+
722
+ ```bash
723
+ linear issue create --title "<type>: <title>" --description "$(cat <plan_path>)"
724
+ ```
725
+
726
+ Otherwise, provide the composed title + body for manual issue creation.
727
+
728
+ 4. **If no tracker configured:**
729
+ Ask user: "Which project tracker do you use? (GitHub/Linear/Other)"
730
+
731
+ - Suggest adding `project_tracker: github` or `project_tracker: linear` to their AGENTS.md
732
+
733
+ 5. **After creation:**
734
+ - Display the issue URL
735
+ - Ask if they want to proceed to `/workflow:work`
736
+
737
+ NEVER CODE! Just research and write the plan.