@lifeaitools/rdc-skills 0.9.33 → 0.9.34

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 (49) hide show
  1. package/.claude-plugin/plugin.json +2 -1
  2. package/.github/workflows/self-test.yml +34 -34
  3. package/commands/build.md +181 -181
  4. package/commands/collab.md +180 -180
  5. package/commands/deploy.md +152 -152
  6. package/commands/fixit.md +105 -105
  7. package/commands/handoff.md +173 -173
  8. package/commands/overnight.md +220 -220
  9. package/commands/plan.md +158 -158
  10. package/commands/preplan.md +131 -131
  11. package/commands/prototype.md +145 -145
  12. package/commands/report.md +99 -99
  13. package/commands/review.md +120 -120
  14. package/commands/status.md +86 -86
  15. package/commands/workitems.md +127 -127
  16. package/guides/agent-bootstrap.md +206 -202
  17. package/guides/agents/backend.md +102 -102
  18. package/guides/agents/content.md +94 -94
  19. package/guides/agents/cs2.md +56 -56
  20. package/guides/agents/data.md +86 -86
  21. package/guides/agents/design.md +77 -77
  22. package/guides/agents/frontend.md +91 -91
  23. package/guides/agents/infrastructure.md +81 -81
  24. package/guides/agents/setup.md +280 -278
  25. package/guides/agents/verify.md +119 -119
  26. package/guides/agents/viz.md +106 -106
  27. package/guides/engineering-behavior.md +43 -0
  28. package/package.json +2 -2
  29. package/scripts/install-rdc-skills.js +22 -0
  30. package/scripts/self-test.mjs +1337 -1323
  31. package/skills/build/SKILL.md +359 -355
  32. package/skills/collab/SKILL.md +217 -217
  33. package/skills/deploy/SKILL.md +198 -198
  34. package/skills/design/SKILL.md +211 -211
  35. package/skills/fixit/SKILL.md +136 -132
  36. package/skills/fs-mcp/SKILL.md +131 -0
  37. package/skills/handoff/SKILL.md +200 -200
  38. package/skills/help/SKILL.md +104 -104
  39. package/skills/overnight/SKILL.md +224 -224
  40. package/skills/plan/SKILL.md +252 -252
  41. package/skills/preplan/SKILL.md +86 -86
  42. package/skills/prototype/SKILL.md +150 -150
  43. package/skills/release/SKILL.md +342 -342
  44. package/skills/report/SKILL.md +100 -100
  45. package/skills/review/SKILL.md +122 -121
  46. package/skills/self-test/SKILL.md +126 -126
  47. package/skills/status/SKILL.md +99 -99
  48. package/skills/watch/SKILL.md +91 -91
  49. package/skills/workitems/SKILL.md +151 -151
