@lifeaitools/rdc-skills 0.9.31 → 0.9.33

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 (59) hide show
  1. package/.claude-plugin/plugin.json +24 -2
  2. package/.github/workflows/self-test.yml +34 -34
  3. package/MANIFEST.md +4 -0
  4. package/commands/build.md +183 -183
  5. package/commands/collab.md +180 -180
  6. package/commands/deploy.md +152 -138
  7. package/commands/fixit.md +116 -104
  8. package/commands/handoff.md +173 -173
  9. package/commands/overnight.md +220 -220
  10. package/commands/plan.md +158 -158
  11. package/commands/preplan.md +131 -131
  12. package/commands/prototype.md +145 -145
  13. package/commands/report.md +99 -99
  14. package/commands/review.md +120 -120
  15. package/commands/status.md +86 -86
  16. package/commands/workitems.md +132 -127
  17. package/guides/agent-bootstrap.md +265 -206
  18. package/guides/agents/backend.md +104 -104
  19. package/guides/agents/content.md +94 -94
  20. package/guides/agents/cs2.md +56 -56
  21. package/guides/agents/data.md +87 -87
  22. package/guides/agents/design.md +77 -77
  23. package/guides/agents/frontend.md +92 -92
  24. package/guides/agents/infrastructure.md +81 -81
  25. package/guides/agents/setup.md +279 -279
  26. package/guides/agents/verify.md +119 -119
  27. package/guides/agents/viz.md +106 -106
  28. package/hooks/foreground-process-gate.js +109 -0
  29. package/hooks/hook-logger.js +25 -0
  30. package/hooks/run-hidden-hook.ps1 +47 -0
  31. package/hooks/work-item-exit-gate.js +297 -0
  32. package/package.json +3 -3
  33. package/rules/work-items-rpc.md +56 -7
  34. package/scripts/fixtures/guides/bad-guide.md +15 -0
  35. package/scripts/fixtures/guides-clean/good-guide.md +16 -0
  36. package/scripts/install-rdc-skills.js +53 -9
  37. package/scripts/install.ps1 +17 -11
  38. package/scripts/self-test.mjs +1323 -1113
  39. package/scripts/test-guide-validator.mjs +194 -0
  40. package/skills/build/SKILL.md +355 -355
  41. package/skills/co-develop/SKILL.md +182 -0
  42. package/skills/collab/SKILL.md +217 -217
  43. package/skills/deploy/SKILL.md +198 -152
  44. package/skills/design/SKILL.md +211 -211
  45. package/skills/fixit/SKILL.md +132 -122
  46. package/skills/handoff/SKILL.md +200 -200
  47. package/skills/help/SKILL.md +104 -102
  48. package/skills/overnight/SKILL.md +224 -224
  49. package/skills/plan/SKILL.md +252 -251
  50. package/skills/preplan/SKILL.md +86 -86
  51. package/skills/prototype/SKILL.md +150 -150
  52. package/skills/release/SKILL.md +342 -342
  53. package/skills/report/SKILL.md +100 -100
  54. package/skills/review/SKILL.md +121 -120
  55. package/skills/self-test/SKILL.md +126 -126
  56. package/skills/status/SKILL.md +99 -97
  57. package/skills/terminal-config/SKILL.md +18 -18
  58. package/skills/watch/SKILL.md +91 -91
  59. package/skills/workitems/SKILL.md +151 -146
