@lifeaitools/rdc-skills 0.20.6 → 0.21.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.claude-plugin/plugin.json +42 -1
  2. package/.github/workflows/self-test.yml +34 -34
  3. package/CHANGELOG.md +12 -0
  4. package/commands/build.md +181 -181
  5. package/commands/collab.md +180 -180
  6. package/commands/deploy.md +148 -148
  7. package/commands/fixit.md +105 -105
  8. package/commands/handoff.md +173 -173
  9. package/commands/overnight.md +218 -218
  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 +127 -127
  17. package/git-sha.json +1 -1
  18. package/guides/agent-bootstrap.md +195 -195
  19. package/guides/agents/backend.md +102 -102
  20. package/guides/agents/content.md +94 -94
  21. package/guides/agents/cs2.md +56 -56
  22. package/guides/agents/data.md +86 -86
  23. package/guides/agents/design.md +77 -77
  24. package/guides/agents/frontend.md +91 -91
  25. package/guides/agents/infrastructure.md +81 -81
  26. package/guides/agents/setup.md +272 -272
  27. package/guides/agents/verify.md +119 -119
  28. package/guides/agents/viz.md +106 -106
  29. package/package.json +1 -1
  30. package/scripts/self-test.mjs +1458 -1458
  31. package/skills/build/SKILL.md +478 -478
  32. package/skills/channel-formatter/SKILL.md +312 -0
  33. package/skills/collab/SKILL.md +239 -239
  34. package/skills/deploy/SKILL.md +522 -522
  35. package/skills/design/SKILL.md +205 -205
  36. package/skills/fixit/SKILL.md +165 -165
  37. package/skills/handoff/SKILL.md +200 -200
  38. package/skills/overnight/SKILL.md +230 -230
  39. package/skills/plan/SKILL.md +274 -274
  40. package/skills/preplan/SKILL.md +90 -90
  41. package/skills/prototype/SKILL.md +150 -150
  42. package/skills/release/SKILL.md +140 -140
  43. package/skills/report/SKILL.md +100 -100
  44. package/skills/review/SKILL.md +152 -152
  45. package/skills/self-test/SKILL.md +123 -123
  46. package/skills/status/SKILL.md +99 -99
  47. package/skills/watch/SKILL.md +90 -90
  48. package/skills/workitems/SKILL.md +151 -151