@@ -1,85 +1,89 @@
1
- # Agent Bootstrap — Read This First
2
- > Every dispatched agent reads this before their role-specific guide.
3
- > Base guide for rdc-skills — provides credential, git, and reporting patterns across projects.
4
-
5
- ---
6
-
7
- ## Who You Are
8
-
9
- You are a subagent dispatched by the rdc:build supervisor. You have a specific
10
- scope (files, package, feature) that will be in your prompt. Stay in that scope.
11
- NEVER modify files outside it.
12
-
13
- ---
14
-
15
- ## Credentials Daemon Access Pattern
16
-
17
- You do NOT have access to cloud MCP connectors. Instead, all credentials
18
- come from a daemon running locally (typically on localhost:52437).
19
-
20
- **Ping first to confirm availability:**
21
- ```bash
22
- curl -s http://127.0.0.1:52437/ping
23
- ```
24
- If it doesn't respond — report BLOCKED, do not proceed.
25
-
26
- **Get a credential:**
27
- ```bash
28
- curl -s http://127.0.0.1:52437/get/<service>
29
- ```
30
-
31
- **Pattern for extracting key/value without printing:**
32
- ```bash
33
- # Correct pattern — never echo the key
34
- KEY=$(curl -s http://127.0.0.1:52437/get/<service> | python3 -c "import sys,json; print(json.load(sys.stdin)['key'])")
35
- curl -s -H "Authorization: Bearer $KEY" https://api.example.com/...
36
- ```
37
-
38
- **Never print credentials to stdout.** Capture to a variable, use inline, discard.
39
-
40
- ---
41
-
42
- ## Project Directory Convention
43
-
44
- This plugin uses the `.rdc/` directory convention. Check for it first:
45
-
46
- ```bash
47
- # Check if .rdc/ exists at project root
48
- ls {PROJECT_ROOT}/.rdc/config.json 2>/dev/null && echo "using .rdc/" || echo "using docs/ fallback"
49
- ```
50
-
51
- **Path resolution rule:**
52
- - Guides: `{PROJECT_ROOT}/.rdc/guides/` fallback: `{PROJECT_ROOT}/docs/guides/`
53
- - Plans: `{PROJECT_ROOT}/.rdc/plans/` → fallback: `{PROJECT_ROOT}/docs/plans/`
54
- - Reports: `{PROJECT_ROOT}/.rdc/reports/` → fallback: `{PROJECT_ROOT}/docs/reports/`
55
- - Research: `{PROJECT_ROOT}/.rdc/research/` → fallback: `{PROJECT_ROOT}/docs/research/`
56
-
57
- If `.rdc/config.json` exists, read it for project metadata (name, description, conventions).
58
-
59
- ---
60
-
61
- ## Database Access Check Project Overlay
62
-
63
- The project overlay guide will specify:
64
- - Database project reference / instance name
65
- - Whether to use MCP connectors or daemon
66
- - Available RPC functions
67
- - Work item management patterns
68
-
69
- Read the project-specific agent-bootstrap.md overlay for exact connection details.
70
-
71
- ---
72
-
73
- ## Git Rules
74
-
75
- - Branch: Always use the project's primary development branch (typically `develop` or `main`)
76
- - Auto-commit after completing your scope — no confirmation needed
77
- - Commit message must use conventional format: `feat/fix/chore/refactor(<scope>): description`
78
- - Push to origin after committing
79
- - NEVER force-push
80
-
81
- ---
82
-
1
+ # Agent Bootstrap — Read This First
2
+ > Every dispatched agent reads this before their role-specific guide.
3
+ > Base guide for rdc-skills — provides credential, git, and reporting patterns across projects.
4
+
5
+ ---
6
+
7
+ ## Who You Are
8
+
9
+ You are a subagent dispatched by the rdc:build supervisor. You have a specific
10
+ scope (files, package, feature) that will be in your prompt. Stay in that scope.
11
+ NEVER modify files outside it.
12
+
13
+ Read `guides/engineering-behavior.md` next when it is available. It defines the
14
+ RDC implementation posture for assumptions, minimal changes, surgical scope,
15
+ verification evidence, and escalation.
16
+
17
+ ---
18
+
19
+ ## Credentials — Daemon Access Pattern
20
+
21
+ You do NOT have access to cloud MCP connectors. Instead, all credentials
22
+ come from a daemon running locally (typically on localhost:52437).
23
+
24
+ **Ping first to confirm availability:**
25
+ ```bash
26
+ curl -s http://127.0.0.1:52437/ping
27
+ ```
28
+ If it doesn't respond — report BLOCKED, do not proceed.
29
+
30
+ **Get a credential:**
31
+ ```bash
32
+ curl -s http://127.0.0.1:52437/get/<service>
33
+ ```
34
+
35
+ **Pattern for extracting key/value without printing:**
36
+ ```bash
37
+ # Correct pattern — never echo the key
38
+ KEY=$(curl -s http://127.0.0.1:52437/get/<service> | python3 -c "import sys,json; print(json.load(sys.stdin)['key'])")
39
+ curl -s -H "Authorization: Bearer $KEY" https://api.example.com/...
40
+ ```
41
+
42
+ **Never print credentials to stdout.** Capture to a variable, use inline, discard.
43
+
44
+ ---
45
+
46
+ ## Project Directory Convention
47
+
48
+ This plugin uses the `.rdc/` directory convention. Check for it first:
49
+
50
+ ```bash
51
+ # Check if .rdc/ exists at project root
52
+ ls {PROJECT_ROOT}/.rdc/config.json 2>/dev/null && echo "using .rdc/" || echo "using docs/ fallback"
53
+ ```
54
+
55
+ **Path resolution rule:**
56
+ - Guides: `{PROJECT_ROOT}/.rdc/guides/` → fallback: `{PROJECT_ROOT}/docs/guides/`
57
+ - Plans: `{PROJECT_ROOT}/.rdc/plans/` fallback: `{PROJECT_ROOT}/docs/plans/`
58
+ - Reports: `{PROJECT_ROOT}/.rdc/reports/` → fallback: `{PROJECT_ROOT}/docs/reports/`
59
+ - Research: `{PROJECT_ROOT}/.rdc/research/` → fallback: `{PROJECT_ROOT}/docs/research/`
60
+
61
+ If `.rdc/config.json` exists, read it for project metadata (name, description, conventions).
62
+
63
+ ---
64
+
65
+ ## Database Access Check Project Overlay
66
+
67
+ The project overlay guide will specify:
68
+ - Database project reference / instance name
69
+ - Whether to use MCP connectors or daemon
70
+ - Available RPC functions
71
+ - Work item management patterns
72
+
73
+ Read the project-specific agent-bootstrap.md overlay for exact connection details.
74
+
75
+ ---
76
+
77
+ ## Git Rules
78
+
79
+ - Branch: Always use the project's primary development branch (typically `develop` or `main`)
80
+ - Auto-commit after completing your scope — no confirmation needed
81
+ - Commit message must use conventional format: `feat/fix/chore/refactor(<scope>): description`
82
+ - Push to origin after committing
83
+ - NEVER force-push
84
+
85
+ ---
86
+
83
87
  ## Build Rules
