@zigrivers/scaffold 2.1.2 → 2.28.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.
- package/README.md +272 -59
- package/knowledge/core/adr-craft.md +53 -0
- package/knowledge/core/ai-memory-management.md +246 -0
- package/knowledge/core/api-design.md +4 -0
- package/knowledge/core/claude-md-patterns.md +254 -0
- package/knowledge/core/coding-conventions.md +246 -0
- package/knowledge/core/database-design.md +4 -0
- package/knowledge/core/design-system-tokens.md +465 -0
- package/knowledge/core/dev-environment.md +223 -0
- package/knowledge/core/domain-modeling.md +4 -0
- package/knowledge/core/eval-craft.md +1008 -0
- package/knowledge/core/multi-model-review-dispatch.md +250 -0
- package/knowledge/core/operations-runbook.md +37 -226
- package/knowledge/core/project-structure-patterns.md +231 -0
- package/knowledge/core/review-step-template.md +247 -0
- package/knowledge/core/{security-review.md → security-best-practices.md} +5 -1
- package/knowledge/core/task-decomposition.md +57 -34
- package/knowledge/core/task-tracking.md +225 -0
- package/knowledge/core/tech-stack-selection.md +214 -0
- package/knowledge/core/testing-strategy.md +63 -70
- package/knowledge/core/user-stories.md +69 -60
- package/knowledge/core/user-story-innovation.md +57 -0
- package/knowledge/core/ux-specification.md +5 -148
- package/knowledge/finalization/apply-fixes-and-freeze.md +165 -14
- package/knowledge/product/prd-craft.md +55 -34
- package/knowledge/review/review-adr.md +32 -0
- package/knowledge/review/{review-api-contracts.md → review-api-design.md} +34 -1
- package/knowledge/review/{review-database-schema.md → review-database-design.md} +27 -1
- package/knowledge/review/review-domain-modeling.md +33 -0
- package/knowledge/review/review-implementation-tasks.md +50 -0
- package/knowledge/review/review-operations.md +55 -0
- package/knowledge/review/review-prd.md +33 -0
- package/knowledge/review/review-security.md +53 -0
- package/knowledge/review/review-system-architecture.md +28 -0
- package/knowledge/review/review-testing-strategy.md +51 -0
- package/knowledge/review/review-user-stories.md +54 -0
- package/knowledge/review/{review-ux-spec.md → review-ux-specification.md} +37 -1
- package/methodology/custom-defaults.yml +32 -3
- package/methodology/deep.yml +32 -3
- package/methodology/mvp.yml +32 -3
- package/package.json +2 -1
- package/pipeline/architecture/review-architecture.md +18 -6
- package/pipeline/architecture/system-architecture.md +14 -2
- package/pipeline/consolidation/claude-md-optimization.md +73 -0
- package/pipeline/consolidation/workflow-audit.md +73 -0
- package/pipeline/decisions/adrs.md +14 -2
- package/pipeline/decisions/review-adrs.md +18 -5
- package/pipeline/environment/ai-memory-setup.md +70 -0
- package/pipeline/environment/automated-pr-review.md +70 -0
- package/pipeline/environment/design-system.md +73 -0
- package/pipeline/environment/dev-env-setup.md +65 -0
- package/pipeline/environment/git-workflow.md +71 -0
- package/pipeline/finalization/apply-fixes-and-freeze.md +1 -1
- package/pipeline/finalization/developer-onboarding-guide.md +1 -1
- package/pipeline/finalization/implementation-playbook.md +3 -3
- package/pipeline/foundation/beads.md +68 -0
- package/pipeline/foundation/coding-standards.md +68 -0
- package/pipeline/foundation/project-structure.md +69 -0
- package/pipeline/foundation/tdd.md +60 -0
- package/pipeline/foundation/tech-stack.md +74 -0
- package/pipeline/integration/add-e2e-testing.md +65 -0
- package/pipeline/modeling/domain-modeling.md +14 -2
- package/pipeline/modeling/review-domain-modeling.md +18 -5
- package/pipeline/parity/platform-parity-review.md +70 -0
- package/pipeline/planning/implementation-plan-review.md +56 -0
- package/pipeline/planning/{implementation-tasks.md → implementation-plan.md} +29 -9
- package/pipeline/pre/create-prd.md +13 -4
- package/pipeline/pre/innovate-prd.md +37 -8
- package/pipeline/pre/innovate-user-stories.md +38 -7
- package/pipeline/pre/review-prd.md +18 -6
- package/pipeline/pre/review-user-stories.md +23 -6
- package/pipeline/pre/user-stories.md +12 -2
- package/pipeline/quality/create-evals.md +102 -0
- package/pipeline/quality/operations.md +38 -13
- package/pipeline/quality/review-operations.md +17 -5
- package/pipeline/quality/review-security.md +17 -5
- package/pipeline/quality/review-testing.md +20 -8
- package/pipeline/quality/security.md +25 -3
- package/pipeline/quality/story-tests.md +73 -0
- package/pipeline/specification/api-contracts.md +17 -2
- package/pipeline/specification/database-schema.md +17 -2
- package/pipeline/specification/review-api.md +18 -6
- package/pipeline/specification/review-database.md +18 -6
- package/pipeline/specification/review-ux.md +19 -7
- package/pipeline/specification/ux-spec.md +29 -10
- package/pipeline/validation/critical-path-walkthrough.md +34 -7
- package/pipeline/validation/cross-phase-consistency.md +34 -7
- package/pipeline/validation/decision-completeness.md +34 -7
- package/pipeline/validation/dependency-graph-validation.md +34 -7
- package/pipeline/validation/implementability-dry-run.md +34 -7
- package/pipeline/validation/scope-creep-check.md +34 -7
- package/pipeline/validation/traceability-matrix.md +34 -7
- package/skills/multi-model-dispatch/SKILL.md +326 -0
- package/skills/scaffold-pipeline/SKILL.md +195 -0
- package/skills/scaffold-runner/SKILL.md +465 -0
- package/pipeline/planning/review-tasks.md +0 -38
- package/pipeline/quality/testing-strategy.md +0 -42
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: multi-model-dispatch
|
|
3
|
+
description: Correct patterns for invoking Codex CLI and Gemini CLI as independent reviewers from Claude Code. Covers headless invocation, context bundling, output parsing, dual-model reconciliation, and fallback handling.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Multi-Model Dispatch
|
|
7
|
+
|
|
8
|
+
This skill teaches Claude Code how to correctly invoke Codex and Gemini CLIs for independent review of artifacts. Use this whenever a pipeline step needs multi-model validation at depth 4-5.
|
|
9
|
+
|
|
10
|
+
## When This Skill Activates
|
|
11
|
+
|
|
12
|
+
- A review or validation step is running at depth 4+ and wants independent model validation
|
|
13
|
+
- User asks to "run multi-model review" or "get a second opinion from Codex/Gemini"
|
|
14
|
+
- The `automated-pr-review` step is using local CLI review mode
|
|
15
|
+
- The `implementation-plan-review` step dispatches to external CLIs at depth 4+
|
|
16
|
+
|
|
17
|
+
## CLI Detection & Auth Verification
|
|
18
|
+
|
|
19
|
+
Before attempting any dispatch, detect what's available AND verify authentication. A CLI that's installed but not authenticated is useless in headless mode — it will hang on an interactive auth prompt or fail silently.
|
|
20
|
+
|
|
21
|
+
### Step 1: Check CLI Installation
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
command -v codex && echo "codex installed" || echo "codex not found"
|
|
25
|
+
command -v gemini && echo "gemini installed" || echo "gemini not found"
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Step 2: Verify Authentication
|
|
29
|
+
|
|
30
|
+
**CRITICAL: Do not skip this step.** Auth tokens expire mid-session. A CLI that worked 30 minutes ago may fail now.
|
|
31
|
+
|
|
32
|
+
**CRITICAL: Previous auth failures do NOT exempt subsequent dispatches.** Auth tokens refresh — a CLI that failed auth during user story review may work fine for domain modeling review. Always re-check auth before EACH review step, not once per session.
|
|
33
|
+
|
|
34
|
+
**Codex auth check** (has a built-in status command):
|
|
35
|
+
```bash
|
|
36
|
+
codex login status 2>/dev/null && echo "codex authenticated" || echo "codex NOT authenticated"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Gemini auth check** (no built-in status command — use a minimal prompt):
|
|
40
|
+
```bash
|
|
41
|
+
GEMINI_AUTH_CHECK=$(NO_BROWSER=true gemini -p "respond with ok" -o json 2>&1)
|
|
42
|
+
GEMINI_EXIT=$?
|
|
43
|
+
if [ "$GEMINI_EXIT" -eq 0 ]; then
|
|
44
|
+
echo "gemini authenticated"
|
|
45
|
+
elif [ "$GEMINI_EXIT" -eq 41 ]; then
|
|
46
|
+
echo "gemini NOT authenticated (exit 41: auth error)"
|
|
47
|
+
else
|
|
48
|
+
echo "gemini auth unknown (exit $GEMINI_EXIT)"
|
|
49
|
+
fi
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Why `NO_BROWSER=true`?** Gemini CLI relaunches itself as a child process for memory management. During the relaunch, it shows a "Do you want to continue? [Y/n]" consent prompt that hangs when stdin is not a TTY (as in Claude Code's Bash tool). `NO_BROWSER=true` suppresses this prompt and uses cached credentials directly.
|
|
53
|
+
|
|
54
|
+
### Step 3: Handle Auth Failures
|
|
55
|
+
|
|
56
|
+
**If a CLI fails auth, do NOT silently fall back.** Instead:
|
|
57
|
+
|
|
58
|
+
1. **Tell the user** which CLI failed auth and why
|
|
59
|
+
2. **Offer interactive recovery**: Ask the user to run the auth command in their terminal:
|
|
60
|
+
- **Codex**: `! codex login` (opens browser for OAuth) or set `CODEX_API_KEY` env var
|
|
61
|
+
- **Gemini**: `! gemini -p "hello"` (triggers OAuth flow) or set `GEMINI_API_KEY` env var
|
|
62
|
+
3. **After recovery**: Re-run the auth check. If it passes, proceed with dispatch.
|
|
63
|
+
4. **If user declines**: Fall back to the other CLI or Claude-only review, but **document the auth failure** in the review summary.
|
|
64
|
+
|
|
65
|
+
The `!` prefix runs the command in the user's terminal session, allowing interactive auth flows (browser OAuth, Y/n prompts) that can't work in headless mode.
|
|
66
|
+
|
|
67
|
+
**If neither CLI is available or authenticated**: Fall back to structured Claude-only self-review. Re-read the artifact with an adversarial lens — actively try to find issues the initial review missed. Document this as "single-model review (no external CLIs available)."
|
|
68
|
+
|
|
69
|
+
## Correct Invocation Patterns
|
|
70
|
+
|
|
71
|
+
### Codex CLI (`codex exec`)
|
|
72
|
+
|
|
73
|
+
**CRITICAL: Use `codex exec`, NOT `codex` directly.** The bare `codex` command launches an interactive TUI that requires a TTY and will fail with "stdin is not a terminal" when run from Claude Code.
|
|
74
|
+
|
|
75
|
+
**CRITICAL: Always include `--skip-git-repo-check`.** Without this flag, Codex fails with "Not inside a trusted directory" when the project hasn't initialized git yet (common early in the pipeline).
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Basic review dispatch
|
|
79
|
+
codex exec --skip-git-repo-check -s read-only --ephemeral "REVIEW_PROMPT_HERE" 2>/dev/null
|
|
80
|
+
|
|
81
|
+
# With specific model and reasoning effort
|
|
82
|
+
codex exec --skip-git-repo-check -m o4-mini -s read-only -c model_reasoning_effort=high --ephemeral "REVIEW_PROMPT_HERE" 2>/dev/null
|
|
83
|
+
|
|
84
|
+
# Reading prompt from stdin (use - flag)
|
|
85
|
+
echo "$REVIEW_PROMPT" | codex exec --skip-git-repo-check -s read-only --ephemeral - 2>/dev/null
|
|
86
|
+
|
|
87
|
+
# With JSON schema enforcement
|
|
88
|
+
codex exec --skip-git-repo-check -s read-only --ephemeral --output-schema schema.json "REVIEW_PROMPT_HERE" 2>/dev/null
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
**Key flags:**
|
|
92
|
+
| Flag | Purpose |
|
|
93
|
+
|------|---------|
|
|
94
|
+
| `exec` | **Required** — headless mode, no TUI, no TTY needed |
|
|
95
|
+
| `--skip-git-repo-check` | **Required** — allows running outside a git repo or untrusted directory |
|
|
96
|
+
| `-s read-only` | Sandbox: reviewer cannot write files (read-only analysis) |
|
|
97
|
+
| `--ephemeral` | Don't persist session (one-shot review) |
|
|
98
|
+
| `2>/dev/null` | Suppress thinking tokens on stderr (keeps Claude Code context clean) |
|
|
99
|
+
| `--output-schema` | Enforce structured JSON output against a schema file |
|
|
100
|
+
| `-c model_reasoning_effort=high` | Increase reasoning depth for complex reviews |
|
|
101
|
+
|
|
102
|
+
**Output**: Progress streams to stderr (suppressed by `2>/dev/null`). Final answer prints to stdout.
|
|
103
|
+
|
|
104
|
+
### Gemini CLI (`gemini -p`)
|
|
105
|
+
|
|
106
|
+
**Use `-p` / `--prompt` for headless mode.** Without this flag, Gemini launches interactive mode.
|
|
107
|
+
|
|
108
|
+
**CRITICAL: Always prepend `NO_BROWSER=true`.** Without this, Gemini's child process relaunch shows a consent prompt ("Do you want to continue? [Y/n]") that hangs when stdin is not a TTY. This affects ALL non-interactive contexts including Claude Code's Bash tool.
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# Basic review dispatch
|
|
112
|
+
NO_BROWSER=true gemini -p "REVIEW_PROMPT_HERE" --output-format json --approval-mode yolo 2>/dev/null
|
|
113
|
+
|
|
114
|
+
# With specific model
|
|
115
|
+
NO_BROWSER=true gemini -p "REVIEW_PROMPT_HERE" -m pro --output-format json --approval-mode yolo 2>/dev/null
|
|
116
|
+
|
|
117
|
+
# Reading context from stdin
|
|
118
|
+
cat artifact.md | NO_BROWSER=true gemini -p "Review this artifact for issues" --output-format json --approval-mode yolo 2>/dev/null
|
|
119
|
+
|
|
120
|
+
# With sandbox (no file writes)
|
|
121
|
+
NO_BROWSER=true gemini -p "REVIEW_PROMPT_HERE" --output-format json -s --approval-mode yolo 2>/dev/null
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Key flags:**
|
|
125
|
+
| Flag | Purpose |
|
|
126
|
+
|------|---------|
|
|
127
|
+
| `NO_BROWSER=true` | **Required** — suppresses consent prompt that hangs in non-TTY shells |
|
|
128
|
+
| `-p "prompt"` | **Required** — headless mode, no interactive UI |
|
|
129
|
+
| `--output-format json` | Structured JSON output for parsing |
|
|
130
|
+
| `--approval-mode yolo` | Auto-approve all tool calls (reviewer doesn't need to write) |
|
|
131
|
+
| `-s` | Sandbox mode (extra safety for read-only review) |
|
|
132
|
+
| `-m pro` | Use Gemini Pro model (default is auto) |
|
|
133
|
+
| `2>/dev/null` | Suppress progress output |
|
|
134
|
+
|
|
135
|
+
**Output**: JSON on stdout with `{ response, stats, error }` structure.
|
|
136
|
+
|
|
137
|
+
## Context Bundling
|
|
138
|
+
|
|
139
|
+
When dispatching a review, bundle all relevant context into the prompt. Each CLI gets the same bundle — do NOT share one model's review with the other.
|
|
140
|
+
|
|
141
|
+
### Template for Artifact Review
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
You are reviewing a project artifact for quality issues. Focus on P0 (critical) and P1 (high) issues only.
|
|
145
|
+
|
|
146
|
+
## Severity Definitions
|
|
147
|
+
- P0: Will cause implementation failure, data loss, security vulnerability, or fundamental architectural flaw
|
|
148
|
+
- P1: Will cause bugs in normal usage, inconsistency across documents, or blocks downstream work
|
|
149
|
+
- Do NOT report P2/P3 issues (suggestions, style, minor improvements)
|
|
150
|
+
|
|
151
|
+
## Review Standards
|
|
152
|
+
[paste contents of docs/review-standards.md if it exists, otherwise use severity definitions above]
|
|
153
|
+
|
|
154
|
+
## Artifact to Review
|
|
155
|
+
[paste full artifact content]
|
|
156
|
+
|
|
157
|
+
## Upstream References
|
|
158
|
+
[paste relevant upstream docs: PRD, tech-stack, coding-standards, etc.]
|
|
159
|
+
|
|
160
|
+
## Output Format
|
|
161
|
+
Respond with a JSON object:
|
|
162
|
+
{
|
|
163
|
+
"approved": true/false,
|
|
164
|
+
"findings": [
|
|
165
|
+
{
|
|
166
|
+
"severity": "P0" or "P1",
|
|
167
|
+
"location": "section or line reference",
|
|
168
|
+
"description": "what's wrong",
|
|
169
|
+
"suggestion": "specific fix"
|
|
170
|
+
}
|
|
171
|
+
],
|
|
172
|
+
"summary": "one-line assessment"
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
If no P0/P1 issues found, respond with: { "approved": true, "findings": [], "summary": "No P0/P1 issues found." }
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Template for PR Diff Review
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
You are reviewing a pull request diff. Focus on P0 and P1 issues only.
|
|
182
|
+
|
|
183
|
+
## Review Standards
|
|
184
|
+
[paste docs/review-standards.md]
|
|
185
|
+
|
|
186
|
+
## Project Coding Standards
|
|
187
|
+
[paste docs/coding-standards.md]
|
|
188
|
+
|
|
189
|
+
## Test Standards
|
|
190
|
+
[paste docs/tdd-standards.md]
|
|
191
|
+
|
|
192
|
+
## PR Diff
|
|
193
|
+
[paste output of gh pr diff <number> or git diff origin/main...HEAD]
|
|
194
|
+
|
|
195
|
+
## Output Format
|
|
196
|
+
[same JSON format as above, but location = file:line]
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Context Size Guidelines
|
|
200
|
+
|
|
201
|
+
| Artifact Type | Max Context | Strategy |
|
|
202
|
+
|--------------|------------|----------|
|
|
203
|
+
| PRD | Full document | Include entirely |
|
|
204
|
+
| User stories | Full document | Include entirely |
|
|
205
|
+
| Architecture | Full document | Include entirely |
|
|
206
|
+
| Domain models | Directory listing + key files | Summarize index, include 2-3 representative files |
|
|
207
|
+
| PR diff | Full diff | If >2000 lines, split into file groups |
|
|
208
|
+
| Implementation plan | Task list + representative tasks | Include full task list, detail for flagged tasks |
|
|
209
|
+
|
|
210
|
+
## Dual-Model Reconciliation
|
|
211
|
+
|
|
212
|
+
When both CLIs produce results, reconcile findings using these rules:
|
|
213
|
+
|
|
214
|
+
| Scenario | Confidence | Action |
|
|
215
|
+
|----------|-----------|--------|
|
|
216
|
+
| Both flag same issue | **High** | Fix immediately — two independent models agree |
|
|
217
|
+
| Both approve (no findings) | **High** | Proceed confidently |
|
|
218
|
+
| One flags P0, other approves | **High** | Fix it — P0 is critical enough from a single source |
|
|
219
|
+
| One flags P1, other approves | **Medium** | Review the finding carefully before fixing. If the finding is specific and actionable, fix it. If vague, skip. |
|
|
220
|
+
| Models contradict each other | **Low** | Present both findings to the user for adjudication |
|
|
221
|
+
|
|
222
|
+
**Independence rule**: Never share one model's review output with the other. Each model must review the artifact independently to avoid confirmation bias.
|
|
223
|
+
|
|
224
|
+
**Round tracking**: For iterative reviews (like PR review loops), track the round number. After 3 fix rounds, merge with a warning and create a follow-up issue for remaining findings.
|
|
225
|
+
|
|
226
|
+
## Fallback Behavior
|
|
227
|
+
|
|
228
|
+
| Situation | Fallback |
|
|
229
|
+
|-----------|----------|
|
|
230
|
+
| Neither CLI available | Structured Claude-only adversarial self-review |
|
|
231
|
+
| Codex only | Single-model review with Codex |
|
|
232
|
+
| Gemini only | Single-model review with Gemini |
|
|
233
|
+
| **CLI auth expired** | **Surface to user with recovery command — do NOT silently fall back** |
|
|
234
|
+
| One CLI fails mid-review (non-auth) | Continue with the other; note the failure in summary |
|
|
235
|
+
| Both CLIs fail (non-auth) | Fall back to Claude-only self-review; warn user |
|
|
236
|
+
| CLI output not parseable as JSON | Treat as text, extract findings manually |
|
|
237
|
+
|
|
238
|
+
**Auth failures are NOT silent fallbacks.** The difference between "CLI not installed" (fall back quietly) and "CLI auth expired" (user action required) is critical. Auth can be fixed in 30 seconds with an interactive command — silently skipping wastes the user's review infrastructure.
|
|
239
|
+
|
|
240
|
+
## Integration with Review Steps
|
|
241
|
+
|
|
242
|
+
All review steps can reference this skill at depth 4-5. The pattern is:
|
|
243
|
+
|
|
244
|
+
1. **Depth 1-3**: Claude-only multi-pass review (step's existing logic)
|
|
245
|
+
2. **Depth 4**: Claude review + single external CLI review (if available)
|
|
246
|
+
3. **Depth 5**: Claude review + dual-model CLI review with reconciliation
|
|
247
|
+
|
|
248
|
+
Each review step adds a "Multi-Model Validation" section at the end that:
|
|
249
|
+
1. Detects available CLIs
|
|
250
|
+
2. Bundles the artifact + upstream references into a review prompt
|
|
251
|
+
3. Dispatches to available CLIs using the patterns above
|
|
252
|
+
4. Reconciles findings using the dual-model rules
|
|
253
|
+
5. Applies fixes for high-confidence findings
|
|
254
|
+
6. Presents medium/low-confidence findings to the user
|
|
255
|
+
|
|
256
|
+
## Error Handling
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Capture exit code AND stderr separately (don't suppress stderr for error detection)
|
|
260
|
+
CODEX_STDERR=$(mktemp)
|
|
261
|
+
OUTPUT=$(codex exec --skip-git-repo-check -s read-only --ephemeral "prompt" 2>"$CODEX_STDERR") || {
|
|
262
|
+
EXIT_CODE=$?
|
|
263
|
+
STDERR_CONTENT=$(cat "$CODEX_STDERR")
|
|
264
|
+
if echo "$STDERR_CONTENT" | grep -qi "refresh token\|please re-run.*login\|sign in again\|auth"; then
|
|
265
|
+
echo "Codex auth expired. Ask user to run: ! codex login"
|
|
266
|
+
# DO NOT silently fall back — surface to user
|
|
267
|
+
else
|
|
268
|
+
echo "Codex CLI failed with exit code $EXIT_CODE"
|
|
269
|
+
# Fall back to Gemini or Claude-only
|
|
270
|
+
fi
|
|
271
|
+
rm -f "$CODEX_STDERR"
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
GEMINI_STDERR=$(mktemp)
|
|
275
|
+
OUTPUT=$(NO_BROWSER=true gemini -p "prompt" --output-format json --approval-mode yolo 2>"$GEMINI_STDERR") || {
|
|
276
|
+
EXIT_CODE=$?
|
|
277
|
+
if [ "$EXIT_CODE" -eq 41 ]; then
|
|
278
|
+
echo "Gemini auth failed (exit 41). Ask user to run: ! gemini -p \"hello\""
|
|
279
|
+
# DO NOT silently fall back — surface to user
|
|
280
|
+
else
|
|
281
|
+
echo "Gemini CLI failed with exit code $EXIT_CODE"
|
|
282
|
+
# Fall back to Codex or Claude-only
|
|
283
|
+
fi
|
|
284
|
+
rm -f "$GEMINI_STDERR"
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
### Exit Codes
|
|
289
|
+
|
|
290
|
+
**Gemini exit codes:**
|
|
291
|
+
|
|
292
|
+
| Code | Meaning | Action |
|
|
293
|
+
|------|---------|--------|
|
|
294
|
+
| 0 | Success | Parse output |
|
|
295
|
+
| 1 | General error | Fall back to other CLI |
|
|
296
|
+
| **41** | **Auth failure** | **Surface to user — offer `! gemini -p "hello"` recovery** |
|
|
297
|
+
| 42 | Input error | Check prompt format |
|
|
298
|
+
| 52 | Config error | Check `~/.gemini/settings.json` |
|
|
299
|
+
| 53 | Turn limit exceeded | Retry with shorter prompt |
|
|
300
|
+
|
|
301
|
+
**Codex exit codes:**
|
|
302
|
+
|
|
303
|
+
| Code | Meaning | Action |
|
|
304
|
+
|------|---------|--------|
|
|
305
|
+
| 0 | Success | Parse output |
|
|
306
|
+
| 1 | General failure | Check stderr for auth messages |
|
|
307
|
+
|
|
308
|
+
Codex uses exit code 1 for all failures. **Check stderr** for auth-specific messages: "refresh token", "please re-run", "sign in again", "ChatGPT account ID not available".
|
|
309
|
+
|
|
310
|
+
### Auth Recovery Flow
|
|
311
|
+
|
|
312
|
+
When an auth failure is detected during dispatch (not during pre-flight):
|
|
313
|
+
|
|
314
|
+
1. Stop the review dispatch immediately
|
|
315
|
+
2. Tell the user: "Gemini/Codex auth has expired. To re-authenticate, run:"
|
|
316
|
+
3. Suggest: `! codex login` or `! gemini -p "hello"` (the `!` prefix runs it interactively)
|
|
317
|
+
4. After the user re-authenticates, re-run the auth check
|
|
318
|
+
5. If auth succeeds, resume the review dispatch from where it stopped
|
|
319
|
+
6. If the user declines, fall back to the other CLI or Claude-only review
|
|
320
|
+
|
|
321
|
+
## What This Skill Does NOT Do
|
|
322
|
+
|
|
323
|
+
- Does not install CLIs (user must install `codex` and `gemini` separately)
|
|
324
|
+
- Does not authenticate CLIs — but it **detects auth failures** and guides the user through interactive recovery via `!` prefix commands
|
|
325
|
+
- Does not replace Claude's own review passes — it adds independent validation on top
|
|
326
|
+
- Does not work as an MCP server — it uses Bash tool invocations directly
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scaffold-pipeline
|
|
3
|
+
description: Static reference for scaffold pipeline ordering, dependencies, and phase structure. Use ONLY for questions about pipeline design, step ordering, or dependency constraints — NOT for status, progress, or "what's next" queries (those go through scaffold-runner).
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Scaffold Pipeline Reference
|
|
7
|
+
|
|
8
|
+
This skill is a **static reference** for pipeline ordering and dependency constraints. It does NOT handle status checks, progress queries, or navigation.
|
|
9
|
+
|
|
10
|
+
**Activation boundary:** If the user asks "where am I?", "what's next?", "pipeline status", or anything about their current progress → **do not use this skill**. The `scaffold-runner` skill handles all status/navigation via the `scaffold` CLI.
|
|
11
|
+
|
|
12
|
+
Use this skill ONLY when the user asks about:
|
|
13
|
+
- Pipeline design: "what phases are there?", "what's the ordering?"
|
|
14
|
+
- Dependency rules: "what depends on what?", "can I run X before Y?"
|
|
15
|
+
- Step reference: "what commands are in phase 3?", "is design-system optional?"
|
|
16
|
+
|
|
17
|
+
## Phases
|
|
18
|
+
|
|
19
|
+
14 phases, each with a slug (used in frontmatter) and display name. Canonical source: `src/types/frontmatter.ts` `PHASES` constant.
|
|
20
|
+
|
|
21
|
+
| # | Slug | Display Name |
|
|
22
|
+
|---|------|-------------|
|
|
23
|
+
| 1 | `pre` | Product Definition |
|
|
24
|
+
| 2 | `foundation` | Project Foundation |
|
|
25
|
+
| 3 | `environment` | Development Environment |
|
|
26
|
+
| 4 | `integration` | Testing Integration |
|
|
27
|
+
| 5 | `modeling` | Domain Modeling |
|
|
28
|
+
| 6 | `decisions` | Architecture Decisions |
|
|
29
|
+
| 7 | `architecture` | System Architecture |
|
|
30
|
+
| 8 | `specification` | Specifications |
|
|
31
|
+
| 9 | `quality` | Quality Gates |
|
|
32
|
+
| 10 | `parity` | Platform Parity |
|
|
33
|
+
| 11 | `consolidation` | Consolidation |
|
|
34
|
+
| 12 | `planning` | Planning |
|
|
35
|
+
| 13 | `validation` | Validation |
|
|
36
|
+
| 14 | `finalization` | Finalization |
|
|
37
|
+
|
|
38
|
+
## Pipeline Order
|
|
39
|
+
|
|
40
|
+
| # | Phase | Command | Notes |
|
|
41
|
+
|---|-------|---------|-------|
|
|
42
|
+
| 1 | Product Definition | `/scaffold:create-prd` | Interactive — requires user input |
|
|
43
|
+
| 2 | Product Definition | `/scaffold:review-prd` | Multi-pass PRD review |
|
|
44
|
+
| 2.5 | Product Definition | `/scaffold:innovate-prd` | **(optional)** Feature-level innovation |
|
|
45
|
+
| 3 | Product Definition | `/scaffold:user-stories` | Covers every PRD feature |
|
|
46
|
+
| 4 | Product Definition | `/scaffold:review-user-stories` | Multi-pass story review; depth 4+ adds requirements index |
|
|
47
|
+
| 4.5 | Product Definition | `/scaffold:innovate-user-stories` | **(optional)** UX-level enhancements |
|
|
48
|
+
| 5 | Project Foundation | `/scaffold:beads` | **(optional)** Creates CLAUDE.md + task tracking |
|
|
49
|
+
| 6 | Project Foundation | `/scaffold:tech-stack` | Drives all technical decisions |
|
|
50
|
+
| 7 | Project Foundation | `/scaffold:coding-standards` | References tech-stack.md |
|
|
51
|
+
| 8 | Project Foundation | `/scaffold:tdd` | References tech-stack.md + coding-standards.md |
|
|
52
|
+
| 9 | Project Foundation | `/scaffold:project-structure` | References all Phase 2 docs |
|
|
53
|
+
| 10 | Dev Environment | `/scaffold:dev-env-setup` | Creates lint/test/install commands |
|
|
54
|
+
| 11 | Dev Environment | `/scaffold:design-system` | **(optional)** Frontend projects only |
|
|
55
|
+
| 12 | Dev Environment | `/scaffold:git-workflow` | Branching, CI, worktrees, permissions |
|
|
56
|
+
| 12.5 | Dev Environment | `/scaffold:automated-pr-review` | **(optional)** Local CLI or external reviewer |
|
|
57
|
+
| 13 | Dev Environment | `/scaffold:ai-memory-setup` | Modular rules, optional MCP memory + external docs |
|
|
58
|
+
| 14 | Testing Integration | `/scaffold:add-e2e-testing` | **(optional)** Playwright (web) and/or Maestro (mobile) |
|
|
59
|
+
| 15 | Domain Modeling | `/scaffold:domain-modeling` | Entities, aggregates, events, bounded contexts |
|
|
60
|
+
| 16 | Domain Modeling | `/scaffold:review-domain-modeling` | 10-pass domain model review |
|
|
61
|
+
| 17 | Architecture Decisions | `/scaffold:adrs` | Architecture Decision Records |
|
|
62
|
+
| 18 | Architecture Decisions | `/scaffold:review-adrs` | Review for contradictions, missing decisions |
|
|
63
|
+
| 19 | System Architecture | `/scaffold:system-architecture` | Components, data flows, module structure |
|
|
64
|
+
| 20 | System Architecture | `/scaffold:review-architecture` | Coverage gaps, constraint violations |
|
|
65
|
+
| 21 | Specifications | `/scaffold:database-schema` | **(optional)** Tables, indexes, constraints |
|
|
66
|
+
| 22 | Specifications | `/scaffold:review-database` | **(optional)** Schema review |
|
|
67
|
+
| 23 | Specifications | `/scaffold:api-contracts` | **(optional)** Endpoints, error codes, auth |
|
|
68
|
+
| 24 | Specifications | `/scaffold:review-api` | **(optional)** API contracts review |
|
|
69
|
+
| 25 | Specifications | `/scaffold:ux-spec` | **(optional)** Flows, states, accessibility |
|
|
70
|
+
| 26 | Specifications | `/scaffold:review-ux` | **(optional)** UX spec review |
|
|
71
|
+
| 27 | Quality Gates | `/scaffold:review-testing` | Reviews TDD strategy for coverage gaps |
|
|
72
|
+
| 27.5 | Quality Gates | `/scaffold:story-tests` | Tagged test skeletons from user story ACs |
|
|
73
|
+
| 28 | Quality Gates | `/scaffold:create-evals` | Generates eval checks from standards docs |
|
|
74
|
+
| 29 | Quality Gates | `/scaffold:operations` | Deployment, monitoring, incident response |
|
|
75
|
+
| 30 | Quality Gates | `/scaffold:review-operations` | Reviews operations runbook |
|
|
76
|
+
| 31 | Quality Gates | `/scaffold:security` | Threat model, auth, data protection |
|
|
77
|
+
| 32 | Quality Gates | `/scaffold:review-security` | Reviews security posture |
|
|
78
|
+
| 33 | Platform Parity | `/scaffold:platform-parity-review` | **(optional)** Multi-platform projects |
|
|
79
|
+
| 34 | Consolidation | `/scaffold:claude-md-optimization` | Run BEFORE workflow-audit |
|
|
80
|
+
| 35 | Consolidation | `/scaffold:workflow-audit` | Run AFTER claude-md-optimization |
|
|
81
|
+
| 36 | Planning | `/scaffold:implementation-plan` | Creates full task graph |
|
|
82
|
+
| 37 | Planning | `/scaffold:implementation-plan-review` | Second pass for quality + multi-model validation (depth 4+) |
|
|
83
|
+
| 38 | Validation | `/scaffold:cross-phase-consistency` | Naming, assumptions, interfaces |
|
|
84
|
+
| 39 | Validation | `/scaffold:traceability-matrix` | PRD → Stories → Architecture → Tasks |
|
|
85
|
+
| 40 | Validation | `/scaffold:decision-completeness` | All decisions recorded and justified |
|
|
86
|
+
| 41 | Validation | `/scaffold:critical-path-walkthrough` | End-to-end critical journey trace |
|
|
87
|
+
| 42 | Validation | `/scaffold:implementability-dry-run` | Simulate agent picking up tasks |
|
|
88
|
+
| 43 | Validation | `/scaffold:dependency-graph-validation` | Verify task DAG is acyclic |
|
|
89
|
+
| 44 | Validation | `/scaffold:scope-creep-check` | Specs stay within PRD boundaries |
|
|
90
|
+
| 45 | Finalization | `/scaffold:apply-fixes-and-freeze` | Apply findings, freeze docs |
|
|
91
|
+
| 46 | Finalization | `/scaffold:developer-onboarding-guide` | "Start here" for new devs/agents |
|
|
92
|
+
| 47 | Finalization | `/scaffold:implementation-playbook` | Operational guide for agent execution |
|
|
93
|
+
| 48 | Execution | `/scaffold:single-agent-start` | Single-agent TDD execution loop |
|
|
94
|
+
| 48 | Execution | `/scaffold:multi-agent-start` | Multi-agent — one per worktree |
|
|
95
|
+
|
|
96
|
+
## Standalone Commands
|
|
97
|
+
|
|
98
|
+
| Command | When to Use |
|
|
99
|
+
|---------|-------------|
|
|
100
|
+
| `/scaffold:single-agent-resume` | Resume work after a break |
|
|
101
|
+
| `/scaffold:multi-agent-resume` | Resume multi-agent work after a break |
|
|
102
|
+
| `/scaffold:new-enhancement` | Add a feature to an existing project |
|
|
103
|
+
| `/scaffold:quick-task` | Create a focused task for a bug fix, refactor, or small improvement |
|
|
104
|
+
| `/scaffold:version-bump` | Bump version and update changelog without tagging or releasing |
|
|
105
|
+
| `/scaffold:release` | Create a versioned release with changelog and GitHub release |
|
|
106
|
+
| `/scaffold:prompt-pipeline` | Show the full pipeline reference |
|
|
107
|
+
| `/scaffold:dashboard` | Open visual pipeline dashboard in browser |
|
|
108
|
+
|
|
109
|
+
## Execution Model
|
|
110
|
+
|
|
111
|
+
### Two Parallel Tracks
|
|
112
|
+
|
|
113
|
+
After Phase 1 (Product Definition), the pipeline splits into **two independent tracks** that can run concurrently. They converge at Phase 12 (Planning).
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
┌─ Track A: Infrastructure ──────────────────────┐
|
|
117
|
+
│ │
|
|
118
|
+
Phase 1 │ Phase 2 (foundation) │
|
|
119
|
+
create-prd ─→ review-prd │ tech-stack → coding-standards → tdd │
|
|
120
|
+
↓ │ ↓ │
|
|
121
|
+
user-stories │ project-structure → dev-env-setup │
|
|
122
|
+
↓ │ ↓ │
|
|
123
|
+
review-user-stories ──┐ │ git-workflow → claude-md-optimization │
|
|
124
|
+
│ │ ↓ ↓ │
|
|
125
|
+
│ │ ai-memory-setup workflow-audit │
|
|
126
|
+
│ │ │
|
|
127
|
+
│ └────────────────────────────────────────────────┘
|
|
128
|
+
│
|
|
129
|
+
│ ┌─ Track B: Domain & Quality ───────────────────┐
|
|
130
|
+
│ │ │
|
|
131
|
+
└──→ │ Phase 5-8: domain-modeling → adrs → │
|
|
132
|
+
│ system-architecture → specs (DB/API/UX) │
|
|
133
|
+
│ │
|
|
134
|
+
│ Phase 9: tdd → review-testing → operations │
|
|
135
|
+
│ → security (+ reviews for each) │
|
|
136
|
+
│ │
|
|
137
|
+
└────────────────────────────────────────────────┘
|
|
138
|
+
↓
|
|
139
|
+
┌───────────────┴───────────────┐
|
|
140
|
+
│ Phase 12: Planning │
|
|
141
|
+
│ (convergence point — │
|
|
142
|
+
│ depends on both tracks) │
|
|
143
|
+
└───────────────┬───────────────┘
|
|
144
|
+
↓
|
|
145
|
+
Phase 13: Validation (7 parallel checks)
|
|
146
|
+
↓
|
|
147
|
+
Phase 14: Finalization → Execution
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### How Order Numbers Work
|
|
151
|
+
|
|
152
|
+
The `order` field is a **tiebreaker**, not a sequence number. Execution order is determined by:
|
|
153
|
+
|
|
154
|
+
1. **Dependency graph** (primary) — topological sort ensures prerequisites complete first
|
|
155
|
+
2. **Order field** (secondary) — when multiple steps are eligible simultaneously, lower order runs first
|
|
156
|
+
|
|
157
|
+
Order numbers are **phase-aligned**: Phase N uses orders in the N00 range (Phase 1 = 100s, Phase 2 = 200s, etc.). This makes it easy to identify which phase a step belongs to from its order alone.
|
|
158
|
+
|
|
159
|
+
### Which Phases Can Run in Parallel
|
|
160
|
+
|
|
161
|
+
Steps within the same track that don't depend on each other can run in parallel (in separate sessions/worktrees):
|
|
162
|
+
|
|
163
|
+
- **Track A** and **Track B** are fully independent until Phase 12
|
|
164
|
+
- Within Track B, specification steps (Phase 8) can parallelize: DB schema, API contracts, and UX spec all depend on review-architecture but not each other
|
|
165
|
+
- Validation steps (Phase 13) all depend on implementation-plan-review but not each other — all 7 can run in parallel
|
|
166
|
+
|
|
167
|
+
## Critical Ordering Constraints
|
|
168
|
+
|
|
169
|
+
1. **Tech Stack before Coding Standards and TDD** — they reference it
|
|
170
|
+
2. **Dev Setup before Git Workflow** — Git Workflow references lint/test commands
|
|
171
|
+
3. **Git Workflow before AI Memory Setup** — memory rules are extracted from project docs
|
|
172
|
+
4. **User Stories before Domain Modeling** — domain models derive from stories
|
|
173
|
+
5. **Domain Modeling → ADRs → Architecture** — linear chain through modeling phases
|
|
174
|
+
6. **Architecture before Specification** — DB, API, UX specs derive from architecture (can parallelize)
|
|
175
|
+
7. **TDD → Review Testing → Operations → Security** — quality gate chain
|
|
176
|
+
8. **Both tracks converge at Implementation Plan** — depends on tdd, operations, security, AND review-architecture
|
|
177
|
+
9. **All 7 Validation checks before Apply Fixes & Freeze** — freeze requires all findings
|
|
178
|
+
10. **Finalization before Execution** — agents need frozen docs and playbook
|
|
179
|
+
8. **TDD → Review Testing → Operations → Security** — quality gate chain
|
|
180
|
+
9. **Quality Gates before Consolidation** — consolidation verifies all docs including operations/security
|
|
181
|
+
10. **Claude.md Optimization before Workflow Audit** — optimize first, verify second
|
|
182
|
+
11. **Implementation Plan Review before Validation** — 7 checks run after plan review
|
|
183
|
+
12. **All 7 Validation checks before Apply Fixes & Freeze** — freeze requires all findings
|
|
184
|
+
13. **Finalization before Execution** — agents need frozen docs and playbook
|
|
185
|
+
|
|
186
|
+
## Status & Navigation
|
|
187
|
+
|
|
188
|
+
For all status, progress, and navigation queries, use the `scaffold-runner` skill, which delegates to the `scaffold` CLI:
|
|
189
|
+
|
|
190
|
+
- `scaffold status` — current pipeline progress
|
|
191
|
+
- `scaffold status --compact` — show only actionable steps (pending/in-progress)
|
|
192
|
+
- `scaffold next` — next eligible steps
|
|
193
|
+
- `scaffold list` — full pipeline with status indicators
|
|
194
|
+
- `scaffold skip <step> [<step2>...] --reason "..."` — skip one or more steps
|
|
195
|
+
- `scaffold reset <step> --force` — reset a step to re-run it
|