@@ -1,122 +1,132 @@
1
- ---
2
- name: rdc:fixit
3
- description: "Quick fix under 5 files / 30 min that does not warrant a full plan→build cycle. Creates a minimal work item, makes the change, commits, closes. The only sanctioned bypass of rdc:build."
4
- ---
5
-
6
- > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
7
- > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
8
- > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
9
-
10
- > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
11
-
12
- > **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
13
-
14
-
15
- # rdc:fixit — Sanctioned Quick Fix
16
-
17
- ## When to Use
18
- - Typo or single-line text correction
19
- - Config value change (env vars, constants, feature flags)
20
- - Emergency hotfix that cannot wait for a full build cycle
21
- - Dependency version bump
22
- - CSS/styling tweak on a single component
23
- - Broken import or export fix
24
- - Single-file logic correction
25
-
26
- ## When NOT to Use — escalate to rdc:build instead
27
- - New feature of any size
28
- - Refactor touching >5 files
29
- - Anything requiring architecture decisions
30
- - Work that will take longer than 30 minutes
31
- - Schema changes or migrations
32
-
33
- ## Arguments
34
- - `rdc:fixit <description>` — fix the described issue
35
-
36
- ## Procedure
37
-
38
- ### 1. Scope check (mandatory — do this before touching any file)
39
-
40
- Will this fix touch more than **5 files** or take more than **30 minutes**?
41
-
42
- - **YES** → Stop. Use `/rdc:build` instead. Explain to the user why.
43
- - **NO** → Continue.
44
-
45
- ### 2. Create a minimal work item (before touching any code)
46
-
47
- ```sql
48
- SELECT insert_work_item(
49
- p_title := 'fixit: <description>',
50
- p_item_type := 'bug',
51
- p_priority := 'urgent',
52
- p_status := 'in_progress',
53
- p_source := 'fixit'
54
- );
55
- ```
56
-
57
- Note the returned `id`.
58
-
59
- ### 3. Write the fixit session marker
60
-
61
- Write to `{USER_HOME}/.claude/fixit.marker`:
62
- ```
63
- <work_item_id>
64
- <ISO timestamp>
65
- <description>
66
- ```
67
-
68
- This signals the Stop hook that fixit is handling its own documentation.
69
-
70
- ### 4. Make the fix
71
-
72
- Do the minimal work. Scope creep rule: if you discover the fix requires more than originally scoped, **stop immediately**:
73
- 1. Close the work item: `update_work_item_status('<id>', 'blocked', '["Escalated — scope exceeded fixit threshold"]')`
74
- 2. Delete the marker file
75
- 3. Tell the user to use `/rdc:build` instead
76
-
77
- ### 5. Commit
78
-
79
- ```bash
80
- git add <specific files only — never git add -A for a fixit>
81
- git commit -m "fix(<scope>): <description>"
82
- if [ "$RDC_TEST" != "1" ]; then
83
- git push origin {development-branch}
84
- else
85
- echo "[RDC_TEST] skipping git push origin {development-branch}"
86
- fi
87
- ```
88
-
89
- ### 6. Close and clean up
90
-
91
- Submit implementation report first, then mark done:
92
-
93
- ```sql
94
- SELECT submit_implementation_report('<id>'::uuid,
95
- '{"tldr":"<one sentence>","assumptions":[],"deviations":[],"uncertainty":[],"detail":"<what was fixed>","flags":[],"transactional":false,"memory_records":[]}'::jsonb
96
- );
97
-
98
- SELECT update_work_item_status('<id>'::uuid, 'done',
99
- '["Fixed via rdc:fixit"]'::jsonb
100
- );
101
- ```
102
-
103
- If the fix touched a transactional flow, API boundary, or package contract, set `"transactional": true` and populate `memory_records` (see `agent-bootstrap.md`), then run:
104
- ```bash
105
- node scripts/work-item-memory.mjs <work-item-id>
106
- ```
107
-
108
- ```bash
109
- rm {USER_HOME}/.claude/fixit.marker
110
- ```
111
-
112
- ### 7. Confirm to user
113
-
114
- Report: what was fixed, file(s) changed, commit hash. One sentence.
115
-
116
- ## Rules
117
- - Work item created BEFORE any code change — never after
118
- - `git add` specific files only — never `-A` or `.` for a fixit
119
- - Branch: development branch always
120
- - Never run `pnpm build` — not needed for a fixit
121
- - If scope expands mid-fix: stop, escalate to rdc:build, don't finish under fixit
122
- - Marker file must be cleaned up whether fix succeeds or escalates
1
+ ---
2
+ name: rdc:fixit
3
+ description: "Usage `rdc:fixit <description>` — Quick fix under 5 files / 30 min that does not warrant a full plan→build cycle. Creates a minimal work item, makes the change, commits, closes. The only sanctioned bypass of rdc:build."
4
+ ---
5
+
6
+ > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
7
+ > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
8
+ > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
9
+
10
+ > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
11
+
12
+ > **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
13
+
14
+
15
+ # rdc:fixit — Sanctioned Quick Fix
16
+
17
+ ## When to Use
18
+ - Typo or single-line text correction
19
+ - Config value change (env vars, constants, feature flags)
20
+ - Emergency hotfix that cannot wait for a full build cycle
21
+ - Dependency version bump
22
+ - CSS/styling tweak on a single component
23
+ - Broken import or export fix
24
+ - Single-file logic correction
25
+
26
+ ## When NOT to Use — escalate to rdc:build instead
27
+ - New feature of any size
28
+ - Refactor touching >5 files
29
+ - Anything requiring architecture decisions
30
+ - Work that will take longer than 30 minutes
31
+ - Schema changes or migrations
32
+
33
+ ## Arguments
34
+ - `rdc:fixit <description>` — fix the described issue
35
+
36
+ ## Procedure
37
+
38
+ ### 1. Scope check (mandatory — do this before touching any file)
39
+
40
+ Will this fix touch more than **5 files** or take more than **30 minutes**?
41
+
42
+ - **YES** → Stop. Use `/rdc:build` instead. Explain to the user why.
43
+ - **NO** → Continue.
44
+
45
+ ### 2. Create a minimal work item (before touching any code)
46
+
47
+ ```sql
48
+ SELECT insert_work_item(
49
+ p_title := 'fixit: <description>',
50
+ p_item_type := 'bug',
51
+ p_priority := 'urgent',
52
+ p_status := 'in_progress',
53
+ p_source := 'fixit'
54
+ );
55
+ ```
56
+
57
+ Note the returned `id`.
58
+
59
+ ### 3. Write the fixit session marker
60
+
61
+ Write to `{USER_HOME}/.claude/fixit.marker`:
62
+ ```
63
+ <work_item_id>
64
+ <ISO timestamp>
65
+ <description>
66
+ ```
67
+
68
+ This signals the Stop hook that fixit is handling its own documentation.
69
+
70
+ ### 4. Make the fix
71
+
72
+ Do the minimal work. Scope creep rule: if you discover the fix requires more than originally scoped, **stop immediately**:
73
+ 1. Close the work item: `update_work_item_status('<id>', 'blocked', '["Escalated — scope exceeded fixit threshold"]')`
74
+ 2. Delete the marker file
75
+ 3. Tell the user to use `/rdc:build` instead
76
+
77
+ ### 5. Commit
78
+
79
+ ```bash
80
+ git add <specific files only — never git add -A for a fixit>
81
+ git commit -m "fix(<scope>): <description>"
82
+ if [ "$RDC_TEST" != "1" ]; then
83
+ git push origin {development-branch}
84
+ else
85
+ echo "[RDC_TEST] skipping git push origin {development-branch}"
86
+ fi
87
+ ```
88
+
89
+ ### 6. Close and clean up
90
+
91
+ Submit implementation report first, move to review, then close as validator:
92
+
93
+ ```sql
94
+ SELECT submit_implementation_report('<id>'::uuid,
95
+ '{"tldr":"<one sentence>","assumptions":[],"deviations":[],"uncertainty":[],"detail":"<what was fixed>","flags":[],"transactional":false,"memory_records":[],"codeflow_post":{"agent_session_id":"<agent-session-id>","summary":"<what changed and why>","files_changed":["<path>"],"verification":["<command/evidence>"],"commit":"<hash optional>"}}'::jsonb
96
+ );
97
+
98
+ SELECT update_work_item_status('<id>'::uuid, 'review',
99
+ '["Fixed via rdc:fixit; ready for validation"]'::jsonb,
100
+ '<agent-session-id>',
101
+ 'agent'
102
+ );
103
+
104
+ SELECT update_work_item_status('<id>'::uuid, 'done',
105
+ '["Validator verified rdc:fixit report, CodeFlow post, and checklist evidence"]'::jsonb,
106
+ '<validator-session-id>',
107
+ 'validator'
108
+ );
109
+ ```
110
+
111
+ If the fix touched a transactional flow, API boundary, or package contract, set `"transactional": true` and populate `memory_records` (see `agent-bootstrap.md`), then run:
112
+ ```bash
113
+ node scripts/work-item-memory.mjs <work-item-id>
114
+ # Note: verify script exists first: ls {PROJECT_ROOT}/scripts/work-item-memory.mjs
115
+ # If the script is absent, skip this step and note it in the implementation report.
116
+ ```
117
+
118
+ ```bash
119
+ rm {USER_HOME}/.claude/fixit.marker
120
+ ```
121
+
122
+ ### 7. Confirm to user
123
+
124
+ Report: what was fixed, file(s) changed, commit hash. One sentence.
125
+
126
+ ## Rules
127
+ - Work item created BEFORE any code change — never after
128
+ - `git add` specific files only — never `-A` or `.` for a fixit
129
+ - Branch: development branch always
130
+ - Never run `pnpm build` — not needed for a fixit
131
+ - If scope expands mid-fix: stop, escalate to rdc:build, don't finish under fixit
132
+ - Marker file must be cleaned up whether fix succeeds or escalates
@@ -1,200 +1,200 @@
1
- ---
2
- name: rdc:handoff
3
- description: "Convert a finalized plan or prototype into CLI-ready artifacts: writes .rdc/plans/, creates Supabase work items with DoD checklists, registers prototype if present. Bridge between planning session and rdc:build."
4
- ---
5
-
6
- > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
7
- > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
8
- > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
9
-
10
- > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
11
-
12
- > **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag. Supabase work item writes, prototype registry inserts, design context inserts, and git push are skipped under `RDC_TEST=1`.
13
-
14
-
15
- # rdc:handoff — Planning → CLI Bridge
16
-
17
- ## When to Use
18
-
19
- - A prototype has been built and needs production implementation
20
- - A design decision has been made and needs to be executed
21
- - Project lead says "hand this off", "give this to the CLI", "write it up"
22
- - A plan exists in the conversation but hasn't been saved to disk or database yet
23
-
24
- ## What This Skill Produces
25
-
26
- 1. **Plan doc** → `.rdc/plans/<topic-slug>.md` (fallback: `.rdc/plans/<topic-slug>.md`)
27
- 2. **Database epic + child tasks** (with agent types and guide file refs)
28
- 3. **Prototype registry entry** (if a prototype was built)
29
- 4. **Design context entries** (for decisions made in the session)
30
-
31
- ## Procedure
32
-
33
- ### Step 1 — Extract the Plan
34
-
35
- Identify from the conversation:
36
- - What is the goal?
37
- - What prototypes or designs were built? Where are they?
38
- - What decisions were made? What was rejected and why?
39
- - What is the sequencing (what depends on what)?
40
- - Which agent types are needed?
41
-
42
- ### Step 2 — Write the Plan Doc
43
-
44
- ```
45
- .rdc/plans/<topic-slug>.md
46
- ```
47
- (fallback: `.rdc/plans/<topic-slug>.md` if `.rdc/` does not exist)
48
-
49
- Template:
50
- ```markdown
51
- # Plan: <Topic>
52
- > Route: <app route or package>
53
- > Status: Ready for CLI build
54
- > Created: <date>
55
- > Source: planning session
56
-
57
- ---
58
-
59
- ## What Already Exists (Do NOT Re-implement)
60
-
61
- [List any existing components, database tables, or files
62
- that agents must use rather than recreate]
63
-
64
- ## What Was Built in Planning (Prototype)
65
-
66
- [Describe the prototype — file location, key design decisions,
67
- what to preserve vs what to adapt]
68
-
69
- ## Work Packages
70
-
71
- ### Package 1 — <Name>
72
- - Agent type: frontend | backend | data | design | infra | content | cs2 | viz
73
- - Guide: .rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md)
74
- - Files to create/modify: [list]
75
- - Deliverables: [specific outputs]
76
- - Depends on: [other packages if sequential]
77
-
78
- ### Package 2 — <Name>
79
- [...]
80
-
81
- ## Sequencing
82
-
83
- Wave 1 (parallel): Package 1, Package 2
84
- Wave 2 (after Wave 1): Package 3
85
-
86
- ## Checklist Decomposition Matrix
87
-
88
- | Work item | Atomic deliverable | Surface type | Route or file path | Preconditions / fixture data | Action | Expected result | Verification artifact | Owner package | Status |
89
- |-----------|-------------------|--------------|--------------------|------------------------------|--------|-----------------|-----------------------|---------------|--------|
90
- | WP-1 | decomp-<surface>-<slug> | screen | /route | seeded fixture | open / click / submit | observable result | Playwright screenshot / route probe / test name | Package 1 | todo |
91
-
92
- Rules:
93
- - One observable behavior per row.
94
- - Each row must be independently pass/fail.
95
- - Each implementation work item must have matching `decomp-*` checklist rows and `test-*` verification rows.
96
- - UI routes list state rows separately: empty, loading, loaded, error, create/edit/detail/mobile where applicable.
97
- - API and DB rows include success, failure/guard, and side-effect proof where applicable.
98
-
99
- ## Checklist Quality Gate
100
-
101
- verdict: PASS | FAIL
102
- failures:
103
- - <missing/coarse row if any>
104
- deferred:
105
- - <explicitly out-of-scope row if any>
106
-
107
- ## Definition of Done
108
-
109
- - [ ] [specific acceptance criterion]
110
- - [ ] [build verification: zero new TS errors]
111
- - [ ] [functional test]
112
- ```
113
-
114
- ### Step 3 — Create Database Epic + Tasks
115
-
116
- ```sql
117
- -- Check for existing epics first
118
- SELECT get_open_epics();
119
-
120
- -- Create epic
121
- SELECT insert_work_item(
122
- p_title := 'EPIC: <Topic>',
123
- p_description := 'See .rdc/plans/<topic-slug>.md for full spec.',
124
- p_item_type := 'epic',
125
- p_priority := 'high',
126
- p_labels := ARRAY['<system-label>'],
127
- p_source := 'planning'
128
- );
129
-
130
- -- Create tasks (one per work package)
131
- SELECT insert_work_item(
132
- p_title := '<Package Name>',
133
- p_description := 'What: <deliverable>
134
- Where: <files>
135
- Agent type: <type>
136
- Guide: .rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md)
137
- Design doc: .rdc/plans/<topic-slug>.md (fallback: .rdc/plans/<topic-slug>.md)
138
- Checklist: include required rows from the plan matrix:
139
- - decomp-<surface>-<slug>: route/file=<path> | action=<action> | expect=<result> | evidence=<artifact>
140
- - test-<type>-<slug>: <verification command or artifact>
141
- Depends on: <other task if applicable>
142
- Est: <hours>',
143
- p_parent_id := '<epic-uuid>'::uuid,
144
- p_item_type := 'task',
145
- p_priority := 'high',
146
- p_labels := ARRAY['<label>'],
147
- p_estimated_hours := 2,
148
- p_source := 'planning'
149
- );
150
- ```
151
-
152
- Do not create build-ready tasks unless the plan has `## Checklist Decomposition Matrix` and `## Checklist Quality Gate` with `verdict: PASS`. If the matrix fails, save the plan as `Status: Needs checklist repair` and return the failure list instead of creating dispatchable implementation tasks.
153
-
154
- ### Step 4 — Register Prototype (if one was built)
155
-
156
- ```sql
157
- INSERT INTO prototype_registry (name, component, source_path, notes, created_by)
158
- VALUES (
159
- '<Component Name> v1',
160
- '<ComponentName>',
161
- 'docs/source/<filename>.jsx',
162
- '<Key design decisions, data shapes, what to preserve>',
163
- 'planning'
164
- )
165
- ON CONFLICT DO NOTHING;
166
- ```
167
-
168
- ### Step 5 — Record Design Decisions
169
-
170
- ```sql
171
- INSERT INTO design_context (topic, context_type, summary, source, created_by)
172
- VALUES
173
- ('<Topic>', 'decision', '<What was decided and why>', 'planning session', 'planning'),
174
- ('<Topic>', 'rejected', '<What was considered but not chosen, and why>', 'planning session', 'planning');
175
- ```
176
-
177
- ## System Labels Reference
178
-
179
- | Label | When |
180
- |-------|------|
181
- | `project-a` | Your-app-specific label |
182
- | `marketing` | Marketing / outreach work |
183
- | `ui` | Component library work |
184
- | `data` | Schema, migrations |
185
- | `infrastructure` | CI/CD, deployment |
186
- | `cs2` | Core paradigm packages |
187
- | `website` | Public-facing sites |
188
- | `media` | Media/asset work |
189
-
190
- ## Output
191
-
192
- When complete, tell the project lead:
193
- ```
194
- Handoff complete:
195
- - Plan: .rdc/plans/<topic-slug>.md
196
- - Epic: <epic-id> ("<title>")
197
- - Tasks: <N> tasks created, wave structure: [Wave 1: X, Y | Wave 2: Z]
198
- - Prototype: registered at docs/source/<file> (if applicable)
199
- - CLI agents will pick this up on next run.
200
- ```
1
+ ---
2
+ name: rdc:handoff
3
+ description: "Usage `rdc:handoff [--from-prototype <id>]` — Convert a finalized plan or prototype into CLI-ready artifacts: writes .rdc/plans/, creates Supabase work items with DoD checklists, registers prototype if present. Bridge between planning session and rdc:build."
4
+ ---
5
+
6
+ > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
7
+ > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
8
+ > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
9
+
10
+ > If dispatching subagents or running as a subagent: read `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md` first (fallback: `{PROJECT_ROOT}/.rdc/guides/agent-bootstrap.md`).
11
+
12
+ > **Sandbox contract:** This skill honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag. Supabase work item writes, prototype registry inserts, design context inserts, and git push are skipped under `RDC_TEST=1`.
13
+
14
+
15
+ # rdc:handoff — Planning → CLI Bridge
16
+
17
+ ## When to Use
18
+
19
+ - A prototype has been built and needs production implementation
20
+ - A design decision has been made and needs to be executed
21
+ - Project lead says "hand this off", "give this to the CLI", "write it up"
22
+ - A plan exists in the conversation but hasn't been saved to disk or database yet
23
+
24
+ ## What This Skill Produces
25
+
26
+ 1. **Plan doc** → `.rdc/plans/<topic-slug>.md` (fallback: `.rdc/plans/<topic-slug>.md`)
27
+ 2. **Database epic + child tasks** (with agent types and guide file refs)
28
+ 3. **Prototype registry entry** (if a prototype was built)
29
+ 4. **Design context entries** (for decisions made in the session)
30
+
31
+ ## Procedure
32
+
33
+ ### Step 1 — Extract the Plan
34
+
35
+ Identify from the conversation:
36
+ - What is the goal?
37
+ - What prototypes or designs were built? Where are they?
38
+ - What decisions were made? What was rejected and why?
39
+ - What is the sequencing (what depends on what)?
40
+ - Which agent types are needed?
41
+
42
+ ### Step 2 — Write the Plan Doc
43
+
44
+ ```
45
+ .rdc/plans/<topic-slug>.md
46
+ ```
47
+ (fallback: `.rdc/plans/<topic-slug>.md` if `.rdc/` does not exist)
48
+
49
+ Template:
50
+ ```markdown
51
+ # Plan: <Topic>
52
+ > Route: <app route or package>
53
+ > Status: Ready for CLI build
54
+ > Created: <date>
55
+ > Source: planning session
56
+
57
+ ---
58
+
59
+ ## What Already Exists (Do NOT Re-implement)
60
+
61
+ [List any existing components, database tables, or files
62
+ that agents must use rather than recreate]
63
+
64
+ ## What Was Built in Planning (Prototype)
65
+
66
+ [Describe the prototype — file location, key design decisions,
67
+ what to preserve vs what to adapt]
68
+
69
+ ## Work Packages
70
+
71
+ ### Package 1 — <Name>
72
+ - Agent type: frontend | backend | data | design | infra | content | cs2 | viz
73
+ - Guide: .rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md)
74
+ - Files to create/modify: [list]
75
+ - Deliverables: [specific outputs]
76
+ - Depends on: [other packages if sequential]
77
+
78
+ ### Package 2 — <Name>
79
+ [...]
80
+
81
+ ## Sequencing
82
+
83
+ Wave 1 (parallel): Package 1, Package 2
84
+ Wave 2 (after Wave 1): Package 3
85
+
86
+ ## Checklist Decomposition Matrix
87
+
88
+ | Work item | Atomic deliverable | Surface type | Route or file path | Preconditions / fixture data | Action | Expected result | Verification artifact | Owner package | Status |
89
+ |-----------|-------------------|--------------|--------------------|------------------------------|--------|-----------------|-----------------------|---------------|--------|
90
+ | WP-1 | decomp-<surface>-<slug> | screen | /route | seeded fixture | open / click / submit | observable result | Playwright screenshot / route probe / test name | Package 1 | todo |
91
+
92
+ Rules:
93
+ - One observable behavior per row.
94
+ - Each row must be independently pass/fail.
95
+ - Each implementation work item must have matching `decomp-*` checklist rows and `test-*` verification rows.
96
+ - UI routes list state rows separately: empty, loading, loaded, error, create/edit/detail/mobile where applicable.
97
+ - API and DB rows include success, failure/guard, and side-effect proof where applicable.
98
+
99
+ ## Checklist Quality Gate
100
+
101
+ verdict: PASS | FAIL
102
+ failures:
103
+ - <missing/coarse row if any>
104
+ deferred:
105
+ - <explicitly out-of-scope row if any>
106
+
107
+ ## Definition of Done
108
+
109
+ - [ ] [specific acceptance criterion]
110
+ - [ ] [build verification: zero new TS errors]
111
+ - [ ] [functional test]
112
+ ```
113
+
114
+ ### Step 3 — Create Database Epic + Tasks
115
+
116
+ ```sql
117
+ -- Check for existing epics first
118
+ SELECT get_open_epics();
119
+
120
+ -- Create epic
121
+ SELECT insert_work_item(
122
+ p_title := 'EPIC: <Topic>',
123
+ p_description := 'See .rdc/plans/<topic-slug>.md for full spec.',
124
+ p_item_type := 'epic',
125
+ p_priority := 'high',
126
+ p_labels := ARRAY['<system-label>'],
127
+ p_source := 'planning'
128
+ );
129
+
130
+ -- Create tasks (one per work package)
131
+ SELECT insert_work_item(
132
+ p_title := '<Package Name>',
133
+ p_description := 'What: <deliverable>
134
+ Where: <files>
135
+ Agent type: <type>
136
+ Guide: .rdc/guides/<type>.md (fallback: .rdc/guides/<type>.md)
137
+ Design doc: .rdc/plans/<topic-slug>.md (fallback: .rdc/plans/<topic-slug>.md)
138
+ Checklist: include required rows from the plan matrix:
139
+ - decomp-<surface>-<slug>: route/file=<path> | action=<action> | expect=<result> | evidence=<artifact>
140
+ - test-<type>-<slug>: <verification command or artifact>
141
+ Depends on: <other task if applicable>
142
+ Est: <hours>',
143
+ p_parent_id := '<epic-uuid>'::uuid,
144
+ p_item_type := 'task',
145
+ p_priority := 'high',
146
+ p_labels := ARRAY['<label>'],
147
+ p_estimated_hours := 2,
148
+ p_source := 'planning'
149
+ );
150
+ ```
151
+
152
+ Do not create build-ready tasks unless the plan has `## Checklist Decomposition Matrix` and `## Checklist Quality Gate` with `verdict: PASS`. If the matrix fails, save the plan as `Status: Needs checklist repair` and return the failure list instead of creating dispatchable implementation tasks.
153
+
154
+ ### Step 4 — Register Prototype (if one was built)
155
+
156
+ ```sql
157
+ INSERT INTO prototype_registry (name, component, source_path, notes, created_by)
158
+ VALUES (
159
+ '<Component Name> v1',
160
+ '<ComponentName>',
161
+ 'docs/source/<filename>.jsx',
162
+ '<Key design decisions, data shapes, what to preserve>',
163
+ 'planning'
164
+ )
165
+ ON CONFLICT DO NOTHING;
166
+ ```
167
+
168
+ ### Step 5 — Record Design Decisions
169
+
170
+ ```sql
171
+ INSERT INTO design_context (topic, context_type, summary, source, created_by)
172
+ VALUES
173
+ ('<Topic>', 'decision', '<What was decided and why>', 'planning session', 'planning'),
174
+ ('<Topic>', 'rejected', '<What was considered but not chosen, and why>', 'planning session', 'planning');
175
+ ```
176
+
177
+ ## System Labels Reference
178
+
179
+ | Label | When |
180
+ |-------|------|
181
+ | `project-a` | Your-app-specific label |
182
+ | `marketing` | Marketing / outreach work |
183
+ | `ui` | Component library work |
184
+ | `data` | Schema, migrations |
185
+ | `infrastructure` | CI/CD, deployment |
186
+ | `cs2` | Core paradigm packages |
187
+ | `website` | Public-facing sites |
188
+ | `media` | Media/asset work |
189
+
190
+ ## Output
191
+
192
+ When complete, tell the project lead:
193
+ ```
194
+ Handoff complete:
195
+ - Plan: .rdc/plans/<topic-slug>.md
196
+ - Epic: <epic-id> ("<title>")
197
+ - Tasks: <N> tasks created, wave structure: [Wave 1: X, Y | Wave 2: Z]
198
+ - Prototype: registered at docs/source/<file> (if applicable)
199
+ - CLI agents will pick this up on next run.
200
+ ```