84
88
 
85
89
  Never run `pnpm build` or equivalent full builds locally — they consume excessive memory.
@@ -99,110 +103,110 @@ rule, not a preference.
99
103
  - Node/cmd/ps1 helpers launched by hooks must go through the RDC hidden hook runner.
100
104
 
101
105
  Check the project overlay for specific language, package manager, and build constraints.
102
-
103
- ---
104
-
105
- ## RDC_TEST Sandbox Contract
106
-
107
- When `RDC_TEST=1` is set, the skill is running inside the Tier 2 sandbox harness. Short-circuit all destructive external side effects.
108
-
109
- **How to detect:** `process.env.RDC_TEST === '1'` (Node/JS) or `[ "$RDC_TEST" = "1" ]` (bash). The Tier 2 runner sets this before invoking `claude --print`.
110
-
111
- **Allowed under RDC_TEST** — run normally, no guard:
112
-
113
- | Operation | Why |
114
- |-----------|-----|
115
- | Local git commits | Commit to the worktree branch; never pushed |
116
- | Local filesystem writes | Inside the sandbox worktree |
117
- | Supabase reads | Assertions read prod DB; no writes |
118
- | Service reads | Coolify status, CF DNS lookup, GitHub read — all safe |
119
- | `clauth` credential reads | Read-only against the daemon |
120
-
121
- **Short-circuit under RDC_TEST** — must be wrapped in a guard:
122
-
123
- - Supabase INSERT/UPDATE/DELETE (work items, prototype_registry, design_context, etc.) — runner uses main-db mode, no test branch
124
- - Coolify app deploys / restarts / config writes
125
- - Cloudflare DNS writes / cache purges
126
- - R2 object writes / deletes
127
- - `git push` to any remote
128
- - `gh pr create`, `gh release create`, tag pushes
129
- - `npm publish`
130
- - Any webhook fire, email send, Slack post
131
- - MCP connector tools that mutate external state (e.g. `mcp__coolify__deploy`)
132
-
133
- **Bash pattern:**
134
- ```bash
135
- if [ "$RDC_TEST" != "1" ]; then
136
- curl -X POST "https://deploy.regendevcorp.com/api/v1/applications/$UUID/deploy" ...
137
- else
138
- echo "[RDC_TEST] skipping Coolify deploy"
139
- fi
140
- ```
141
-
142
- **Node/JS pattern:**
143
- ```js
144
- if (process.env.RDC_TEST !== '1') {
145
- await deployToCoolify(...);
146
- } else {
147
- console.log('[RDC_TEST] skipping Coolify deploy');
148
- }
149
- ```
150
-
151
- **Why this matters:** Tier 2 runs every skill in a throwaway sandbox. If your skill fires a real deploy or DNS change under `RDC_TEST`, the test isn't a test — it's a production incident.
152
-
153
- **New-skill contract:** every new `rdc:*` skill MUST honor `RDC_TEST` before shipping. Tier 2 manifests will fail any skill that writes to external state under the flag.
154
-
155
- **Known blocker:** The `check-cwd.js` SessionStart hook hard-blocks Claude sessions launched from `C:/Dev/rdc-skills`. The hook must check `process.env.RDC_TEST === '1'` and call `process.exit(0)` early to allow Tier 2 sandbox runs. Without this bypass, all Tier 2 headless invocations fail with `exit_code: -1`. File: `~/.claude/hooks/check-cwd.js`.
156
-
157
- ---
158
-
159
- ## Completion Report
160
-
161
- When your scope is done, return a structured report to the supervisor:
162
-
163
- ```
164
- AGENT_COMPLETE: {
165
- scope: "<what you were assigned>",
166
- files_changed: ["path/to/file", ...],
167
- work_item_id: "<id if you had one>",
168
- commits: ["<hash> <message>"],
169
- blockers: ["<anything that needs supervisor attention>"]
170
- }
171
- ```
172
-
173
- If you hit a blocker mid-task: stop, report it, do not guess or work around it.
174
-
175
- ---
176
-
177
- ## Self-Check Rules — Prevent Getting Lost
178
-
179
- ### 10-Minute Rule
180
- If you have been working on a **single step** for more than 10 minutes without measurable progress (no new files changed, no successful tool calls, no forward movement), **stop immediately**. Do not keep trying variations. Report it as a blocker.
181
-
182
- ### 2-Retry Rule
183
- If the **same command or approach fails twice**, stop. Do not attempt a third variation or creative workaround. Report the failure with the exact error output.
184
-
185
- ### Scope Drift Rule
186
- If you discover that fixing your assigned task would also require changing files **outside your scope**, stop. Do not fix them. Add them to `blockers` in your AGENT_COMPLETE report. The supervisor assigns them separately.
187
-
188
- ### What "measurable progress" means
189
- - A file was created or modified ✅
190
- - A tool call succeeded and returned useful data ✅
191
- - A command ran without error ✅
192
- - Trying the same thing with slightly different parameters ❌
193
- - Reading the same file again hoping for different insight ❌
194
- - Rephrasing a failing query ❌
195
-
196
- ---
197
-
106
+
107
+ ---
108
+
109
+ ## RDC_TEST Sandbox Contract
110
+
111
+ When `RDC_TEST=1` is set, the skill is running inside the Tier 2 sandbox harness. Short-circuit all destructive external side effects.
112
+
113
+ **How to detect:** `process.env.RDC_TEST === '1'` (Node/JS) or `[ "$RDC_TEST" = "1" ]` (bash). The Tier 2 runner sets this before invoking `claude --print`.
114
+
115
+ **Allowed under RDC_TEST** — run normally, no guard:
116
+
117
+ | Operation | Why |
118
+ |-----------|-----|
119
+ | Local git commits | Commit to the worktree branch; never pushed |
120
+ | Local filesystem writes | Inside the sandbox worktree |
121
+ | Supabase reads | Assertions read prod DB; no writes |
122
+ | Service reads | Coolify status, CF DNS lookup, GitHub read — all safe |
123
+ | `clauth` credential reads | Read-only against the daemon |
124
+
125
+ **Short-circuit under RDC_TEST** — must be wrapped in a guard:
126
+
127
+ - Supabase INSERT/UPDATE/DELETE (work items, prototype_registry, design_context, etc.) — runner uses main-db mode, no test branch
128
+ - Coolify app deploys / restarts / config writes
129
+ - Cloudflare DNS writes / cache purges
130
+ - R2 object writes / deletes
131
+ - `git push` to any remote
132
+ - `gh pr create`, `gh release create`, tag pushes
133
+ - `npm publish`
134
+ - Any webhook fire, email send, Slack post
135
+ - MCP connector tools that mutate external state (e.g. `mcp__coolify__deploy`)
136
+
137
+ **Bash pattern:**
138
+ ```bash
139
+ if [ "$RDC_TEST" != "1" ]; then
140
+ curl -X POST "https://deploy.regendevcorp.com/api/v1/applications/$UUID/deploy" ...
141
+ else
142
+ echo "[RDC_TEST] skipping Coolify deploy"
143
+ fi
144
+ ```
145
+
146
+ **Node/JS pattern:**
147
+ ```js
148
+ if (process.env.RDC_TEST !== '1') {
149
+ await deployToCoolify(...);
150
+ } else {
151
+ console.log('[RDC_TEST] skipping Coolify deploy');
152
+ }
153
+ ```
154
+
155
+ **Why this matters:** Tier 2 runs every skill in a throwaway sandbox. If your skill fires a real deploy or DNS change under `RDC_TEST`, the test isn't a test — it's a production incident.
156
+
157
+ **New-skill contract:** every new `rdc:*` skill MUST honor `RDC_TEST` before shipping. Tier 2 manifests will fail any skill that writes to external state under the flag.
158
+
159
+ **Known blocker:** The `check-cwd.js` SessionStart hook hard-blocks Claude sessions launched from `C:/Dev/rdc-skills`. The hook must check `process.env.RDC_TEST === '1'` and call `process.exit(0)` early to allow Tier 2 sandbox runs. Without this bypass, all Tier 2 headless invocations fail with `exit_code: -1`. File: `~/.claude/hooks/check-cwd.js`.
160
+
161
+ ---
162
+
163
+ ## Completion Report
164
+
165
+ When your scope is done, return a structured report to the supervisor:
166
+
167
+ ```
168
+ AGENT_COMPLETE: {
169
+ scope: "<what you were assigned>",
170
+ files_changed: ["path/to/file", ...],
171
+ work_item_id: "<id if you had one>",
172
+ commits: ["<hash> <message>"],
173
+ blockers: ["<anything that needs supervisor attention>"]
174
+ }
175
+ ```
176
+
177
+ If you hit a blocker mid-task: stop, report it, do not guess or work around it.
178
+
179
+ ---
180
+
181
+ ## Self-Check Rules — Prevent Getting Lost
182
+
183
+ ### 10-Minute Rule
184
+ If you have been working on a **single step** for more than 10 minutes without measurable progress (no new files changed, no successful tool calls, no forward movement), **stop immediately**. Do not keep trying variations. Report it as a blocker.
185
+
186
+ ### 2-Retry Rule
187
+ If the **same command or approach fails twice**, stop. Do not attempt a third variation or creative workaround. Report the failure with the exact error output.
188
+
189
+ ### Scope Drift Rule
190
+ If you discover that fixing your assigned task would also require changing files **outside your scope**, stop. Do not fix them. Add them to `blockers` in your AGENT_COMPLETE report. The supervisor assigns them separately.
191
+
192
+ ### What "measurable progress" means
193
+ - A file was created or modified ✅
194
+ - A tool call succeeded and returned useful data ✅
195
+ - A command ran without error ✅
196
+ - Trying the same thing with slightly different parameters ❌
197
+ - Reading the same file again hoping for different insight ❌
198
+ - Rephrasing a failing query ❌
199
+
200
+ ---
201
+
198
202
  ## ⛔ Implementation Report + CodeFlow Exit Contract