@@ -1,274 +1,274 @@
1
- ---
2
- name: rdc:plan
3
- description: "Usage `rdc:plan <topic>` — No epic exists and you need architecture + task breakdown. Produces design decisions, tradeoffs, and Supabase epics/tasks with DoD checklists that feed rdc:build. Use after rdc:preplan or when given clear architectural direction."
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 epic/task writes and git push are skipped under `RDC_TEST=1`.
13
-
14
-
15
- # rdc:plan — Architecture & Work Packages
16
-
17
- ## When to Use
18
- - After `/rdc:preplan` produced research findings
19
- - Project lead gives architectural direction ("build X with Y approach")
20
- - An epic exists but needs breakdown into implementable tasks
21
- - Before any large build session
22
- - Called by `rdc:overnight` when an epic has no child tasks
23
-
24
- ## Arguments
25
- - `rdc:plan <topic>` — interactive planning session
26
- - `rdc:plan <epic-id> --unattended` — silent mode for overnight builds
27
-
28
- ## Procedure
29
-
30
- 1. **Gather inputs:**
31
- - Research doc from preplan (if exists): `.rdc/research/<topic>.md` (fallback: `.rdc/research/<topic>.md`)
32
- - Project lead's architectural direction from conversation
33
- - Relevant CLAUDE.md files from affected packages
34
- - Existing Supabase epics: `SELECT get_open_epics()`
35
-
36
- 2. **Read the codebase** — understand current state:
37
- - What packages are affected?
38
- - What types/interfaces already exist?
39
- - What tests exist?
40
- - What's the dependency graph?
41
-
42
- 3. **Make design decisions** — for each major choice:
43
- - State the decision clearly
44
- - Document what was chosen and what was rejected
45
- - Explain WHY (tradeoff rationale)
46
- - Note consequences and reversibility
47
-
48
- 4. **Define work packages** — break into agent-dispatchable units:
49
- - Each work package = one agent assignment
50
- - No file overlap between packages
51
- - Each package has: scope, files to create/modify, test plan
52
- - Assign an agent type to each work package from the typed dispatch table in rdc:build. Include the guide file path (from `.rdc/guides/`, fallback `.rdc/guides/`) in each work package description.
53
- - Estimate: small (1 agent, <500 LOC), medium (1 agent, 500-1500 LOC), large (needs splitting)
54
-
55
- 4b. **Build the checklist decomposition matrix (MANDATORY PRE-BUILD GATE):**
56
-
57
- Before writing Supabase work items, create a `## Checklist Decomposition Matrix`
58
- in the plan doc. This matrix is the source of truth for task checklists and
59
- build verification.
60
-
61
- Required columns:
62
- - Work item ID or placeholder
63
- - Atomic deliverable
64
- - Surface type: `screen`, `state`, `action`, `api`, `db`, `migration`, `component`, `asset`, `tool`, `test`, `doc`
65
- - Route or file path
66
- - Preconditions / fixture data
67
- - User or agent action
68
- - Expected UI/API/DB result
69
- - Verification artifact: test name, route probe, Playwright screenshot, SQL query, API response, type-check, migration proof, or CLI transcript
70
- - Owner work package
71
- - Status
72
-
73
- Atomicity rubric:
74
- - One observable behavior per row.
75
- - Each row names a concrete route or file path.
76
- - Each row names one concrete verification artifact.
77
- - Each row can independently pass or fail.
78
- - Each row is small enough for a worker to implement and tick without hidden intent.
79
-
80
- Required decomposition by surface:
81
- - UI screens: list empty, loading, loaded, error, create, edit, detail, delete/archive guard, mobile, and auth states where applicable.
82
- - UI actions: open, search, filter, select, duplicate, save, assign, activate, archive, delete, import, apply, cancel where applicable.
83
- - API routes: successful read/write, validation failure, unauthorized/forbidden, and side-effect verification where applicable.
84
- - DB/migrations: table/column/index/policy/trigger/function, FK/guard, rollback or smoke query, and type exposure.
85
- - CLI/sidebar/local tools: start, attach, enqueue, poll, reply, timeout/not-found, and live refresh where applicable.
86
- - Visual work: each named screenshot and visual checkpoint gets its own row.
87
- - Cross-system workflows: each handoff boundary gets its own row.
88
-
89
- Minimum row-count heuristics:
90
- - UI route: at least 4 rows.
91
- - CRUD surface: at least 6 rows.
92
- - API route: at least 3 rows.
93
- - DB work package: at least 5 rows.
94
- - Local editor/sidebar workflow: at least 5 rows.
95
-
96
- Reject these checklist items as too coarse:
97
- - "theme management works"
98
- - "build all screens"
99
- - "verify UI"
100
- - "integration complete"
101
- - "tests pass"
102
-
103
- Replace them with rows like:
104
- - `decomp-ui-theme-manager-loaded: /brands/[id]/theme shows owned theme rows with status, project usage, and actions; evidence: Playwright screenshot`
105
- - `decomp-action-duplicate-theme: duplicate submits source brand_theme_id and creates a new editable brand-owned copy; evidence: vitest + DB query`
106
- - `decomp-api-import-validation: POST /api/tools/theme-import rejects missing source URL with 400 JSON error; evidence: route probe`
107
-
108
- Add a `## Checklist Quality Gate` section with:
109
- - `verdict: PASS` only when every row passes the rubric.
110
- - `failures:` list any coarse, missing, duplicate, or unverifiable rows.
111
- - `deferred:` list any explicit out-of-scope rows.
112
-
113
- Do not create build-ready work items unless this gate is `PASS`.
114
-
115
- 5. **Write a test plan for each work package (MANDATORY):**
116
-
117
- Every work package MUST have a `test_plan` section with specific, concrete test items. Each item has a type:
118
-
119
- | Type | What it proves | How agent verifies | Example |
120
- |------|---------------|-------------------|---------|
121
- | `assert` | Logic is correct | Write a vitest test — input → expected output | `extractCode("```tsx\nfoo\n```") returns "foo"` |
122
- | `smoke` | It runs without crashing | Run command, check exit code / HTTP status | `tsc --noEmit passes`, `GET /api/layout/scan returns 200` |
123
- | `visual` | It looks right | Delegate to UI audit tool with specific checkpoints | `"/layout page renders container tree, not login screen"` |
124
- | `contract` | Interface matches spec | Check exports, prop types, response shape | `ScanResult has { roots: ContainerNode[] }` |
125
-
126
- **Rules for writing test plan items:**
127
- - Every item must be a specific, falsifiable assertion — not "write tests" or "verify it works"
128
- - Every item must map to one or more rows in the Checklist Decomposition Matrix.
129
- - A test plan item may summarize multiple checks only when the matrix still keeps those checks as separate atomic rows.
130
- - New functions/modules MUST have at least one `assert` item
131
- - API routes MUST have at least one `smoke` item
132
- - UI pages MUST have at least one `visual` item
133
- - New exports/types MUST have at least one `contract` item
134
- - `assert` and `smoke` are mandatory for every work package. `visual` and `contract` when applicable.
135
-
136
- **Example test plan in a plan doc:**
137
- ```markdown
138
- ### WP-2: AST Scanner
139
- **Test plan:**
140
- - assert: `scanFile` returns only Window/Frame/Pane/SubPane nodes, not Badge/Button
141
- - assert: SubPane nested directly in root produces a warning
142
- - assert: Valid Window > Frame > Pane > SubPane nesting produces no warnings
143
- - smoke: `GET /api/layout/scan?dir=apps/studio/src` returns 200 with JSON body
144
- - smoke: `npx tsc --noEmit` exits 0
145
- - contract: `ScanResult` has shape `{ filePath: string, roots: ContainerNode[], warnings: ScanWarning[] }`
146
- ```
147
-
148
- 6. **Write plan doc** to `.rdc/plans/<topic-slug>.md` (fallback: `.rdc/plans/<topic-slug>.md` if `.rdc/` does not exist):
149
- ```markdown
150
- # Plan: <Topic>
151
- > Generated: <date> | Epic: <id if exists>
152
-
153
- ## Goal
154
- ## Design Decisions
155
- ## Work Packages (each with test plan)
156
- ## Checklist Decomposition Matrix
157
- ## Checklist Quality Gate
158
- ## Sequencing (what can parallelize, what depends on what)
159
- ## Risks & Mitigations
160
- ```
161
-
162
- 7. **Create Supabase epic + child tasks:**
163
- - Epic via `insert_work_item(p_item_type := 'epic', p_definition_of_done := '[...]'::jsonb, ...)`
164
- - Epic DoD MUST include: `{"id":"test-plan-verified","text":"All test plan items implemented and passing","required":true,"checked":false}`
165
- - Set `p_definition_of_done` on the epic — child tasks inserted under it will auto-inherit it as their checklist
166
- - One task per work package via `insert_work_item(p_parent_id := <epic_id>, ...)` — checklist auto-hydrated from epic's DoD
167
- - **Additionally, write decomposition rows as checklist items** on each task, using id format `decomp-<surface>-<slug>`.
168
- The task checklist MUST include both the atomic `decomp-*` rows and the `test-*` verification rows.
169
- The `decomp-*` row text must include the route/file, action, expected result, and evidence artifact.
170
- - **Write test plan items as checklist items** on each task, using id format `test-<type>-<slug>`:
171
- ```sql
172
- SELECT insert_work_item(
173
- p_parent_id := '<epic_id>',
174
- p_title := 'WP-2: AST Scanner',
175
- p_checklist := '[
176
- {"id":"decomp-api-scan-success","text":"api: GET /api/layout/scan?dir=apps/studio/src returns 200 JSON with roots[] and warnings[]; evidence: route probe output","required":true,"checked":false},
177
- {"id":"test-assert-scanner-filters","text":"assert: scanFile returns only container components","required":true,"checked":false},
178
- {"id":"test-assert-nesting-warn","text":"assert: invalid nesting produces warnings","required":true,"checked":false},
179
- {"id":"test-smoke-scan-api","text":"smoke: GET /api/layout/scan returns 200","required":true,"checked":false},
180
- {"id":"test-contract-scanresult","text":"contract: ScanResult shape matches spec","required":true,"checked":false},
181
- {"id":"tsc-clean","text":"npx tsc --noEmit passes","required":true,"checked":false}
182
- ]'::jsonb
183
- );
184
- ```
185
- - Agents MUST tick each `decomp-*` and `test-*` checklist item as they implement/verify it via `update_checklist_item(..., p_actor_session_id := '<agent-session-id>', p_actor_role := 'agent')`
186
- - Agents submit `implementation_report.codeflow_post`, then move work to `review`; validators close `done`
187
- - `update_work_item_status('done', ..., p_actor_role := 'validator')` rejects missing reports, unchecked required items, and supervisor/validator re-ticks
188
- - Set priorities: urgent/high/normal based on sequencing
189
-
190
- 7. **Report results:**
191
- - Interactive: present the plan for approval before building
192
- - Unattended: skip approval, proceed immediately, emit status block:
193
- ```
194
- PLAN_STATUS: { epic_id, task_count, doc_path, waves }
195
- ```
196
-
197
- ## Unattended Escalation
198
-
199
- When `--unattended` and genuine architectural ambiguity is detected — meaning multiple
200
- valid approaches exist with significantly different tradeoffs (not just minor style choices)
201
- — escalate via the advisor tool. Provide: the decision point, the options with tradeoffs,
202
- and the project context. Resume with advisor's recommendation. If advisor is unavailable,
203
- choose the most conservative/reversible approach and document the decision.
204
-
205
- ## Rules
206
- - Interactive: ALWAYS get approval before proceeding to build
207
- - Unattended: proceed immediately without approval
208
- - Plan doc goes in `.rdc/plans/` (fallback: `.rdc/plans/` if `.rdc/` does not exist) — not `.planning/`
209
- - Each work package must be independently executable by an agent
210
- - No file overlap between work packages
211
- - Include test requirements in every work package
212
- - Reference affected CLAUDE.md files in each work package description
213
- - Reference the relevant guide file from `.rdc/guides/` (fallback: `.rdc/guides/`) for agent context
214
- - **If a work package involves creating a new deployed app:** the task description MUST say "Use `rdc:deploy new <slug>` — do NOT create the Coolify app manually. Read `docs/runbooks/coolify-app-templates.json` first." Assign it to an `infra` agent. This is a hard rule — manually created apps have consistently been misconfigured.
215
-
216
- ## New App Q&A (mandatory before writing any infra task that creates a Coolify app)
217
-
218
- If the plan includes deploying a new app, these questions MUST be answered — in interactive mode, ask the user; in unattended mode, escalate via advisor. Do NOT write the infra task until all answers are locked in. Record answers in the plan doc and embed them directly in the task description.
219
-
220
- **Never guess. Wrong project = delete and recreate. There is no move operation in Coolify.**
221
-
222
- ```
223
- Q1. Which Coolify project does this app belong to?
224
- → Read docs/runbooks/coolify-app-templates.json → _infrastructure.projects
225
- → Match by area: design-system / prt / rdc / rdc-marketing / zoen / lifeai / place-fund / infrastructure / ai-platform
226
- → If unsure: ASK. Do not infer from app name alone.
227
- → Record: project_uuid + environment_uuid (staging or production)
228
-
229
- Q2. What is the domain?
230
- → staging wildcard subdomain? (staging / internal tools)
231
- → Custom subdomain on an existing zone? (e.g. app.regendevcorp.com)
232
- → Apex domain? (e.g. place.fund itself)
233
- → Domain on a different zone entirely? (e.g. skymesasouth.com)
234
-
235
- Q3. Is this domain already in our Cloudflare account?
236
- → Yes, zone exists → which zone?
237
- → No → who controls the nameservers? Does the registrar point NS to Cloudflare?
238
- → If NS not delegated to Cloudflare: A record in Cloudflare does nothing — must go to registrar
239
-
240
- Q4. Does this app need Cloudflare proxy (orange cloud)?
241
- → Traefik/Let's Encrypt HTTP-01 staging wildcards are often safest unproxied; verify your platform's DNS requirements.
242
- → Custom domain needing DDoS/CDN: proxy OK only if SSL mode = Full (strict) + origin cert provisioned
243
- → Any doubt: start unproxied, add proxy after confirming SSL works
244
-
245
- Q5. What SSL path?
246
- → Traefik + Let's Encrypt (default for all unproxied): automatic, no action needed
247
- → Cloudflare proxy + Full (strict): need origin cert from Cloudflare dashboard first
248
- → Nixpacks build pack: DO NOT USE for any app that needs custom SSL setup — nixpacks
249
- containers have incompatible SSL configuration requirements. Use dockerfile build pack only.
250
- ```
251
-
252
- Embed all five answers into the infra task description verbatim before handing to the agent.
253
-
254
- ## MCP / infra plans — mirror the closest sibling deployment FIRST
255
-
256
- Before writing any plan that stands up an MCP server or infra service, read how the
257
- **closest existing sibling** is actually deployed (`.mcp.json` + its PM2/tunnel or
258
- Coolify/Docker config) and **cite it in the plan**. Two MCP topologies coexist and
259
- applying the wrong reference over-engineers the design (lesson
260
- 2026-06-10-plan-mirror-sibling-mcp-pattern: a first MCP plan proposed
261
- Docker + Coolify + a Cloudflare-proxied origin + runtime GitHub-pull when the real
262
- pattern was a local Node process + clauth-managed tunnel, exactly like codeflow-mcp):
263
-
264
- - **LOCAL-MCP reference = `codeflow-mcp`** — local Node process (`:3109`) + clauth-managed
265
- tunnel ingress. Mirror this for MCPs that live on Dave's box.
266
- - **REMOTE-MCP reference = `web-research` / `regen-media`** — Coolify/Docker, Cloudflare-proxied
267
- origin (`.claude/rules/mcp-endpoint-design.md` covers the REMOTE class only).
268
-
269
- Decide which class applies and name the sibling in the plan's Design Decisions before
270
- designing topology. Do not reach for the REMOTE rule by default.
271
-
272
- ## Capture lessons (exit step)
273
-
274
- Before the final verdict line, follow `.rdc/guides/lessons-learned-spec.md` § Capture procedure. If this run taught something non-obvious — a first root-cause theory that turned out wrong, the documented/standard path not working, a missing gate or check that cost a round, or a surprising tool/infra behavior — write one `.rdc/lessons/<YYYY-MM-DD>-plan-<short-slug>.md` per lesson using the schema in that spec. Set `scope` (`simple` | `architectural`) and `status` (`open`, or `applied` if you shipped the fix in this same run, with the commit linked). Commit the lesson file(s) on `develop` alongside the run's other commits, and note "N lessons captured" in your verdict/summary. A run that taught nothing writes nothing — absence is the default.
1
+ ---
2
+ name: rdc:plan
3
+ description: "Usage `rdc:plan <topic>` — No epic exists and you need architecture + task breakdown. Produces design decisions, tradeoffs, and Supabase epics/tasks with DoD checklists that feed rdc:build. Use after rdc:preplan or when given clear architectural direction."
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 epic/task writes and git push are skipped under `RDC_TEST=1`.
13
+
14
+
15
+ # rdc:plan — Architecture & Work Packages
16
+
17
+ ## When to Use
18
+ - After `/rdc:preplan` produced research findings
19
+ - Project lead gives architectural direction ("build X with Y approach")
20
+ - An epic exists but needs breakdown into implementable tasks
21
+ - Before any large build session
22
+ - Called by `rdc:overnight` when an epic has no child tasks
23
+
24
+ ## Arguments
25
+ - `rdc:plan <topic>` — interactive planning session
26
+ - `rdc:plan <epic-id> --unattended` — silent mode for overnight builds
27
+
28
+ ## Procedure
29
+
30
+ 1. **Gather inputs:**
31
+ - Research doc from preplan (if exists): `.rdc/research/<topic>.md` (fallback: `.rdc/research/<topic>.md`)
32
+ - Project lead's architectural direction from conversation
33
+ - Relevant CLAUDE.md files from affected packages
34
+ - Existing Supabase epics: `SELECT get_open_epics()`
35
+
36
+ 2. **Read the codebase** — understand current state:
37
+ - What packages are affected?
38
+ - What types/interfaces already exist?
39
+ - What tests exist?
40
+ - What's the dependency graph?
41
+
42
+ 3. **Make design decisions** — for each major choice:
43
+ - State the decision clearly
44
+ - Document what was chosen and what was rejected
45
+ - Explain WHY (tradeoff rationale)
46
+ - Note consequences and reversibility
47
+
48
+ 4. **Define work packages** — break into agent-dispatchable units:
49
+ - Each work package = one agent assignment
50
+ - No file overlap between packages
51
+ - Each package has: scope, files to create/modify, test plan
52
+ - Assign an agent type to each work package from the typed dispatch table in rdc:build. Include the guide file path (from `.rdc/guides/`, fallback `.rdc/guides/`) in each work package description.
53
+ - Estimate: small (1 agent, <500 LOC), medium (1 agent, 500-1500 LOC), large (needs splitting)
54
+
55
+ 4b. **Build the checklist decomposition matrix (MANDATORY PRE-BUILD GATE):**
56
+
57
+ Before writing Supabase work items, create a `## Checklist Decomposition Matrix`
58
+ in the plan doc. This matrix is the source of truth for task checklists and
59
+ build verification.
60
+
61
+ Required columns:
62
+ - Work item ID or placeholder
63
+ - Atomic deliverable
64
+ - Surface type: `screen`, `state`, `action`, `api`, `db`, `migration`, `component`, `asset`, `tool`, `test`, `doc`
65
+ - Route or file path
66
+ - Preconditions / fixture data
67
+ - User or agent action
68
+ - Expected UI/API/DB result
69
+ - Verification artifact: test name, route probe, Playwright screenshot, SQL query, API response, type-check, migration proof, or CLI transcript
70
+ - Owner work package
71
+ - Status
72
+
73
+ Atomicity rubric:
74
+ - One observable behavior per row.
75
+ - Each row names a concrete route or file path.
76
+ - Each row names one concrete verification artifact.
77
+ - Each row can independently pass or fail.
78
+ - Each row is small enough for a worker to implement and tick without hidden intent.
79
+
80
+ Required decomposition by surface:
81
+ - UI screens: list empty, loading, loaded, error, create, edit, detail, delete/archive guard, mobile, and auth states where applicable.
82
+ - UI actions: open, search, filter, select, duplicate, save, assign, activate, archive, delete, import, apply, cancel where applicable.
83
+ - API routes: successful read/write, validation failure, unauthorized/forbidden, and side-effect verification where applicable.
84
+ - DB/migrations: table/column/index/policy/trigger/function, FK/guard, rollback or smoke query, and type exposure.
85
+ - CLI/sidebar/local tools: start, attach, enqueue, poll, reply, timeout/not-found, and live refresh where applicable.
86
+ - Visual work: each named screenshot and visual checkpoint gets its own row.
87
+ - Cross-system workflows: each handoff boundary gets its own row.
88
+
89
+ Minimum row-count heuristics:
90
+ - UI route: at least 4 rows.
91
+ - CRUD surface: at least 6 rows.
92
+ - API route: at least 3 rows.
93
+ - DB work package: at least 5 rows.
94
+ - Local editor/sidebar workflow: at least 5 rows.
95
+
96
+ Reject these checklist items as too coarse:
97
+ - "theme management works"
98
+ - "build all screens"
99
+ - "verify UI"
100
+ - "integration complete"
101
+ - "tests pass"
102
+
103
+ Replace them with rows like:
104
+ - `decomp-ui-theme-manager-loaded: /brands/[id]/theme shows owned theme rows with status, project usage, and actions; evidence: Playwright screenshot`
105
+ - `decomp-action-duplicate-theme: duplicate submits source brand_theme_id and creates a new editable brand-owned copy; evidence: vitest + DB query`
106
+ - `decomp-api-import-validation: POST /api/tools/theme-import rejects missing source URL with 400 JSON error; evidence: route probe`
107
+
108
+ Add a `## Checklist Quality Gate` section with:
109
+ - `verdict: PASS` only when every row passes the rubric.
110
+ - `failures:` list any coarse, missing, duplicate, or unverifiable rows.
111
+ - `deferred:` list any explicit out-of-scope rows.
112
+
113
+ Do not create build-ready work items unless this gate is `PASS`.
114
+
115
+ 5. **Write a test plan for each work package (MANDATORY):**
116
+
117
+ Every work package MUST have a `test_plan` section with specific, concrete test items. Each item has a type:
118
+
119
+ | Type | What it proves | How agent verifies | Example |
120
+ |------|---------------|-------------------|---------|
121
+ | `assert` | Logic is correct | Write a vitest test — input → expected output | `extractCode("```tsx\nfoo\n```") returns "foo"` |
122
+ | `smoke` | It runs without crashing | Run command, check exit code / HTTP status | `tsc --noEmit passes`, `GET /api/layout/scan returns 200` |
123
+ | `visual` | It looks right | Delegate to UI audit tool with specific checkpoints | `"/layout page renders container tree, not login screen"` |
124
+ | `contract` | Interface matches spec | Check exports, prop types, response shape | `ScanResult has { roots: ContainerNode[] }` |
125
+
126
+ **Rules for writing test plan items:**
127
+ - Every item must be a specific, falsifiable assertion — not "write tests" or "verify it works"
128
+ - Every item must map to one or more rows in the Checklist Decomposition Matrix.
129
+ - A test plan item may summarize multiple checks only when the matrix still keeps those checks as separate atomic rows.
130
+ - New functions/modules MUST have at least one `assert` item
131
+ - API routes MUST have at least one `smoke` item
132
+ - UI pages MUST have at least one `visual` item
133
+ - New exports/types MUST have at least one `contract` item
134
+ - `assert` and `smoke` are mandatory for every work package. `visual` and `contract` when applicable.
135
+
136
+ **Example test plan in a plan doc:**
137
+ ```markdown
138
+ ### WP-2: AST Scanner
139
+ **Test plan:**
140
+ - assert: `scanFile` returns only Window/Frame/Pane/SubPane nodes, not Badge/Button
141
+ - assert: SubPane nested directly in root produces a warning
142
+ - assert: Valid Window > Frame > Pane > SubPane nesting produces no warnings
143
+ - smoke: `GET /api/layout/scan?dir=apps/studio/src` returns 200 with JSON body
144
+ - smoke: `npx tsc --noEmit` exits 0
145
+ - contract: `ScanResult` has shape `{ filePath: string, roots: ContainerNode[], warnings: ScanWarning[] }`
146
+ ```
147
+
148
+ 6. **Write plan doc** to `.rdc/plans/<topic-slug>.md` (fallback: `.rdc/plans/<topic-slug>.md` if `.rdc/` does not exist):
149
+ ```markdown
150
+ # Plan: <Topic>
151
+ > Generated: <date> | Epic: <id if exists>
152
+
153
+ ## Goal
154
+ ## Design Decisions
155
+ ## Work Packages (each with test plan)
156
+ ## Checklist Decomposition Matrix
157
+ ## Checklist Quality Gate
158
+ ## Sequencing (what can parallelize, what depends on what)
159
+ ## Risks & Mitigations
160
+ ```
161
+
162
+ 7. **Create Supabase epic + child tasks:**
163
+ - Epic via `insert_work_item(p_item_type := 'epic', p_definition_of_done := '[...]'::jsonb, ...)`
164
+ - Epic DoD MUST include: `{"id":"test-plan-verified","text":"All test plan items implemented and passing","required":true,"checked":false}`
165
+ - Set `p_definition_of_done` on the epic — child tasks inserted under it will auto-inherit it as their checklist
166
+ - One task per work package via `insert_work_item(p_parent_id := <epic_id>, ...)` — checklist auto-hydrated from epic's DoD
167
+ - **Additionally, write decomposition rows as checklist items** on each task, using id format `decomp-<surface>-<slug>`.
168
+ The task checklist MUST include both the atomic `decomp-*` rows and the `test-*` verification rows.
169
+ The `decomp-*` row text must include the route/file, action, expected result, and evidence artifact.
170
+ - **Write test plan items as checklist items** on each task, using id format `test-<type>-<slug>`:
171
+ ```sql
172
+ SELECT insert_work_item(
173
+ p_parent_id := '<epic_id>',
174
+ p_title := 'WP-2: AST Scanner',
175
+ p_checklist := '[
176
+ {"id":"decomp-api-scan-success","text":"api: GET /api/layout/scan?dir=apps/studio/src returns 200 JSON with roots[] and warnings[]; evidence: route probe output","required":true,"checked":false},
177
+ {"id":"test-assert-scanner-filters","text":"assert: scanFile returns only container components","required":true,"checked":false},
178
+ {"id":"test-assert-nesting-warn","text":"assert: invalid nesting produces warnings","required":true,"checked":false},
179
+ {"id":"test-smoke-scan-api","text":"smoke: GET /api/layout/scan returns 200","required":true,"checked":false},
180
+ {"id":"test-contract-scanresult","text":"contract: ScanResult shape matches spec","required":true,"checked":false},
181
+ {"id":"tsc-clean","text":"npx tsc --noEmit passes","required":true,"checked":false}
182
+ ]'::jsonb
183
+ );
184
+ ```
185
+ - Agents MUST tick each `decomp-*` and `test-*` checklist item as they implement/verify it via `update_checklist_item(..., p_actor_session_id := '<agent-session-id>', p_actor_role := 'agent')`
186
+ - Agents submit `implementation_report.codeflow_post`, then move work to `review`; validators close `done`
187
+ - `update_work_item_status('done', ..., p_actor_role := 'validator')` rejects missing reports, unchecked required items, and supervisor/validator re-ticks
188
+ - Set priorities: urgent/high/normal based on sequencing
189
+
190
+ 7. **Report results:**
191
+ - Interactive: present the plan for approval before building
192
+ - Unattended: skip approval, proceed immediately, emit status block:
193
+ ```
194
+ PLAN_STATUS: { epic_id, task_count, doc_path, waves }
195
+ ```
196
+
197
+ ## Unattended Escalation
198
+
199
+ When `--unattended` and genuine architectural ambiguity is detected — meaning multiple
200
+ valid approaches exist with significantly different tradeoffs (not just minor style choices)
201
+ — escalate via the advisor tool. Provide: the decision point, the options with tradeoffs,
202
+ and the project context. Resume with advisor's recommendation. If advisor is unavailable,
203
+ choose the most conservative/reversible approach and document the decision.
204
+
205
+ ## Rules
206
+ - Interactive: ALWAYS get approval before proceeding to build
207
+ - Unattended: proceed immediately without approval
208
+ - Plan doc goes in `.rdc/plans/` (fallback: `.rdc/plans/` if `.rdc/` does not exist) — not `.planning/`
209
+ - Each work package must be independently executable by an agent
210
+ - No file overlap between work packages
211
+ - Include test requirements in every work package
212
+ - Reference affected CLAUDE.md files in each work package description
213
+ - Reference the relevant guide file from `.rdc/guides/` (fallback: `.rdc/guides/`) for agent context
214
+ - **If a work package involves creating a new deployed app:** the task description MUST say "Use `rdc:deploy new <slug>` — do NOT create the Coolify app manually. Read `docs/runbooks/coolify-app-templates.json` first." Assign it to an `infra` agent. This is a hard rule — manually created apps have consistently been misconfigured.
215
+
216
+ ## New App Q&A (mandatory before writing any infra task that creates a Coolify app)
217
+
218
+ If the plan includes deploying a new app, these questions MUST be answered — in interactive mode, ask the user; in unattended mode, escalate via advisor. Do NOT write the infra task until all answers are locked in. Record answers in the plan doc and embed them directly in the task description.
219
+
220
+ **Never guess. Wrong project = delete and recreate. There is no move operation in Coolify.**
221
+
222
+ ```
223
+ Q1. Which Coolify project does this app belong to?
224
+ → Read docs/runbooks/coolify-app-templates.json → _infrastructure.projects
225
+ → Match by area: design-system / prt / rdc / rdc-marketing / zoen / lifeai / place-fund / infrastructure / ai-platform
226
+ → If unsure: ASK. Do not infer from app name alone.
227
+ → Record: project_uuid + environment_uuid (staging or production)
228
+
229
+ Q2. What is the domain?
230
+ → staging wildcard subdomain? (staging / internal tools)
231
+ → Custom subdomain on an existing zone? (e.g. app.regendevcorp.com)
232
+ → Apex domain? (e.g. place.fund itself)
233
+ → Domain on a different zone entirely? (e.g. skymesasouth.com)
234
+
235
+ Q3. Is this domain already in our Cloudflare account?
236
+ → Yes, zone exists → which zone?
237
+ → No → who controls the nameservers? Does the registrar point NS to Cloudflare?
238
+ → If NS not delegated to Cloudflare: A record in Cloudflare does nothing — must go to registrar
239
+
240
+ Q4. Does this app need Cloudflare proxy (orange cloud)?
241
+ → Traefik/Let's Encrypt HTTP-01 staging wildcards are often safest unproxied; verify your platform's DNS requirements.
242
+ → Custom domain needing DDoS/CDN: proxy OK only if SSL mode = Full (strict) + origin cert provisioned
243
+ → Any doubt: start unproxied, add proxy after confirming SSL works
244
+
245
+ Q5. What SSL path?
246
+ → Traefik + Let's Encrypt (default for all unproxied): automatic, no action needed
247
+ → Cloudflare proxy + Full (strict): need origin cert from Cloudflare dashboard first
248
+ → Nixpacks build pack: DO NOT USE for any app that needs custom SSL setup — nixpacks
249
+ containers have incompatible SSL configuration requirements. Use dockerfile build pack only.
250
+ ```
251
+
252
+ Embed all five answers into the infra task description verbatim before handing to the agent.
253
+
254
+ ## MCP / infra plans — mirror the closest sibling deployment FIRST
255
+
256
+ Before writing any plan that stands up an MCP server or infra service, read how the
257
+ **closest existing sibling** is actually deployed (`.mcp.json` + its PM2/tunnel or
258
+ Coolify/Docker config) and **cite it in the plan**. Two MCP topologies coexist and
259
+ applying the wrong reference over-engineers the design (lesson
260
+ 2026-06-10-plan-mirror-sibling-mcp-pattern: a first MCP plan proposed
261
+ Docker + Coolify + a Cloudflare-proxied origin + runtime GitHub-pull when the real
262
+ pattern was a local Node process + clauth-managed tunnel, exactly like codeflow-mcp):
263
+
264
+ - **LOCAL-MCP reference = `codeflow-mcp`** — local Node process (`:3109`) + clauth-managed
265
+ tunnel ingress. Mirror this for MCPs that live on Dave's box.
266
+ - **REMOTE-MCP reference = `web-research` / `regen-media`** — Coolify/Docker, Cloudflare-proxied
267
+ origin (`.claude/rules/mcp-endpoint-design.md` covers the REMOTE class only).
268
+
269
+ Decide which class applies and name the sibling in the plan's Design Decisions before
270
+ designing topology. Do not reach for the REMOTE rule by default.
271
+
272
+ ## Capture lessons (exit step)
273
+
274
+ Before the final verdict line, follow `.rdc/guides/lessons-learned-spec.md` § Capture procedure. If this run taught something non-obvious — a first root-cause theory that turned out wrong, the documented/standard path not working, a missing gate or check that cost a round, or a surprising tool/infra behavior — write one `.rdc/lessons/<YYYY-MM-DD>-plan-<short-slug>.md` per lesson using the schema in that spec. Set `scope` (`simple` | `architectural`) and `status` (`open`, or `applied` if you shipped the fix in this same run, with the commit linked). Commit the lesson file(s) on `develop` alongside the run's other commits, and note "N lessons captured" in your verdict/summary. A run that taught nothing writes nothing — absence is the default.