owflow 0.1.10 → 0.3.0

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 (82) hide show
  1. package/README.md +81 -28
  2. package/dist/agents/code-reviewer.md +1 -1
  3. package/dist/agents/production-readiness-checker.md +1 -1
  4. package/dist/agents/project-analyzer.md +0 -1
  5. package/dist/agents/task-classifier.md +3 -3
  6. package/dist/commands/agents-md-generator.md +36 -0
  7. package/dist/commands/dev-analyze.md +33 -0
  8. package/dist/commands/dev-bugfix.md +37 -0
  9. package/dist/commands/dev-finalize.md +33 -0
  10. package/dist/commands/dev-implement.md +34 -0
  11. package/dist/commands/dev-plan.md +37 -0
  12. package/dist/commands/dev-spec.md +37 -0
  13. package/dist/commands/dev-tdd-red.md +33 -0
  14. package/dist/commands/dev-verify.md +33 -0
  15. package/dist/commands/development.md +11 -12
  16. package/dist/commands/diagrams-mermaid.md +3 -4
  17. package/dist/commands/flow-init.md +3 -4
  18. package/dist/commands/goal-development.md +32 -0
  19. package/dist/commands/html-renderer.md +3 -4
  20. package/dist/commands/migration.md +3 -4
  21. package/dist/commands/performance.md +3 -4
  22. package/dist/commands/research.md +3 -4
  23. package/dist/commands/reviews-code.md +4 -4
  24. package/dist/commands/reviews-pragmatic.md +4 -4
  25. package/dist/commands/reviews-production-readiness.md +4 -4
  26. package/dist/commands/reviews-reality-check.md +4 -4
  27. package/dist/commands/reviews-spec-audit.md +4 -4
  28. package/dist/commands/rule-reviewer.md +38 -0
  29. package/dist/commands/standards-discover.md +3 -4
  30. package/dist/commands/standards-update.md +3 -4
  31. package/dist/commands/work.md +19 -19
  32. package/dist/configuration/agents-config.js +66 -0
  33. package/dist/configuration/commands-config.js +21 -0
  34. package/dist/configuration/skills-config.js +10 -0
  35. package/dist/constants.js +4 -0
  36. package/dist/hooks/before-tool.js +19 -0
  37. package/dist/hooks/session-compaction.js +19 -0
  38. package/dist/index.js +11 -142
  39. package/dist/skills/agents-md-generator/SKILL.md +223 -0
  40. package/dist/skills/codebase-analyzer/SKILL.md +1 -1
  41. package/dist/skills/dev-analyze/SKILL.md +115 -0
  42. package/dist/skills/dev-bugfix/SKILL.md +452 -0
  43. package/dist/skills/dev-finalize/SKILL.md +118 -0
  44. package/dist/skills/dev-implement/SKILL.md +167 -0
  45. package/dist/skills/dev-plan/SKILL.md +147 -0
  46. package/dist/skills/dev-spec/SKILL.md +182 -0
  47. package/dist/skills/dev-tdd-red/SKILL.md +94 -0
  48. package/dist/skills/dev-verify/SKILL.md +160 -0
  49. package/dist/skills/development/SKILL.md +130 -522
  50. package/dist/skills/diagrams-mermaid/SKILL.md +3 -1
  51. package/dist/skills/docs-manager/SKILL.md +4 -4
  52. package/dist/skills/docs-manager/references/agents-md-template.md +1 -1
  53. package/dist/skills/flow-init/SKILL.md +34 -13
  54. package/dist/skills/goal-development/SKILL.md +96 -0
  55. package/dist/skills/html-renderer/SKILL.md +14 -1
  56. package/dist/skills/implementation-plan-executor/SKILL.md +1 -1
  57. package/dist/skills/implementation-verifier/SKILL.md +1 -1
  58. package/dist/skills/migration/SKILL.md +63 -18
  59. package/dist/skills/orchestrator-framework/SKILL.md +1 -1
  60. package/dist/skills/orchestrator-framework/references/command-namespacing.md +7 -0
  61. package/dist/skills/orchestrator-framework/references/confirm-or-revise-exception.md +20 -0
  62. package/dist/skills/orchestrator-framework/references/delegation-rules.md +54 -0
  63. package/dist/skills/orchestrator-framework/references/dispatcher-handoff.md +20 -0
  64. package/dist/skills/orchestrator-framework/references/gate-contract.md +104 -0
  65. package/dist/skills/orchestrator-framework/references/orchestrator-creation-checklist.md +3 -0
  66. package/dist/skills/orchestrator-framework/references/orchestrator-patterns.md +8 -50
  67. package/dist/skills/performance/SKILL.md +52 -18
  68. package/dist/skills/research/SKILL.md +57 -24
  69. package/dist/skills/rule-reviewer/SKILL.md +334 -0
  70. package/dist/skills/standards-discover/SKILL.md +37 -14
  71. package/dist/skills/standards-update/SKILL.md +58 -10
  72. package/dist/templates/orchestrator-state-development.yml +14 -13
  73. package/dist/utils/file-util.js +25 -0
  74. package/package.json +6 -4
  75. package/dist/__tests__/verify_template.test.js +0 -102
  76. package/dist/commands/quick-bugfix.md +0 -37
  77. package/dist/commands/quick-dev.md +0 -182
  78. package/dist/commands/quick-plan.md +0 -167
  79. package/dist/skills/quick-bugfix/SKILL.md +0 -311
  80. package/dist/templates/quick-bugfix-task.yml +0 -10
  81. package/dist/templates/quick-dev-task.yml +0 -10
  82. package/dist/templates/quick-plan-task.yml +0 -11
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: owflow:dev-implement
3
+ description: Development — execute the implementation plan via delegation, then the TDD Green Gate when a red gate exists. --quick selects the condensed direct path (bootstrap a task here when no state file exists; direct implementation when it does).
4
+ argument-hint: "[task-path-or-identifier | \"description\"] [--quick]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Dev Implement — Implementation & TDD Green Gate (implementation-done, tdd-green-proven)
9
+
10
+ Work phase of the development workflow. Executes the implementation plan via delegation, then verifies the TDD red-gate test now passes when one exists.
11
+
12
+ Supports a **quick mode** (`--quick`): a condensed path that implements **directly in the main agent** with the discovered standards — never routed through `implementation-plan-executor`. On a description argument with no existing task it first bootstraps a standard development task (state file, condensed spec + plan); on an existing task it applies `--quick` to the implementation itself (e.g., a quick plan). After the Exit Gate, the pipeline can either stop there or continue with `/owflow:dev-verify` — the task is a regular development task, resumable by any dev-* subskill.
13
+
14
+ ## Entry Gate
15
+
16
+ Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). The argument may be:
17
+
18
+ - **Path** (absolute or project-relative) to the task directory — use as-is.
19
+ - **Identifier** — exact directory name inside `.owflow/tasks/development/` (e.g., `2026-01-12-my-task`); resolve to its path.
20
+ - **Description** — anything else (quoted free text, e.g. `"Add a logout button to the navbar"`) is treated as a new task description for quick bootstrap.
21
+
22
+ Route by argument kind and flags:
23
+
24
+ | Situation | Route |
25
+ | ---------------------------------------------------------------- | -------------------------------------------- |
26
+ | Task path/identifier, no `--quick`, state + spec + plan exist (or only implementation pending) | Normal implementation below |
27
+ | Task path/identifier, `--quick`, spec + plan exist | Direct implementation (quick mode) — the flag selects the direct path over delegation |
28
+ | Task path/identifier, `--quick`, spec or plan missing | Quick prelude for the missing pieces, then direct implementation |
29
+ | Task path/identifier of a dev-bugfix task (`entry_point: "dev-bugfix"`, implementation slugs complete, no spec/plan) | Normal implementation below — implement nothing; if `implementation-done` holds, run the green gate when a red gate exists, then Exit Gate (or suggest `/owflow:dev-verify <task-path>` for the verification pipeline) |
30
+ | Description argument, `--quick` (or no argument after prompt) | Quick bootstrap (create task + condensed prelude), then normal implementation |
31
+ | Description argument, no `--quick` | Ask via `question`: quick condensed task / full pipeline (blocked block below) / cancel |
32
+ | Missing argument | Prompt for input (path, identifier, or description), then re-route |
33
+
34
+ If the path does **not exist** or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
35
+
36
+ 1. Steps that must be completed first (in order), each with its command:
37
+ - Codebase & gap analysis (`codebase-analysed`, `gap-analysed`) → `/owflow:dev-analyze <task-path>`
38
+ - TDD red gate (`tdd-red-proven`) — only when a reproducible defect was detected → `/owflow:dev-tdd-red <task-path>`
39
+ - Requirements, specification & audit (`spec-written`, `spec-audited`) → `/owflow:dev-spec <task-path>`
40
+ - Implementation planning (`plan-created`) → `/owflow:dev-plan <task-path>`
41
+ 2. List available dev-task identifiers (directories under `.owflow/tasks/development/`) to resume from, if any.
42
+ 3. Hint: `Run /owflow:development <description> to start a task from scratch, /owflow:dev-implement --quick "<description>" for a condensed quick task, or pass a task path/identifier to resume.`
43
+
44
+ ### Prerequisites
45
+
46
+ | Required for this skill | Where verified | Produced by |
47
+ | ----------------------- | ------------------------------------------- | -------------------------------- |
48
+ | State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:development <desc>` or quick bootstrap |
49
+ | Spec approved | `implementation/spec.md` exists | `/owflow:dev-spec <task-path>` or quick prelude |
50
+ | Plan approved | `implementation/implementation-plan.md` exists | `/owflow:dev-plan <task-path>` or quick prelude |
51
+
52
+ 1. **Read `orchestrator-state.yml`** from the task path. If missing → quick bootstrap (see Quick Mode), otherwise mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `implementation-done`): `question` — bootstrap a fresh standard task starting at this step, or decline → print: `No development task found at <path>. Run /owflow:development <description> to start a task from scratch.` and STOP.
53
+ 2. **Skip/resume**: if `implementation-done` is in `completed_phases`, skip to the TDD green gate.
54
+ 3. **Prerequisite check**: `implementation/spec.md` AND `implementation/implementation-plan.md` exist — **unless `implementation-done` is in `completed_phases`** (dev-bugfix task or re-run: spec/plan are not required; go straight to the skip/resume TDD green gate). If missing → run the Quick prelude for the missing pieces (`--quick` or user chooses quick), otherwise print the blocked block, then STOP:
55
+ - Steps that must be completed first: analysis (`codebase-analysed`, `gap-analysed`) → TDD red gate (`tdd-red-proven`, only when a reproducible defect was detected) → specification (`spec-written`) → implementation planning (`plan-created`).
56
+ - `Run /owflow:dev-spec and /owflow:dev-plan <task-path> first` (or `/owflow:dev-analyze <task-path>` / `/owflow:dev-spec <task-path>` for the missing earlier steps).
57
+ - If no task exists yet: `Run /owflow:development <description> to start a task from scratch, or /owflow:dev-implement --quick "<description>" for a condensed quick task.`
58
+
59
+ ## Quick Mode (condensed prelude → normal implementation)
60
+
61
+ Quick mode produces the same artifacts as the early pipeline phases — just condensed into one pass inside this skill. It does NOT introduce a second state format: the task gets a standard `orchestrator-state.yml` and standard artifacts, so every other dev-* subskill can pick it up afterwards.
62
+
63
+ ### Quick bootstrap (no state file, description argument)
64
+
65
+ 1. **Create Task Directory**: `.owflow/tasks/development/YYYY-MM-DD-task-name/` (3–5 kebab-case words from the description).
66
+ 2. **Initialize State**: create `orchestrator-state.yml` from the development template with `task.title` / `task.description` from the description, `task.status: in_progress`, `orchestrator.entry_point: "dev-implement --quick"`, and `task_context.task_characteristics.has_reproducible_defect` set to `true` ONLY when the description is clearly bug-shaped (symptom + expected vs actual); otherwise `false`. Bug-shaped descriptions with a reproducible defect → suggest `/owflow:dev-bugfix` instead (TDD red gate discipline, same standard state) — `/owflow:dev-bugfix "<description>"` produces this same task shape under `.owflow/tasks/development/` — unless the user insists on proceeding here.
67
+ - **CRITICAL**: use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-development.yml`.
68
+ 3. **Discover project documentation**: read `.owflow/docs/INDEX.md` (if exists) and extract the Project Documentation file paths into `project_context.project_doc_paths` (matching the development dispatcher's initialization).
69
+ 4. If `.owflow/docs/` does not exist, proceed without standards and note the graceful-fallback hint in the completion message: `"No AI SDLC standards found. Consider running /owflow:flow-init to initialize project documentation and coding standards."`
70
+
71
+ ### Quick prelude (one condensed pass)
72
+
73
+ **MANDATORY order — standards before analysis, analysis before spec/plan:**
74
+
75
+ 1. **Standards discovery**: identify applicable standards from INDEX.md by task keywords (e.g., "API" → api/error-handling, "form" → validation/accessibility) and **READ each applicable standard file** with the Read tool — reading INDEX.md alone is NOT sufficient. Record the paths in `project_context.standards_applied` (extra state field) and reference them in the spec.
76
+ 2. **Brief codebase analysis**: explore the affected areas (Glob, Grep, Read) — enough to identify affected files/modules, existing patterns, and test strategy. Write `analysis/quick-analysis.md` (affected files, approach sketch, standards referenced). Extract a 1–2 sentence summary into `phase_summaries.quick_analysis`.
77
+ 3. **Condensed spec**: write `implementation/spec.md` — goal, scope (in/out), requirements, applicable standards with key guidelines, verification criteria. Mark `spec-written` complete (`phase_summaries.specification` summary).
78
+ 4. **Condensed plan**: write `implementation/implementation-plan.md` — 1–3 task groups, each with concrete checkable steps and tests. Use the same on-the-fly plan shape as the dev-plan quick prelude: key discoveries with `file:line` references, a "What We're NOT Doing" out-of-scope list, intent + contract per step (no code snippets unless non-obvious), automated vs manual acceptance criteria, and no open questions (resolve before finalizing). Mark `plan-created` complete.
79
+ 5. **Approval gate** — use `question`: present the mini plan (goal, approach, affected files, task groups) and ask "Proceed with implementation?" Options: **Approve and implement** / **Adjust** (rework spec/plan, re-ask) / **Run full pipeline instead** (print `/owflow:development <task-path>` and STOP — do not implement) / **Cancel**.
80
+ 6. On approval: append `codebase-analysed` and `gap-analysed` to `completed_phases` (quick analysis covers both; note the condensation in `phase_summaries.codebase_analysis` / `phase_summaries.gap_analysis`), bump `orchestrator.updated`, re-run `verify_template` on the state file.
81
+
82
+ The TDD red gate is SKIPPED in quick mode (no `tdd-red-proven`), and the green gate below is therefore skipped too. `spec-audited` is skipped — the approval gate in step 5 substitutes for the audit.
83
+
84
+ Then continue with **Direct Implementation (quick mode)** below.
85
+
86
+ ### Direct implementation (quick mode, `implementation-done`)
87
+
88
+ **Trigger**: quick mode selected for this run — the `--quick` flag on this invocation, or the task bootstrapped/prelude-run in quick mode this session (`orchestrator.entry_point: "dev-implement --quick"`). Quick mode NEVER routes to `implementation-plan-executor` — the main agent implements directly, applying the standards already read in prelude step 1 (for a pre-existing plan, apply the standards listed in its "Standards Compliance" section). (Normal full-pipeline runs always delegate — see Execute below.)
89
+
90
+ 1. **Work through the condensed plan's task groups in order**, following each step's intent and contract.
91
+ 2. **Apply standards**: for every code change, verify it follows the applicable standards from `project_context.standards_applied`. If implementation reveals new areas (auth, database, file handling, ...) whose standards were not read in the prelude, check `.owflow/docs/INDEX.md` and READ the applicable standard files before proceeding; append their paths to `project_context.standards_applied`.
92
+ 3. **Tests**: run the plan's tests as steps specify (test-driven order per group: tests → implementation → verify). Fix failures before moving on.
93
+ 4. **Mark checkboxes** in `implementation/implementation-plan.md` immediately after each step completes (main agent responsibility — same convention as implementation-plan-executor).
94
+ 5. **Work-log**: append per-group entries and a completion entry to `implementation/work-log.md` (files changed, standards applied — prelude-read and discovered, test results).
95
+
96
+ ## Execute (normal runs — full pipeline)
97
+
98
+ **Read first**: the [Delegation Rules](../orchestrator-framework/references/delegation-rules.md).
99
+
100
+ **Scope**: normal runs only — task created via the full pipeline, or a quick task resumed **without** `--quick` (e.g., a `/owflow:dev-plan --quick` task continued with `/owflow:dev-implement <task-path>`; the executor picks up uncompleted groups). Quick mode uses Direct implementation above instead of this section.
101
+
102
+ ### Implementation (`implementation-done`) — Skill tool
103
+
104
+ **ANTI-PATTERN (normal runs) — never implement directly. "Simple enough to code inline" is NOT a reason to skip delegation.**
105
+
106
+ Skill tool - `implementation-plan-executor`. Pass: task_path, task_description, task_characteristics, `phase_summaries`, research context if present in state. The skill manages its own subagents, incremental tests, and `implementation/work-log.md`.
107
+
108
+ ### TDD Green Gate (`tdd-green-proven`, conditional)
109
+
110
+ **Skip if** `tdd-red-proven` is NOT in `completed_phases` (no red gate exists).
111
+
112
+ 1. Run the test written in the red gate (path recorded in `implementation/tdd-red-gate.md`).
113
+ 2. **It MUST pass** — proves the defect is fixed. On failure: fix implementation and retry (up to 5 attempts: syntax, imports, test alignment). Still failing → `question`: continue fixing, return to `/owflow:dev-implement` implementation work, or stop.
114
+ 3. Write results to `implementation/tdd-green-gate.md`; set `task_context.tdd_green_passed: true`.
115
+
116
+ ## State Update Convention (per step)
117
+
118
+ Apply after EVERY phase/step above:
119
+
120
+ 1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the step slug actually performed plus that step's fields. Never batch multiple steps into one end-of-skill write:
121
+ - After implementation (direct quick implementation or plan execution complete): append `implementation-done` to `completed_phases`; extract 1-2 sentence summary to `phase_summaries.implementation` (task groups completed, files changed, test results, known issues); bump `orchestrator.updated`.
122
+ - After the green gate (only when it ran — no red gate ⇒ no `tdd-green-proven`): append `tdd-green-proven` to `completed_phases`; set `task_context.tdd_green_passed: true`; bump `orchestrator.updated`.
123
+ 2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
124
+ 3. **Failures** — if the direct implementation or green gate ultimately fails (retries exhausted, user stops): do NOT append the corresponding slug to `completed_phases`; append it to `orchestrator.failed_phases` and increment `auto_fix_attempts["<slug>"]`. Partial progress stays documented in `phase_summaries.implementation` and `implementation/work-log.md`.
125
+ 4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-development.yml`. Fix any reported issue immediately before proceeding.
126
+ 5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
127
+
128
+ ## Exit Gate
129
+
130
+ Present results, get user confirmation, then hand off (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
131
+
132
+ ### Results box
133
+
134
+ ```markdown
135
+ ## ✅ DEV IMPLEMENT COMPLETE — <task name>
136
+
137
+ **Task groups** — [completed groups / total]
138
+ **Files changed** — [count + key files, 1-3 lines]
139
+ **Tests** — [incremental test results]
140
+ **Green gate** — [✅ PASSED / not required (no red gate)]
141
+ **Known issues** — [deferred items / "none"]
142
+ **Entry point** — [quick bootstrap (direct implementation) / full pipeline (delegated)]
143
+
144
+ **Artifacts**
145
+ - implemented code
146
+ - `implementation/work-log.md`
147
+ - `implementation/tdd-green-gate.md` [conditional]
148
+ ```
149
+
150
+ ### Results-acceptance question
151
+
152
+ Use `question` — "Are these results correct?" with options:
153
+
154
+ - **Accept** — implementation matches the plan; continue.
155
+ - **Adjust** — re-work the affected task groups (fix code, re-run their tests), update state and work-log, re-present the results box.
156
+ - **Discuss** — walk through implementation details (decisions made, files changed, deferred items) in more depth; then re-ask.
157
+ - **Stop here** — print the resume command (`/owflow:dev-implement <task-path>`) and end. The task is a regular development task; `/owflow:dev-verify <task-path>` (or `/owflow:development <task-path>`) continues the pipeline later.
158
+
159
+ ### Next steps (after Accept)
160
+
161
+ - `→ /owflow:dev-verify <task-path>` — `required` before commit: runs the verification pipeline (completeness, code review with a bounded fix loop) and must pass before finalization. Remaining after: finalize.
162
+
163
+ **Other options**:
164
+
165
+ - `/owflow:goal-development <task-path>` — `optional` shortcut: runs all remaining phases in one loop (verify → finalize)
166
+
167
+ Then STOP.
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: owflow:dev-plan
3
+ description: Development — break the approved specification into a grouped, dependency-ordered implementation plan. --quick starts a condensed task here when no state file exists.
4
+ argument-hint: "[task-path-or-identifier | \"description\"] [--quick]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Dev Plan — Implementation Planning (plan-created)
9
+
10
+ Work phase of the development workflow. Delegates planning to break the specification into task groups with dependencies, then refines the plan with an execution diagram.
11
+
12
+ Supports a **quick mode** (`--quick`, or any description argument with no existing task): a condensed prelude that bootstraps a standard development task (state file, standards discovery, quick analysis, condensed spec) and then writes the implementation plan directly on the fly — no planner subagent. After the Exit Gate, the pipeline can either stop there — the plan alone may be enough — or continue with `/owflow:dev-implement`. The task is a regular development task, resumable by any dev-* subskill.
13
+
14
+ ## Entry Gate
15
+
16
+ Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). The argument may be:
17
+
18
+ - **Path** (absolute or project-relative) to the task directory — use as-is.
19
+ - **Identifier** — exact directory name inside `.owflow/tasks/development/` (e.g., `2026-01-12-my-task`); resolve to its path.
20
+ - **Description** — anything else (quoted free text, e.g. `"Add a logout button to the navbar"`) is treated as a new task description for quick bootstrap.
21
+
22
+ Route by argument kind and flags:
23
+
24
+ | Situation | Route |
25
+ | ---------------------------------------------------------------- | -------------------------------------------- |
26
+ | Task path/identifier, state + spec exist | Normal planning below |
27
+ | Task path/identifier, `--quick`, state or spec missing | Quick bootstrap/prelude for the missing pieces, then normal planning |
28
+ | Description argument, `--quick` (or no argument after prompt) | Quick bootstrap (create task + condensed prelude), then normal planning |
29
+ | Description argument, no `--quick` | Ask via `question`: quick plan-only task / full pipeline (blocked block below) / cancel |
30
+ | Missing argument | Prompt for input (path, identifier, or description), then re-route |
31
+
32
+ If the path does **not exist** or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
33
+
34
+ 1. Steps that must be completed first (in order), each with its command:
35
+ - Codebase & gap analysis (`codebase-analysed`, `gap-analysed`) → `/owflow:dev-analyze <task-path>`
36
+ - TDD red gate (`tdd-red-proven`) — only when a reproducible defect was detected → `/owflow:dev-tdd-red <task-path>`
37
+ - Requirements, specification & audit (`spec-written`, `spec-audited`) → `/owflow:dev-spec <task-path>`
38
+ 2. List available dev-task identifiers (directories under `.owflow/tasks/development/`) to resume from, if any.
39
+ 3. Hint: `Run /owflow:development <description> to start a task from scratch, /owflow:dev-plan --quick "<description>" for a quick plan-only task, or pass a task path/identifier to resume.`
40
+
41
+ ### Prerequisites
42
+
43
+ | Required for this skill | Where verified | Produced by |
44
+ | ----------------------- | ---------------------------------------------------- | -------------------------------- |
45
+ | State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:development <desc>` or quick bootstrap |
46
+ | Spec approved | `implementation/spec.md` exists | `/owflow:dev-spec <task-path>` or quick prelude |
47
+
48
+ 1. **Read `orchestrator-state.yml`** from the task path. If missing → quick bootstrap (see Quick Mode), otherwise mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `plan-created`): `question` — bootstrap a fresh standard task starting at this step, or decline → print: `No development task found at <path>. Run /owflow:development <description> to start a task from scratch, or /owflow:dev-plan --quick "<description>" for a quick plan-only task.` and STOP.
49
+ 2. **Skip/resume**: if `plan-created` is in `completed_phases`, report the existing plan summary and route to the Exit Gate.
50
+ 3. **Prerequisite check**: `implementation/spec.md` exists (spec approved during `spec-written`). If missing → run the Quick prelude for the missing pieces (`--quick` or user chooses quick), otherwise print the blocked block, then STOP:
51
+ - Steps that must be completed first: analysis (`codebase-analysed`, `gap-analysed`) → TDD red gate (`tdd-red-proven`, only when a reproducible defect was detected) → specification (`spec-written`).
52
+ - `Run /owflow:dev-spec <task-path> first` (or `/owflow:dev-analyze <task-path>` if analysis is also missing).
53
+ - If no task exists yet: `Run /owflow:development <description> to start a task from scratch, or /owflow:dev-plan --quick "<description>" for a quick plan-only task.`
54
+
55
+ ## Quick Mode (condensed prelude → plan on the fly)
56
+
57
+ Quick mode produces the same artifacts as the early pipeline phases — just condensed into one pass inside this skill. It does NOT introduce a second state format: the task gets a standard `orchestrator-state.yml` and standard artifacts, so every other dev-* subskill can pick it up afterwards.
58
+
59
+ ### Quick bootstrap (no state file, description argument)
60
+
61
+ 1. **Create Task Directory**: `.owflow/tasks/development/YYYY-MM-DD-task-name/` (3–5 kebab-case words from the description).
62
+ 2. **Initialize State**: create `orchestrator-state.yml` from the development template with `task.title` / `task.description` from the description, `task.status: in_progress`, and `orchestrator.entry_point: "dev-plan --quick"`.
63
+ - **CRITICAL**: use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-development.yml`.
64
+ 3. **Discover project documentation**: read `.owflow/docs/INDEX.md` (if exists) and extract the Project Documentation file paths into `project_context.project_doc_paths` (matching the development dispatcher's initialization).
65
+ 4. If `.owflow/docs/` does not exist, proceed without standards and note the graceful-fallback hint in the completion message: `"No AI SDLC standards found. Consider running /owflow:flow-init to initialize project documentation and coding standards."`
66
+
67
+ ### Quick prelude (one condensed pass)
68
+
69
+ **MANDATORY order — standards before analysis, analysis before spec/plan:**
70
+
71
+ 1. **Standards discovery**: identify applicable standards from INDEX.md by task keywords (e.g., "API" → api/error-handling, "form" → validation/accessibility) and **READ each applicable standard file** with the Read tool — reading INDEX.md alone is NOT sufficient. Record the paths in `project_context.standards_applied` (extra state field).
72
+ 2. **Brief codebase analysis**: explore the affected areas (Glob, Grep, Read) — enough to identify affected files/modules, existing patterns, and constraints that inform the plan. Write `analysis/quick-analysis.md` (affected files, approach sketch, standards referenced). Extract a 1–2 sentence summary into `phase_summaries.quick_analysis`.
73
+ 3. **Condensed spec**: write `implementation/spec.md` — goal, scope (in/out), requirements, applicable standards with key guidelines, verification criteria. Mark `spec-written` complete (`phase_summaries.specification` summary).
74
+ 4. **Condensed plan — written directly, NO delegation**: write `implementation/implementation-plan.md` on the fly, keeping the executor-compatible shape (1–3 task groups, `Dependencies:` per group, `- [ ] N.1 / N.2 / …` steps, acceptance criteria per group) and applying these quality rules:
75
+ - **Key discoveries first** — open with 2–4 discoveries from the quick analysis, each with a `file:line` reference (pattern to follow, constraint to respect, existing component to reuse).
76
+ - **"What We're NOT Doing"** — an explicit out-of-scope list to fence scope creep.
77
+ - **Intent before implementation** — each step names WHAT and WHY (intent) plus the touched interface or invariant (contract: route, signature, schema field, invariant). No code snippets unless the change is genuinely non-obvious.
78
+ - **Verification split** — acceptance criteria distinguish automated checks (specific test commands) from manual checks.
79
+ - **No open questions** — every decision is made before the plan is final; resolve ambiguities during the quick analysis (decide, or ask via `question`), never write TBDs.
80
+ This REPLACES the `implementation-planner` delegation in Execute below (quick mode is the only exception to the delegation anti-pattern). Mark `plan-created` complete (`phase_summaries.planning` summary).
81
+
82
+ The TDD red gate is SKIPPED in quick mode (no `tdd-red-proven`), and `spec-audited` is skipped — plan approval at the Exit Gate substitutes for the audit.
83
+
84
+ Then continue with the **Post-Plan Diagram** gate below (both modes).
85
+
86
+ ## Execute (full pipeline — delegated planning)
87
+
88
+ **Read first**: the [Delegation Rules](../orchestrator-framework/references/delegation-rules.md).
89
+
90
+ **ANTI-PATTERN — never write implementation-plan.md yourself in the full pipeline. "This is simple enough to plan inline" is NOT a reason to skip delegation. (Quick mode is the ONLY exception — its prelude step 4 writes the plan directly and skips this section.)**
91
+
92
+ Task tool - `implementation-planner`. Pass: task_path, task_description, task_characteristics, `phase_summaries` (specification, gap_analysis, codebase_analysis), research/quick context if present in state. Output: `implementation/implementation-plan.md`.
93
+
94
+ ## Post-Plan Diagram (optional — both modes)
95
+
96
+ 1. **Diagram gate** — use `question`: "Add an execution diagram to the implementation plan?" Options:
97
+ - **Add diagram** — run the refinement step below.
98
+ - **Skip diagram** — the plan stays as-is; neither choice affects plan approval.
99
+ 2. Only on **Add diagram** — Skill tool - `diagrams-mermaid` on `implementation/implementation-plan.md` (content-preserving): add a compact execution diagram (task-group dependency flow or phase/state view). Implementation steps remain authoritative; diagrams are explanatory. If refinement fails, note it and continue — the plan itself is unaffected.
100
+
101
+ ## State Update Convention (per step)
102
+
103
+ 1. **On success** (implementation-plan.md written — the diagram is optional and its absence does NOT block success): immediately append `plan-created` to `completed_phases`; write 1-2 sentence summary to `phase_summaries.planning`; bump `orchestrator.updated`.
104
+ - In quick mode, ALSO append the prelude slugs on their individual completions (never batched into one end-of-skill write): `codebase-analysed` and `gap-analysed` after the quick analysis (quick analysis covers both; note the condensation in `phase_summaries.codebase_analysis` / `phase_summaries.gap_analysis`), `spec-written` after the condensed spec (summary in `phase_summaries.specification`), and `plan-created` after the condensed plan (written directly — no delegation).
105
+ 2. **On failure** (planner fails in the full pipeline, or the quick-mode plan is incomplete): do NOT append to `completed_phases`; append `plan-created` to `orchestrator.failed_phases` and increment `auto_fix_attempts["plan-created"]`. A declined or failed diagram refinement is NOT a failure — note it in `phase_summaries.planning` and proceed.
106
+ 3. **Timestamp + validate** — set `orchestrator.updated` on every write; after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-development.yml`. Fix any reported issue immediately.
107
+ 4. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run.
108
+
109
+ ## Exit Gate
110
+
111
+ Present results, get user confirmation, then hand off (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
112
+
113
+ ### Results box
114
+
115
+ ```markdown
116
+ ## ✅ DEV PLAN COMPLETE — <task name>
117
+
118
+ **Task groups** — [N]
119
+ **Total steps** — [M]
120
+ **Dependencies** — [key ordering constraints, 1-2 lines]
121
+ **Complexity** — [estimated complexity]
122
+ **Entry point** — [quick bootstrap (`--quick`) / full pipeline]
123
+ **Diagram** — [added / skipped (optional)]
124
+
125
+ **Artifacts**
126
+ - `implementation/implementation-plan.md`
127
+ ```
128
+
129
+ ### Results-acceptance question
130
+
131
+ Use `question` — "Are these results correct?" with options:
132
+
133
+ - **Accept** — the plan is good; continue.
134
+ - **Adjust** — regenerate the plan with the user's corrections (grouping, ordering, scope), update state, re-present the results box.
135
+ - **Discuss** — walk through the plan structure (task groups, dependencies, step breakdown) in more depth; then re-ask.
136
+ - **Stop here** — print the resume command (`/owflow:dev-plan <task-path>`) and end. The task is a regular development task; `/owflow:dev-implement <task-path>` (or `/owflow:development <task-path>`) continues the pipeline later.
137
+
138
+ ### Next steps (after Accept)
139
+
140
+ - `→ /owflow:dev-implement <task-path>` — `required` next: executes the plan task group by task group via subagents (includes the TDD green gate when a red gate exists). Remaining after: verify → finalize. If the plan alone was the goal, stop here — the task stays resumable.
141
+ - `/owflow:dev-implement --quick <task-path>` — `optional` condensed alternative: implements the plan directly in the main agent with standards instead of delegating to subagents.
142
+
143
+ **Other options**:
144
+
145
+ - `/owflow:goal-development <task-path>` — `optional` shortcut: runs all remaining phases in one loop (implement → verify → finalize)
146
+
147
+ Then STOP.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: owflow:dev-spec
3
+ description: Development — technical approach, requirements gathering, specification creation, and optional specification audit. --quick starts a condensed spec task here when no state file exists (condensing the missing pieces on an existing task).
4
+ argument-hint: "[task-path-or-identifier | \"description\"] [--quick]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Dev Spec — Requirements, Specification & Audit (spec-written, spec-audited)
9
+
10
+ Work phase of the development workflow. Resolves technical decisions, gathers requirements, creates the specification via delegation, refines it with diagrams, then offers an independent specification audit.
11
+
12
+ Supports a **quick mode** (`--quick`, or any description argument with no existing task): a condensed prelude that bootstraps a standard development task (state file, standards discovery, quick analysis) and then writes the condensed specification directly on the fly — no specification-creator subagent. After the Exit Gate, the pipeline continues with `/owflow:dev-plan` (normal or `--quick`). The task is a regular development task, resumable by any dev-* subskill.
13
+
14
+ ## Entry Gate
15
+
16
+ Resolve the argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). The argument may be:
17
+
18
+ - **Path** (absolute or project-relative) to the task directory — use as-is.
19
+ - **Identifier** — exact directory name inside `.owflow/tasks/development/` (e.g., `2026-01-12-my-task`); resolve to its path.
20
+ - **Description** — anything else (quoted free text, e.g. `"Add a logout button to the navbar"`) is treated as a new task description for quick bootstrap.
21
+
22
+ Route by argument kind and flags:
23
+
24
+ | Situation | Route |
25
+ | ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
26
+ | Task path/identifier, no `--quick`, state + analysis exist | Normal specification below |
27
+ | Task path/identifier, `--quick`, analysis done (spec missing) | Quick prelude step 3 only (condensed spec), then audit offer / Exit Gate |
28
+ | Task path/identifier, `--quick`, analysis missing | Quick bootstrap/prelude for the missing pieces, then condensed spec |
29
+ | Description argument, `--quick` (or no argument after prompt) | Quick bootstrap (create task + condensed prelude + condensed spec) |
30
+ | Description argument, no `--quick` | Ask via `question`: quick spec-only task / full pipeline (blocked block below) / cancel |
31
+ | Missing argument | Prompt for input (path, identifier, or description), then re-route |
32
+
33
+ If the path does **not exist** or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
34
+
35
+ 1. Steps that must be completed first (in order), each with its command:
36
+ - Codebase & gap analysis (`codebase-analysed`, `gap-analysed`) → `/owflow:dev-analyze <task-path>`
37
+ - TDD red gate (`tdd-red-proven`) — only when a reproducible defect was detected during analysis → `/owflow:dev-tdd-red <task-path>`
38
+ 2. List available dev-task identifiers (directories under `.owflow/tasks/development/`) to resume from, if any.
39
+ 3. Hint: `Run /owflow:development <description> to start a task from scratch, /owflow:dev-spec --quick "<description>" for a quick spec-only task, or pass a task path/identifier to resume.`
40
+
41
+ ### Prerequisites
42
+
43
+ | Required for this skill | Where verified | Produced by |
44
+ | -------------------------- | ------------------------------------------------------------------------------------------- | -------------------------------------------------- |
45
+ | State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:development <desc>` or quick bootstrap |
46
+ | Analysis done | `gap-analysed` in `completed_phases` + `analysis/gap-analysis.md` exists | `/owflow:dev-analyze <task-path>` or quick prelude |
47
+ | TDD red gate (conditional) | `tdd-red-proven` in `completed_phases` — required only when `has_reproducible_defect: true` | `/owflow:dev-tdd-red <task-path>` |
48
+
49
+ 1. **Read `orchestrator-state.yml`** from the task path. If missing → quick bootstrap when invoked with `--quick` or a description argument (see Quick Mode), otherwise mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `spec-written`): `question` — create a fresh standard development task starting at this step, or decline → print `No development task found at <path>. Run /owflow:development <description> to start a task from scratch, or /owflow:dev-spec --quick "<description>" for a quick spec-only task.` and STOP.
50
+ 2. **Skip/resume**: if both `spec-written` and `spec-audited` are in `completed_phases`, report existing results and route to the Exit Gate. If only `spec-written` is complete: when `options.spec_audit_enabled: false` (quick task — audit skipped by design), report the existing spec summary and route to the Exit Gate; otherwise skip to the spec audit.
51
+ 3. **Conditional activation (routing guard — both modes)**: if `task_context.task_characteristics.has_reproducible_defect` is `true` AND `tdd-red-proven` is NOT in `completed_phases` → print the blocked block, then STOP (quick mode does NOT bypass a proven-defect red gate; the quick TDD lane for bug-shaped work is `/owflow:dev-bugfix`):
52
+ - Steps that must be completed first: TDD red gate (`tdd-red-proven` — required because a reproducible defect was detected); if analysis (`codebase-analysed`, `gap-analysed`) is also missing, start there.
53
+ - `Run /owflow:dev-tdd-red <task-path> first (or /owflow:dev-analyze <task-path> if analysis is also missing).`
54
+ 4. **Prerequisite check**: `gap-analysed` in `completed_phases` and `analysis/gap-analysis.md` exists. If missing → run the Quick prelude for the missing pieces (when `--quick` or the user chooses quick), otherwise print the blocked block, then STOP:
55
+ - Steps that must be completed first: codebase & gap analysis (`codebase-analysed`, `gap-analysed`).
56
+ - `Run /owflow:dev-analyze <task-path> first.`
57
+ - If no task exists yet: `Run /owflow:development <description> to start a task from scratch, or /owflow:dev-spec --quick "<description>" for a quick spec-only task.`
58
+
59
+ ## Quick Mode (condensed prelude → spec on the fly)
60
+
61
+ Quick mode produces the same artifacts as the early pipeline phases — just condensed into one pass inside this skill. It does NOT introduce a second state format: the task gets a standard `orchestrator-state.yml` and standard artifacts, so every other dev-* subskill can pick it up afterwards.
62
+
63
+ ### Quick bootstrap (no state file, description argument)
64
+
65
+ 1. **Create Task Directory**: `.owflow/tasks/development/YYYY-MM-DD-task-name/` (3–5 kebab-case words from the description).
66
+ 2. **Initialize State**: create `orchestrator-state.yml` from the development template with `task.title` / `task.description` from the description, `task.status: in_progress`, and `orchestrator.entry_point: "dev-spec --quick"`. Bug-shaped descriptions (symptom + expected vs actual) → suggest `/owflow:dev-bugfix "<description>"` instead (TDD red gate discipline, same standard state) — unless the user insists on proceeding here.
67
+ - **CRITICAL**: use the `verify_template` tool immediately after creation to check YAML validity against `orchestrator-state-development.yml`.
68
+ 3. **Discover project documentation**: read `.owflow/docs/INDEX.md` (if exists) and extract the Project Documentation file paths into `project_context.project_doc_paths` (matching the development dispatcher's initialization).
69
+ 4. If `.owflow/docs/` does not exist, proceed without standards and note the graceful-fallback hint in the completion message: `"No AI SDLC standards found. Consider running /owflow:flow-init to initialize project documentation and coding standards."`
70
+
71
+ ### Quick prelude (one condensed pass)
72
+
73
+ **MANDATORY order — standards before analysis, analysis before spec:**
74
+
75
+ 1. **Standards discovery** (skip when `project_context.standards_applied` already lists the applicable standards): identify applicable standards from INDEX.md by task keywords (e.g., "API" → api/error-handling, "form" → validation/accessibility) and **READ each applicable standard file** with the Read tool — reading INDEX.md alone is NOT sufficient. Record the paths in `project_context.standards_applied` (extra state field).
76
+ 2. **Brief codebase analysis** (skip when `gap-analysed` is already in `completed_phases`): explore the affected areas (Glob, Grep, Read) — enough to identify affected files/modules, existing patterns, and constraints that inform the spec. Write `analysis/quick-analysis.md` (affected files, approach sketch, standards referenced). Extract a 1–2 sentence summary into `phase_summaries.quick_analysis`.
77
+ 3. **Condensed requirements pass (gap-driven — no fixed question rounds)**: extract the REQUIRED spec topics from evidence first — **User Journey** (discovery/access, personas, workflow fit), **Existing Code Reuse** (similar features, UI components, backend patterns — found during the brief analysis), **Visual Assets** (check `analysis/visuals/` regardless of the answer; skip visual processing for non-UI tasks when none found). On an existing task, reuse the analysis clarifications (`analysis/clarifications.md`, gap-analysis scope decisions) as already-gathered evidence. Only where a genuine gap or ambiguity would change the spec's scope or architecture, ask ONE consolidated `question` round (2–4 targeted questions, confirmable-assumption framing "I assume X — is that correct?", multi-select where positions co-exist); when multiple valid architectural approaches surface, present them in the same round and record the choice in `task_context.architecture_decision`. Never write TBDs or open questions into the condensed spec — decide, or ask; anything unresolvable is recorded as an explicit assumption in the spec's scope section. Save the gathered context to `analysis/requirements.md` (condensed: description, evidence-based journey/reuse/visuals findings, any Q&A, requirements, scope boundaries, standards referenced).
78
+ 4. **Condensed spec — written directly, NO delegation**: write `implementation/spec.md` — goal, scope (in/out), requirements, applicable standards with key guidelines, verification criteria. Then run the Quick diagram gate below. This REPLACES the `specification-creator` delegation in Execute below (quick mode is the only exception to the delegation anti-pattern). Mark `spec-written` complete (`phase_summaries.specification` summary).
79
+
80
+ ### Quick diagram gate (optional — part of the condensed spec)
81
+
82
+ 1. Use `question`: "Add diagrams to the condensed spec?" Options:
83
+ - **Add diagrams** — Skill tool - `diagrams-mermaid` on `implementation/spec.md` (content-preserving, same rules as the normal Diagram Refinement).
84
+ - **Skip** — the spec stays prose-only.
85
+ 2. A declined or failed diagram refinement is NOT a failure — note it in `phase_summaries.specification` and continue.
86
+
87
+ The TDD red gate is NOT bypassed by quick mode: when `has_reproducible_defect: true` and `tdd-red-proven` is missing, the routing guard in the Entry Gate fires in both modes — the quick TDD lane for bug-shaped work is `/owflow:dev-bugfix`, not a silent skip. `spec-audited` is SKIPPED in quick mode — set `options.spec_audit_enabled: false`; Exit Gate acceptance substitutes for the audit, and `/owflow:reviews-spec-audit <task-path>` remains available as a standalone later option.
88
+
89
+ Then continue with the **Exit Gate** below.
90
+
91
+ ## Execute (normal runs — delegated specification)
92
+
93
+ **Read first**: the [Delegation Rules](../orchestrator-framework/references/delegation-rules.md).
94
+
95
+ **Scope**: normal runs only — quick mode writes the condensed spec directly (see Quick Mode) and skips this section.
96
+
97
+ ### Technical & Architecture Clarification (before `spec-written`, inline, conditional)
98
+
99
+ - Complex task with multiple approaches → `question` for 3-5 technical questions.
100
+ - Multiple valid architectural approaches → present 2-3 via `question`; the chosen approach is passed to specification-creator.
101
+ - Save to `analysis/technical-clarifications.md` (conditional).
102
+ - Skip if: simple task, `risk_level: low`, no multiple approaches detected.
103
+
104
+ ### Requirements Gathering (part of `spec-written`, inline)
105
+
106
+ 1. `question` for specification requirements — adaptive count based on description length: brief (<30 words) 6-8; standard (30-100 words) 4-6; detailed (>100 words) 2-3. Frame as confirmable assumptions ("I assume X, is that correct?").
107
+ 2. REQUIRED questions (always include): **User Journey** (discovery/access, personas, workflow fit), **Existing Code Reuse** (similar features, UI components, backend patterns), **Visual Assets** (mockups/wireframes → `analysis/visuals/`).
108
+ 3. Check `analysis/visuals/` for assets regardless of the answer; note findings for subagent context (skip visual processing for non-UI tasks when none found).
109
+ 4. Save to `analysis/requirements.md`: initial description, all Q&A rounds, similar features, visual insights, functional requirements, reusability opportunities, scope boundaries, technical considerations.
110
+
111
+ ### Specification Creation (part of `spec-written`, subagent)
112
+
113
+ **ANTI-PATTERN — never write spec.md yourself in a normal run. "The task is simple" is NOT a reason to skip delegation. (Quick mode is the ONLY exception — its prelude step 4 writes the condensed spec directly and skips this section.)**
114
+
115
+ Task tool - `specification-creator`. Pass: task_path, task_description, task_characteristics, requirements_path (`analysis/requirements.md`), project_context_paths (INDEX.md + `project_doc_paths` from state), risk_level, relevant `phase_summaries`, research/quick context if present in state. Output: `implementation/spec.md`.
116
+
117
+ ### Diagram Refinement (part of `spec-written`, Skill, content-preserving)
118
+
119
+ Skill tool - `diagrams-mermaid` on `implementation/spec.md`. Add diagrams that clarify scope and communication without replacing prose: `flowchart` (primary functional path), `sequenceDiagram` (key interaction), optional `C4Component` (if module structure is in scope). Missing context → add an explicit open questions section instead of inventing entities.
120
+
121
+ ### Specification Audit (`spec-audited`, recommended)
122
+
123
+ 1. `question` — "Run specification audit? (Recommended)" with "Yes, run audit (Recommended)" first. User may skip.
124
+ 2. If yes: Task tool - `spec-auditor`. Pass: task_path, spec_path. Output: `verification/spec-audit.md`. Display verdict (pass/pass-with-concerns/fail), issue counts by severity, top critical findings.
125
+
126
+ ## State Update Convention (per step)
127
+
128
+ Apply after EVERY phase/step above:
129
+
130
+ 1. **Write immediately** — update `orchestrator-state.yml` as soon as the step completes, appending ONLY the step slug actually performed plus that step's fields. Never batch multiple steps into one end-of-skill write:
131
+ - After Part A (if it ran): set `task_context.tech_clarified`, `task_context.architecture_decision`.
132
+ - After Parts B–D (`spec-written` complete): append `spec-written` to `completed_phases`; set `phase_summaries.specification`; bump `orchestrator.updated`.
133
+ - After Part E (only when the audit ran): append `spec-audited` to `completed_phases`; set `options.spec_audit_enabled: true` and the audit verdict in `phase_summaries.specification`; bump `orchestrator.updated`. When the user skipped the audit, set `options.spec_audit_enabled: false` — no `spec-audited` entry.
134
+ - In quick mode, ALSO append the prelude slugs on their individual completions (never batched): `codebase-analysed` and `gap-analysed` after the quick analysis (quick analysis covers both; note the condensation in `phase_summaries.codebase_analysis` / `phase_summaries.gap_analysis`), then `spec-written` after the condensed spec (summary in `phase_summaries.specification`). The audit skip sets `options.spec_audit_enabled: false` — no `spec-audited` entry.
135
+ 2. **Timestamp** — set `orchestrator.updated` to the current UTC timestamp on every write.
136
+ 3. **Failures** — if the spec creation or audit fails and cannot be recovered, do NOT append to `completed_phases`; append the corresponding step slug (`spec-written` or `spec-audited`) to `orchestrator.failed_phases` and increment `auto_fix_attempts["<slug>"]`.
137
+ 4. **Validate** — after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-development.yml`. Fix any reported issue immediately before proceeding.
138
+ 5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run to confirm the full state matches everything performed in this session.
139
+
140
+ ## Exit Gate
141
+
142
+ Present results, get user confirmation, then hand off (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
143
+
144
+ ### Results box
145
+
146
+ ```markdown
147
+ ## ✅ DEV SPEC COMPLETE — <spec title>
148
+
149
+ **Approach** — [architecture approach in 1 line]
150
+ **Scope** — [N included / M excluded]
151
+ **Audit** — [✅ pass / ⚠ pass-with-concerns / ❌ fail / skipped]: [0 critical / N major / N minor]
152
+ **Entry point** — [quick bootstrap (`--quick`) / full pipeline]
153
+
154
+ **Artifacts**
155
+
156
+ - `analysis/requirements.md`
157
+ - `implementation/spec.md`
158
+ - `verification/spec-audit.md` [conditional]
159
+ ```
160
+
161
+ In quick mode the audit line reads `skipped (quick mode)` and `/owflow:reviews-spec-audit <task-path>` is the standalone later option.
162
+
163
+ ### Results-acceptance question
164
+
165
+ Use `question` — "Are these results correct?" with options:
166
+
167
+ - **Accept** — the specification is good; continue.
168
+ - **Adjust** — regenerate the spec with the user's corrections (clarifications, scope boundaries, requirements), update state, re-present the results box.
169
+ - **Discuss** — walk through a specific part of the spec (scope boundaries, architecture approach, audit findings) in more depth; then re-ask.
170
+ - **Stop here** — print the resume command (`/owflow:dev-spec <task-path>`) and end.
171
+
172
+ ### Next steps (after Accept)
173
+
174
+ - `→ /owflow:dev-plan <task-path>` — `required` next: breaks the approved spec into grouped, dependency-ordered task groups with test-driven steps. Remaining after: implement → verify → finalize.
175
+ - `/owflow:dev-plan --quick <task-path>` — `optional` condensed alternative: writes the implementation plan directly on the fly instead of delegating to the planner subagent.
176
+
177
+ **Other options**:
178
+
179
+ - `/owflow:reviews-spec-audit <task-path>` — `optional` — standalone spec re-audit; does not advance phases (verify results, then re-run `/owflow:dev-spec` adjustments if needed)
180
+ - `/owflow:goal-development <task-path>` — `optional` shortcut: runs all remaining phases in one loop (plan → implement → verify → finalize)
181
+
182
+ Then STOP.
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: owflow:dev-tdd-red
3
+ description: Development — TDD Red Gate. Write a failing test that reproduces the defect before any implementation work.
4
+ argument-hint: "[task-path-or-identifier]"
5
+ user-invocable: true
6
+ ---
7
+
8
+ # Dev TDD Red — TDD Red Gate (tdd-red-proven)
9
+
10
+ Work phase of the development workflow. Writes a failing test proving the defect exists, before any implementation. Only runs when the gap analysis detected a reproducible defect.
11
+
12
+ ## Entry Gate
13
+
14
+ Resolve the `task-path-or-identifier` argument BEFORE anything else (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)):
15
+
16
+ - **Path** (absolute or project-relative) to the task directory — use as-is.
17
+ - **Identifier** — exact directory name inside `.owflow/tasks/development/` (e.g., `2026-01-12-my-task`); resolve to its path.
18
+ - If the argument is **missing**, the path does **not exist**, or matches **no identifier** → print the blocked block, then STOP (never guess or auto-pick a task):
19
+ 1. Steps that must be completed first (in order), each with its command:
20
+ - Codebase & gap analysis (`codebase-analysed`, `gap-analysed`) → `/owflow:dev-analyze <task-path>`
21
+ 2. List available dev-task identifiers (directories under `.owflow/tasks/development/`) to resume from, if any.
22
+ 3. Hint: `Run /owflow:development <description> to start a task from scratch, or pass a task path/identifier to resume.`
23
+
24
+ ### Prerequisites
25
+
26
+ | Required for this skill | Where verified | Produced by |
27
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------ | -------------------------------- |
28
+ | State file exists | `<task-path>/orchestrator-state.yml` | `/owflow:development <desc>` |
29
+ | Analysis done | `gap-analysed` in `completed_phases` | `/owflow:dev-analyze <task-path>`|
30
+ | Defect is reproducible | `task_context.task_characteristics.has_reproducible_defect: true` | `/owflow:dev-analyze <task-path>`|
31
+
32
+ 1. **Read `orchestrator-state.yml`** from the task path. If missing → mid-pipeline bootstrap ([Missing-state Bootstrap](../orchestrator-framework/references/gate-contract.md), starting slug `tdd-red-proven`): `question` — create a fresh standard development task starting at this step, or decline → print `No development task found at <path>. Run /owflow:development <description> to start a task from scratch.` and STOP.
33
+ 2. **Skip/resume**: if `tdd-red-proven` is in `completed_phases`, report the existing `implementation/tdd-red-gate.md` results and route to the Exit Gate.
34
+ 3. **Conditional activation**: read `task_context.task_characteristics.has_reproducible_defect`. If `false` → print `No reproducible defect detected — TDD red gate not required.` and suggest `→ /owflow:dev-spec <task-path>` (required next phase: turns analysis into a user-approved specification; remaining plan plan → implement → verify → finalize), then STOP.
35
+ 4. **Prerequisite check**: `gap-analysed` must be in `completed_phases`. If not → print the blocked block, then STOP:
36
+ - Steps that must be completed first: codebase & gap analysis (`codebase-analysed`, `gap-analysed`).
37
+ - Run `/owflow:dev-analyze <task-path> first.`
38
+ - If no task exists yet: `Run /owflow:development <description> to start a task from scratch.`
39
+
40
+ ## Execute
41
+
42
+ Direct execution (no delegation — this is a targeted, single-test task):
43
+
44
+ 1. Read `analysis/clarifications.md`, `analysis/gap-analysis.md`, and the affected files identified by the analysis to understand the defect.
45
+ 2. Write ONE focused test that reproduces the defect (correct test framework for the project — check existing test setup).
46
+ 3. Run the test. **It MUST fail** — a failing result proves the defect exists. If it passes unexpectedly, the defect is not reproduced: revise the test or report the mismatch via `question`.
47
+
48
+ **Critical**: Do NOT fix anything. Do NOT write implementation code. The test failing is the deliverable.
49
+
50
+ ## State Update Convention (per step)
51
+
52
+ 1. **On success** (test fails as expected, red gate proven): immediately append `tdd-red-proven` to `completed_phases` and set `task_context.tdd_red_passed: true`; bump `orchestrator.updated`.
53
+ 2. **On failure or abandoned retries** (test framework issues, imports that could not be resolved): do NOT append to `completed_phases`; append `tdd-red-proven` to `orchestrator.failed_phases` and increment `auto_fix_attempts["tdd-red-proven"]`; document the blocker in `task_context.gaps`.
54
+ 3. **On user-chosen skip** (via `question` after repeated failures): record the skip with the failure reason in `task_context.gaps` and set `task_context.tdd_red_passed: false` — no `completed_phases` entry, no `failed_phases` entry (it was a deliberate decision, not a failure).
55
+ 4. **Timestamp + validate** — set `orchestrator.updated` on every write; after every write, re-read the file to confirm values, then run the `verify_template` tool with `filePath: <task-path>/orchestrator-state.yml`, `templateName: orchestrator-state-development.yml`. Fix any reported issue immediately.
56
+ 5. **Final check** — before the Exit Gate, one consolidated re-read + `verify_template` run.
57
+
58
+ Retry rule: on repeated failures (test framework issues, imports) retry up to 2 times (rewrite test, fix setup). Still failing → `question`: continue trying, or skip TDD with the failure documented in state (per rule 3).
59
+
60
+ ## Exit Gate
61
+
62
+ Present results, get user confirmation, then hand off (see [Gate Contract](../orchestrator-framework/references/gate-contract.md)). Never auto-invoke the next skill.
63
+
64
+ ### Results box
65
+
66
+ ```markdown
67
+ ## ✅ TDD RED GATE COMPLETE — <task name>
68
+
69
+ **Test** — <test name> (`<test file path>`)
70
+ **Result** — ❌ FAILED as expected — defect reproduced
71
+ **Failure** — <1-line key failure output proving the defect>
72
+
73
+ **Artifacts**
74
+ - `implementation/tdd-red-gate.md`
75
+ ```
76
+
77
+ ### Results-acceptance question
78
+
79
+ Use `question` — "Are these results correct?" with options:
80
+
81
+ - **Accept** — the failing test faithfully reproduces the defect; continue.
82
+ - **Adjust** — revise the test (different conditions, better assertion), re-run, re-present the results box.
83
+ - **Discuss** — walk through the reproduction reasoning (defect path, why the test fails) in more depth; then re-ask.
84
+ - **Stop here** — print the resume command (`/owflow:dev-tdd-red <task-path>`) and end.
85
+
86
+ ### Next steps (after Accept)
87
+
88
+ - `→ /owflow:dev-spec <task-path>` — `required` next: turns analysis plus this red test into a user-approved specification (the test becomes the acceptance criterion for the fix). Remaining after: plan → implement → verify → finalize.
89
+
90
+ **Other options**:
91
+
92
+ - `/owflow:goal-development <task-path>` — `optional` shortcut: runs all remaining phases in one loop (spec → plan → implement → verify → finalize)
93
+
94
+ Then STOP.