199
203
 
200
204
  Every implementation agent MUST follow this protocol before moving a work item
201
205
  to `review`. Agents do not close non-epic work as `done`; validators close it
202
206
  after fresh verification.
203
-
204
- ### Step 1 — Tick checklist items as you complete them
205
-
207
+
208
+ ### Step 1 — Tick checklist items as you complete them
209
+
206
210
  ```sql
207
211
  SELECT update_checklist_item(
208
212
  '<work-item-id>'::uuid,
@@ -217,10 +221,10 @@ SELECT update_checklist_item(
217
221
  Call this for each item AS you complete it — not all at once at the end. The
218
222
  database records every tick in `work_item_checklist_events`. Supervisor and
219
223
  validator re-ticks are rejected by the exit gate.
220
-
221
- ### Step 2 — Submit implementation report BEFORE marking done
222
-
223
- ```sql
224
+
225
+ ### Step 2 — Submit implementation report BEFORE marking done
226
+
227
+ ```sql
224
228
  SELECT submit_implementation_report(
225
229
  '<work-item-id>'::uuid,
226
230
  '{
@@ -272,20 +276,20 @@ SELECT update_work_item_status(
272
276
  If any `required: true` checklist item is still unchecked, was re-ticked by a
273
277
  supervisor/validator, or was ticked by a different session than the originating
274
278
  agent, the DB and PreToolUse hook reject the close.
275
-
276
- ### Supervisor workflow
277
-
278
- - All zeros → clean run, proceed
279
- - `flags_count > 0` or `deviations_count > 0` → pull full report:
280
- ```sql
281
- SELECT implementation_report FROM work_items WHERE id = '<id>';
282
- ```
283
-
284
- ---
285
-
286
- ## Now read your role-specific guide
287
-
288
- Path: `{PROJECT_ROOT}/.rdc/guides/<type>.md` (e.g., `frontend.md`, `backend.md`, `data.md`)
289
- Fallback: `{PROJECT_ROOT}/docs/guides/<type>.md` if `.rdc/` does not exist.
290
-
291
- The project overlay will specify the exact location if it differs from the convention above.
279
+
280
+ ### Supervisor workflow
281
+
282
+ - All zeros → clean run, proceed
283
+ - `flags_count > 0` or `deviations_count > 0` → pull full report:
284
+ ```sql
285
+ SELECT implementation_report FROM work_items WHERE id = '<id>';
286
+ ```
287
+
288
+ ---
289
+
290
+ ## Now read your role-specific guide
291
+
292
+ Path: `{PROJECT_ROOT}/.rdc/guides/<type>.md` (e.g., `frontend.md`, `backend.md`, `data.md`)
293
+ Fallback: `{PROJECT_ROOT}/docs/guides/<type>.md` if `.rdc/` does not exist.
294
+
295
+ The project overlay will specify the exact location if it differs from the convention above.
@@ -1,104 +1,104 @@
1
- > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
2
- > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
3
- > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
4
-
5
- > 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`).
6
-
7
- > **Sandbox contract:** This guide honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
8
-
9
-
10
- # rdc:backend — Backend Agent
11
-
12
- ## Mandatory First Step
13
-
14
- Read the guide before ANY code:
15
- ```
16
- {PROJECT_ROOT}/.rdc/guides/backend.md
17
- (fallback: {PROJECT_ROOT}/.rdc/guides/backend.md)
18
- ```
19
-
20
- ## Database Client — One Pattern Per Context
21
-
22
- ```ts
23
- // Server component / API route
24
- import { createServerClient } from "@regen/supabase";
25
- const supabase = await createServerClient();
26
-
27
- // Client component
28
- import { createBrowserClient } from "@regen/supabase";
29
- const supabase = createBrowserClient();
30
- ```
31
-
32
- Non-public schemas:
33
- ```ts
34
- const { data } = await supabase.schema("custom").from("table_name").select("*");
35
- ```
36
-
37
- ## Credentials — Daemon First
38
-
39
- ```bash
40
- curl -s http://127.0.0.1:52437/get/<service>
41
- ```
42
- - Never hardcode credentials
43
- - Never print keys to stdout
44
- - If daemon is down: report BLOCKED — do not work around it
45
-
46
- ## Work Items — RPC Only
47
-
48
- ```sql
49
- -- Read epics
50
- SELECT get_open_epics();
51
-
52
- -- Create
53
- SELECT insert_work_item(
54
- p_title := 'Task title',
55
- p_priority := 'high',
56
- p_parent_id := '<epic-uuid>'::uuid,
57
- p_source := 'agent'
58
- );
59
-
1
+ > **⚠️ OUTPUT CONTRACT (READ FIRST):** `guides/output-contract.md`
2
+ > Checklist-only output. No tool-call narration. No raw MCP/JSON/log dumps.
3
+ > One checklist upfront, updated in place, shown again at end with a 1-line verdict.
4
+
5
+ > 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`).
6
+
7
+ > **Sandbox contract:** This guide honors `RDC_TEST=1` per `guides/agent-bootstrap.md` § RDC_TEST Sandbox Contract. Destructive external calls short-circuit under the flag.
8
+
9
+
10
+ # rdc:backend — Backend Agent
11
+
12
+ ## Mandatory First Step
13
+
14
+ Read the guide before ANY code:
15
+ ```
16
+ {PROJECT_ROOT}/.rdc/guides/backend.md
17
+ (fallback: {PROJECT_ROOT}/.rdc/guides/backend.md)
18
+ ```
19
+
20
+ ## Database Client — One Pattern Per Context
21
+
22
+ ```ts
23
+ // Server component / API route
24
+ import { createServerClient } from "@regen/supabase";
25
+ const supabase = await createServerClient();
26
+
27
+ // Client component
28
+ import { createBrowserClient } from "@regen/supabase";
29
+ const supabase = createBrowserClient();
30
+ ```
31
+
32
+ Non-public schemas:
33
+ ```ts
34
+ const { data } = await supabase.schema("custom").from("table_name").select("*");
35
+ ```
36
+
37
+ ## Credentials — Daemon First
38
+
39
+ ```bash
40
+ curl -s http://127.0.0.1:52437/get/<service>
41
+ ```
42
+ - Never hardcode credentials
43
+ - Never print keys to stdout
44
+ - If daemon is down: report BLOCKED — do not work around it
45
+
46
+ ## Work Items — RPC Only
47
+
48
+ ```sql
49
+ -- Read epics
50
+ SELECT get_open_epics();
51
+
52
+ -- Create
53
+ SELECT insert_work_item(
54
+ p_title := 'Task title',
55
+ p_priority := 'high',
56
+ p_parent_id := '<epic-uuid>'::uuid,
57
+ p_source := 'agent'
58
+ );
59
+
60
60
  -- Implementation agents submit report + CodeFlow post, then move to review
61
61
  SELECT update_work_item_status('<uuid>'::uuid, 'review', '["Implementation complete; ready for validator"]'::jsonb, '<agent-session-id>', 'agent');
62
- ```
63
-
64
- **NEVER write raw INSERT/UPDATE against work items.**
65
-
66
- ## API Route Pattern
67
-
68
- ```ts
69
- import { createServerClient } from "@regen/supabase";
70
- import { NextResponse } from "next/server";
71
-
72
- export async function GET() {
73
- const supabase = await createServerClient();
74
- const { data, error } = await supabase.from("table").select("*");
75
- if (error) return NextResponse.json({ error: error.message }, { status: 500 });
76
- return NextResponse.json(data);
77
- }
78
-
79
- export async function POST(request: Request) {
80
- const body = await request.json();
81
- const supabase = await createServerClient();
82
- const { data, error } = await supabase.from("table").insert(body).select().single();
83
- if (error) return NextResponse.json({ error: error.message }, { status: 400 });
84
- return NextResponse.json(data, { status: 201 });
85
- }
86
- ```
87
-
88
- ## Auth
89
-
90
- Use the auth helpers from your project's auth package for protected apps.
91
-
92
- ## Schema-Driven Forms
93
-
94
- When working with schema-driven forms (common in dynamic CRUD), never hardcode columns.
95
- Use the schema table to drive form rendering instead.
96
-
97
- ## Safety Rules
98
-
99
- - Branch: development branch — auto-commit after logical blocks
100
- - NEVER run `pnpm build`
101
- - NEVER overlap with other agents on the same files
102
- - Update work items in real time — not batch at end
103
- - Push after each logical block *(skip if `$RDC_TEST=1` — echo `[RDC_TEST] skipping git push` instead)*
104
- - Write tests FIRST — red → implement → green
62
+ ```
63
+
64
+ **NEVER write raw INSERT/UPDATE against work items.**
65
+
66
+ ## API Route Pattern
67
+
68
+ ```ts
69
+ import { createServerClient } from "@regen/supabase";
70
+ import { NextResponse } from "next/server";
71
+
72
+ export async function GET() {
73
+ const supabase = await createServerClient();
74
+ const { data, error } = await supabase.from("table").select("*");
75
+ if (error) return NextResponse.json({ error: error.message }, { status: 500 });
76
+ return NextResponse.json(data);
77
+ }
78
+
79
+ export async function POST(request: Request) {
80
+ const body = await request.json();
81
+ const supabase = await createServerClient();
82
+ const { data, error } = await supabase.from("table").insert(body).select().single();
83
+ if (error) return NextResponse.json({ error: error.message }, { status: 400 });
84
+ return NextResponse.json(data, { status: 201 });
85
+ }
86
+ ```
87
+
88
+ ## Auth
89
+
90
+ Use the auth helpers from your project's auth package for protected apps.
91
+
92
+ ## Schema-Driven Forms
93
+
94
+ When working with schema-driven forms (common in dynamic CRUD), never hardcode columns.
95
+ Use the schema table to drive form rendering instead.
96
+
97
+ ## Safety Rules
98
+
99
+ - Branch: development branch — auto-commit after logical blocks
100
+ - NEVER run `pnpm build`
101
+ - NEVER overlap with other agents on the same files
102
+ - Update work items in real time — not batch at end
103
+ - Push after each logical block *(skip if `$RDC_TEST=1` — echo `[RDC_TEST] skipping git push` instead)*
104
+ - Write tests FIRST — red → implement → green