From skills
End-to-end project builder: idea → spec → shell → ralph loop → secrets → report. SMS notification after every phase. Creates a project directory with symlinked skills and a ralph execution loop. Does NOT scaffold Next.js — ralph does that as step 1.1 of the plan. Use when the user says "build project", "build a project", "new project", "create project", "build from idea", "scaffold and notify", "spec a project", "plan a project", or "scaffold project".
How this skill is triggered — by the user, by Claude, or both
Slash command
/skills:add-projectThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Single entry point for new projects. Creates the project shell and ralph loop — ralph does the actual building.
Single entry point for new projects. Creates the project shell and ralph loop — ralph does the actual building.
Project path: The user provides the new project path (e.g. project name or full directory path). add-project creates the shell and the ralph loop at that path. In addition to everything below, add-project (1) adds the ralph loop to the loops catalog (loops/<project-name>/) so it is registered for future reference and evaluation, and (2) creates the loop at the user-provided path in .ralph/ — the execution loop (PLAN.md, PROMPT.md, AGENT.md, etc.) lives in {user-path}/.ralph/.
Phase 1: Spec — idea → docs/specs/{name}.md (parallel scanning)
Phase 2: Shell — spec → project dir with symlinks (NO Next.js — ralph does that)
Phase 3: Ralph — generate .ralph/ loop from spec (PLAN.md, PROMPT.md, AGENT.md) + register in loops/
Phase 4: Secrets — 1Password → .env.local (batched — one biometric)
Phase 5: Report — summary + next steps
SMS notification is sent after EVERY phase completes (see "Phase SMS Notifications" below).
Phase summary is presented after EVERY phase (see "Phase Summary" below).
KEY PRINCIPLE: add-project creates the shell. Ralph builds the app.
add-project currently runs in fresh-only mode. PLAN.md step 1.1 is always "Apply create-next skill" (Ralph scaffolds Next.js). add-project never runs create-next-app itself.
Scaffold guide: For skill ordering and the tiered scaffold model (what to install and in what order), use references/SCAFFOLD.md and references/scaffold-dag.json. The DAG defines Tier 0 (every project: app-shell → runtime → ui-data → testing), Tier 1 (most apps: auth, ai, background-jobs), Tier 2 (specialized packs: collaboration, video-media, visual), and Tier 3 (ops). Use it whenever you derive a skill list or PLAN step order from a no-frills spec.
| Task Type | Model | Why |
|---|---|---|
| Skill catalog scanning | haiku | Read-only, fast, 5x cheaper |
| Plan/doc reading | haiku | Simple extraction |
| Template file generation | haiku | Filling known values |
| Dependency graph + mapping | sonnet | Moderate reasoning for toposort |
| Verification checks | haiku | Mechanical validation |
| User interaction + orchestration | opus (inherited) | Complex coordination |
Invoke the add-spec skill to produce the spec. add-spec runs the full brainstorming workflow (explore context → clarify → approaches → design approval → design doc), then writes a no-frills spec to docs/specs/{project-name}.md.
docs/plans/YYYY-MM-DD-<topic>-design.md (design doc)docs/specs/{project-name}.md (no-frills spec: Mission, Main Features, Major User Flows, Required Screens, Required Features mapped to /skills, Open Gaps, Constraints)docs/specs/{project-name}.md.Do not proceed until spec is approved and add-spec has written the spec file.
→ Present Phase 1 Summary, then send Phase 1 SMS (see "Phase SMS Notifications" below)
Project directory: Use the path the user provided for the new project (e.g. {project-name} or full path). All shell and .ralph artifacts are created under that path; the ralph loop will live in {user-path}/.ralph/.
Read the spec. Skill list: Extract skill names from the no-frills spec's Required Features (from /skills) table. Include create-next if not already listed (needed for Ralph step 1.1). Order the skill list using references/scaffold-dag.json: Tier 0 layers first (app-shell, runtime, ui-data, testing), then Tier 1 (auth, ai, background-jobs as present), then Tier 2 packs by dependency; this matches references/SCAFFOLD.md and ensures symlinks and later PLAN steps follow the scaffold guide.
Fresh mode — This phase creates ONLY the directory and skill symlinks. No Next.js. No packages.
# 1. Create project directory
mkdir -p {project-name}/.claude/skills
# 2. Resolve the skills source root once
SKILLS_ROOT=$(cd "$(dirname "$(realpath skills/add-project/SKILL.md)")/../.." && pwd)
# 3. Symlink all skills from the spec using SKILLS_ROOT
cd {project-name}/.claude/skills
for skill in {skills-from-spec}; do
ln -s "$SKILLS_ROOT/skills/$skill" "$skill"
done
Verify:
# All symlinks resolve
for link in {project-name}/.claude/skills/*/SKILL.md; do
test -f "$link" || echo "BROKEN: $link"
done
CRITICAL: Without this file, ralph has no tool permissions and will halt on loop 1.
cat > {project-name}/.ralphrc << 'RALPHRC'
# Ralph Configuration for {PROJECT_NAME}
# Generated by add-project skill
# Claude Code CLI command
CLAUDE_CODE_CMD=claude
# Model — use sonnet for balanced cost/capability, opus for complex projects
CLAUDE_MODEL=claude-sonnet-4-6
# Rate limiting
MAX_CALLS_PER_HOUR=100
# Claude timeout per loop iteration (minutes)
CLAUDE_TIMEOUT_MINUTES=15
# Output format
CLAUDE_OUTPUT_FORMAT=json
# Allowed tools — MUST include Task for parallel subagents
# Bash(*) is used instead of granular Bash(cmd *) patterns because:
# 1. Skills install arbitrary packages (bun add, bunx, drizzle-kit, biome, etc.)
# 2. Docker commands vary by project (docker compose, docker exec, etc.)
# 3. Granular patterns are fragile — any new command halts ralph
# 4. Ralph runs locally under developer control, not in production
# playwright-cli is available globally — runs via Bash, no MCP needed
CLAUDE_ALLOWED_TOOLS="Write,Read,Edit,Glob,Grep,Bash(*),Task,WebFetch,WebSearch,ToolSearch,Skill"
# Session continuity — resume between loops
CLAUDE_USE_CONTINUE=true
# Session expiry (hours)
CLAUDE_SESSION_EXPIRY_HOURS=24
# Additional directories to reference (resolved skills root)
ADD_DIRS="{SKILLS_ROOT}"
# Circuit breaker settings
CB_NO_PROGRESS_THRESHOLD=3
CB_SAME_ERROR_THRESHOLD=5
CB_OUTPUT_DECLINE_THRESHOLD=70
CB_COOLDOWN_MINUTES=30
CB_AUTO_RESET=false
RALPHRC
Replace {PROJECT_NAME}, {SKILLS_ROOT} with actual values.
Model selection for .ralphrc:
claude-sonnet-4-6 — default for most projects (good balance of speed/capability)claude-opus-4-6 — for complex multi-skill projects (20+ skills, heavy custom code)claude-haiku-4-5-20251001 — for simple projects (few skills, mostly boilerplate)Why these specific tools:
| Tool | Why Ralph Needs It |
|---|---|
Task | Parallel subagents (dynamic model selection in PROMPT.md) |
Bash(*) | Skills run arbitrary CLI commands (bun, docker, drizzle-kit, biome, curl, op, playwright-cli) |
WebFetch/WebSearch | Documentation lookups during skill application |
ToolSearch | Discovers and loads MCP tools at runtime |
Skill | Invokes project skills directly |
Note:
playwright-cliruns viaBash(*)— no MCP tool permissions needed.
CRITICAL: Without a git repo, Ralph's circuit breaker kills the loop.
Ralph detects progress by running git diff to count changed files between loops.
Without a git repo, files_changed is always 0, the circuit breaker sees "no progress"
for 3 consecutive loops, and trips — halting execution even though work is actually being done.
# Ensure .env files are gitignored BEFORE the initial commit
cat >> {project-name}/.gitignore << 'EOF'
.env
.env.local
EOF
# Initialize repo and create initial commit
cd {project-name}
git init
git add -A
git commit -m "initial scaffold"
Important notes:
.env and .env.local to .gitignore before the initial commit to avoid committing secretscreate-next-app later (ralph step 1.1), do NOT pass --disable-gitDo not proceed until all symlinks resolve, .ralphrc exists, and git repo is initialized.
→ Present Phase 2 Summary, then send Phase 2 SMS (see "Phase SMS Notifications" below)
Create the .ralph/ directory with everything ralph needs to build the project autonomously.
This is the most important phase. The quality of these files determines how well ralph executes.
mkdir -p {project-name}/.ralph/logs
mkdir -p {project-name}/.ralph/screenshots
Read the spec file and treat scaffold as fresh-only. Build PLAN.md by ordering skills and gaps using references/scaffold-dag.json: step 1.1 = "Apply create-next skill", then one PENDING step per Tier 0 layer (runtime, ui-data, testing) as needed, then Tier 1 (auth, ai, queue) as needed, then Tier 2 packs from the Required Features table in DAG order, then one step per Open Gaps item; add Phase 4 E2E steps for major user flows from the spec. See references/SCAFFOLD.md for the human-readable tier and pack layout.
MICRO-STEP RULE: Every step must be small and independently verifiable.
Format (fresh):
# {Project Name} — Master Execution Plan
**Created:** {date}
**Status:** READY TO START
**Goal:** {description from spec}
**Scaffold:** fresh
---
## Overview
Apply {skill-count} skills + {custom-count} custom implementations to build {project-name}.
Every step must be tested. ONE step per Ralph loop.
**Rule: ONE step per Ralph loop. Test before marking done.**
### Testing Requirements
...
### Progressive Test Writing
...
---
## Phase 1: Shared Substrate
| Step | Task | Test |
|------|------|------|
| 1.1 | PENDING: Apply `create-next` skill (scaffold Next.js, AGENTS.md, biome, bun install) | `bun run build` passes |
| 1.2 | PENDING: Apply `docker` skill (...) | ... |
...
This file tells ralph HOW to work. It must include dynamic model selection and parallel subagent instructions.
# Ralph — {Project Name} Builder
## Context
You are Ralph, an autonomous AI development agent building {project-name}.
You compose {skill-count} skills + {custom-count} custom implementations into
a working Next.js application with playwright-cli-validated interactions.
## CRITICAL: Loop Discipline
**Each loop = ONE task from the plan. Period.**
- Read PLAN.md → find first PENDING step → execute ONLY that step → update PROGRESS.md → STOP
- Do NOT combine multiple steps into one loop
- Do NOT start the next step after finishing one
- Budget: ~50 seconds of work per loop (leaving 10s buffer)
- If a step takes too long, mark it PARTIAL and continue next loop
## Dynamic Model Selection
Use the right model for each sub-task within a step. Launch parallel subagents
whenever tasks are independent.
| Task Type | Model | When to Use |
|-----------|-------|-------------|
| Read a SKILL.md file | haiku | Simple file reading, no reasoning |
| Generate boilerplate files | haiku | Templates with known values (configs, schemas) |
| Install packages + verify | haiku | Mechanical: bun add, check imports |
| Write API routes | sonnet | Moderate logic: request handling, validation |
| Write React components | sonnet | UI logic, hooks, state management |
| Custom architecture (C1-C14) | sonnet | Design decisions, integration patterns |
| Write Playwright tests | sonnet | Test logic, assertions, page objects |
| Write unit/integration tests | sonnet | Test logic, mocking, assertions |
| Write e2e tests (playwright-cli) | sonnet | Browser automation, page assertions |
| Debug build/type errors | sonnet | Error analysis, fix reasoning |
| Complex multi-file changes | opus | Architectural changes touching 5+ files |
| Orchestration + user decisions | opus (inherited) | The main loop always runs on opus |
### Parallel Subagent Rules
**Within each step, maximize parallelism:**
1. When a skill creates multiple independent files → launch parallel haiku/sonnet subagents
Example: "Apply db skill" creates schema.ts, drizzle.config.ts, migrate script → Launch 3 parallel haiku agents, one per file
2. When running verification → launch build + lint in parallel
Bash: bun run build (background) Bash: bunx biome check . (background) → Wait for both, report results
3. When testing multiple routes → parallel curl commands
Bash: curl /api/route-a & curl /api/route-b & curl /route-c & wait
4. When a skill needs packages + files → install packages in background while writing files
Bash(background): bun add react-hook-form zod @hookform/resolvers Write: src/components/form.tsx (parallel with install) → Wait for install before build test
**NEVER launch subagents across steps. Each step is atomic.**
## How to Apply a Skill
For each "Apply X skill" step:
1. Read `.claude/skills/{skill-name}/SKILL.md`
2. Follow instructions exactly — create files, install packages, modify configs
3. Use parallel subagents for independent file creation within the step
4. After applying: run `bun run build` + `bunx biome check .`
5. If build fails: fix errors (they count as part of this step)
6. If a page was created: verify it returns 200
## Testing Requirements (CRITICAL)
**Every step MUST be tested. Non-negotiable.**
### Build + Lint + Test (every step):
- `bun run build` — must pass
- `bunx biome check .` — must pass
- `bun test` — all tests must pass
### Progressive Test Writing (every step):
Write tests WITH each step — never defer to a later phase:
**Unit tests** (`__tests__/unit/`):
- Utility functions, lib helpers, formatters, validators
- Run with `bun test __tests__/unit/`
**Integration tests** (`__tests__/integration/`):
- API routes, database queries, auth flows
- Run with `bun test __tests__/integration/`
**E2E tests** (`__tests__/e2e/`):
- UI pages, user flows via playwright-cli
- `playwright-cli goto http://localhost:3000/{route}`
- `playwright-cli snapshot` — verify DOM structure
- `playwright-cli click <ref>` — test interactions
- `playwright-cli screenshot --output .ralph/screenshots/{step}.png`
- `playwright-cli console` — check for JS errors
- `playwright-cli eval "document.title"` — assert page state
### For skill steps:
- `bun run build` — must pass
- `bunx biome check .` — must pass
- `bun test` — must pass
- If skill creates a page: `curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/{route}` → 200
### For protected pages (after auth):
- Seed: `curl -X POST http://localhost:3000/api/dev/seed`
- Sign in: `curl -c /tmp/cookies.txt -X POST .../api/auth/sign-in/email`
- Test: `curl -b /tmp/cookies.txt http://localhost:3000/{route}` → 200
### Ralph Loop After Each Step:
1. Implement the step
2. Write unit/integration tests for new code
3. `bun run build` + `bunx biome check .`
4. Start dev server (if UI step)
5. `bun test` — run all tests
6. `playwright-cli` for UI validation (if UI step)
7. Mark step done in PLAN.md (change PENDING to DONE)
8. Add a **structured entry** to PROGRESS.md: step id, step label, skills applied for this step (from the plan or "Apply X skill"), outcome (PASS | FAIL | PARTIAL), and ISO timestamp. Use the format in PROGRESS.md (HTML comment + one-line summary) so evaluations can parse loop structure and skill combinations.
9. `git add -A && git commit -m "step {N}: {short description}"` — commit all changes
## Key Principles
- **ONE step per loop** — non-negotiable
- **Git commit after every step** — `git add -A && git commit -m "step {N}: {description}"`
- **Write tests WITH each step** — unit + integration + e2e alongside implementation
- **Use parallel subagents** within steps for independent work
- **Use dynamic models** — haiku for templates, sonnet for logic, opus for architecture
- Read skill files before applying them
- Port fixes back to skills/ via symlinks
- Never cast to `any`, use `useId` for keys, react-hook-form for forms
- API routes over server components for dynamic data
## Status Reporting
At the end of EVERY response, emit the block below. Include **STEP_ID** and **SKILLS_THIS_STEP** so loop structure and skill combinations are traceable for evaluations (e.g. report scripts or loops catalog).
\`\`\`
---RALPH_STATUS---
STATUS: IN_PROGRESS | COMPLETE | BLOCKED
STEP_ID: <e.g. 1.2>
SKILLS_THIS_STEP: <comma-separated skill names applied this loop, e.g. docker,env-config>
TASKS_COMPLETED_THIS_LOOP: 0 | 1
FILES_MODIFIED: <number>
TESTS_STATUS: PASSING | FAILING | NOT_RUN
BUILD_STATUS: PASSING | FAILING | NOT_RUN
PAGES_TESTED: <routes>
TESTS_WRITTEN: <count>
TEST_TYPES: unit | integration | e2e
SUBAGENTS_USED: <count> (haiku: N, sonnet: N)
WORK_TYPE: IMPLEMENTATION | TESTING | FIX
EXIT_SIGNAL: false | true
RECOMMENDATION: <next step>
---END_RALPH_STATUS---
\`\`\`
# {Project Name} — Agent Instructions
## Project Type
{description from spec}
## Directory Layout
\`\`\`
.claude/skills/ # Symlinked skills ({count} total)
src/ # Next.js app (created by ralph step 1.1)
__tests__/ # Unit, integration, e2e tests
.ralph/ # Execution tracking
├── PLAN.md # Master plan ({step-count} steps)
├── PROMPT.md # Loop discipline + model routing
├── PROGRESS.md # Progress log
└── screenshots/ # Playwright captures
\`\`\`
## How to Run Validation
1. `bun run build` — zero errors
2. `bunx biome check .` — zero lint violations
3. `bun test` — all tests pass
4. `playwright-cli` for UI validation (runs via Bash, no MCP needed)
5. `curl` for API routes
## Technology Stack
{extracted from spec constraints}
Ralph updates this file every loop so evaluations can track loop structure and skill combinations over time. Use a structured entry format so tooling can parse step id, skills applied, and outcome:
# {Project Name} — Progress Log
## How to Use
After each step, append one entry below. Each entry MUST include: step id, step label, skills applied (comma-separated), outcome (PASS | FAIL | PARTIAL), and ISO timestamp. This allows evaluations to track loop structure and skill combinations as the loop runs.
### Entry format (one per step)
<!-- STEP step_id="{N.M}" label="{short label}" skills="{skill-a, skill-b}" outcome="PASS|FAIL|PARTIAL" at="{ISO8601}" -->
---
(empty — ralph fills this in)
Example entry Ralph would add:
<!-- STEP step_id="1.2" label="Apply docker skill" skills="docker,env-config" outcome="PASS" at="2026-02-22T14:30:00Z" -->
**1.2** Apply docker skill — PASS @ 2026-02-22T14:30:00Z
echo '{"status": "ready", "timestamp": "{date}"}' > {project-name}/.ralph/progress.json
echo '{"timestamp": "{date}", "loop_count": 0, "status": "ready"}' > {project-name}/.ralph/status.json
Add the ralph loop to loops/ so this project's loop is in the catalog (see loops/README.md and GENERATED.md). Create loops/<project-name>/ and copy all evaluation-relevant artifacts so the catalog can track loop structure, skill combinations, and relative output over time:
# From repo root (repo containing loops/)
mkdir -p loops/{project-name}
# Loop definition and structure
cp {project-name}/.ralph/PLAN.md loops/{project-name}/
cp {project-name}/.ralph/PROMPT.md loops/{project-name}/
cp {project-name}/.ralph/AGENT.md loops/{project-name}/
# Progress and outcomes (for evaluations on loop structure and skill combinations)
cp {project-name}/.ralph/PROGRESS.md loops/{project-name}/
cp {project-name}/.ralph/progress.json loops/{project-name}/ 2>/dev/null || true
cp {project-name}/.ralph/status.json loops/{project-name}/ 2>/dev/null || true
# Relative output from runs (when present): logs, reports, screenshots
cp -r {project-name}/.ralph/logs loops/{project-name}/ 2>/dev/null || true
cp {project-name}/.ralph/report_*.json loops/{project-name}/ 2>/dev/null || true
cp {project-name}/.ralph/report_history_*.jsonl loops/{project-name}/ 2>/dev/null || true
cp -r {project-name}/.ralph/screenshots loops/{project-name}/ 2>/dev/null || true
Ongoing updates: When the ralph loop runs (locally or in CI), sync the same relative output back into loops/<project-name>/ (e.g. after each run or on a schedule) so the catalog always has the latest PLAN.md, PROGRESS.md, logs, report_.json, report_history_.jsonl, and screenshots for evaluations. Evaluations use: (1) loop structure — phases and steps from PLAN.md; (2) skill combinations — which skills per step and order from PROGRESS.md (and report history); (3) relative output — logs, reports, screenshots for each run.
The loop that runs is the one at the user-provided project path in .ralph/; the copies in loops/<project-name>/ are for catalog and evaluation.
Do not proceed until all .ralph/ files are created and the loop is registered in loops//.
→ Present Phase 3 Summary, then send Phase 3 SMS (see "Phase SMS Notifications" below)
Use references/1password-secrets.md for the full workflow.
Minimum requirements for this phase:
op signin --account my.1password.com before item reads.Dev Environment notesPlain into {PROJECT_NAME}/.env.local.op commands whenever possible to minimize biometric prompts.→ Present Phase 4 Summary, then send Phase 4 SMS (see "Phase SMS Notifications" below)
Project "{PROJECT_NAME}" — shell created, ralph loop ready!
Location: {path}
Skills linked: {count} (symlinked to skills/)
Ralph loop: .ralph/PLAN.md ({step-count} steps across 4 phases)
Secrets: .env.local (all keys from 1Password "Dev Environment")
SMS: sent after every phase
Ralph features:
- Dynamic model selection (haiku/sonnet/opus per task type)
- Parallel subagents within each step
- Progressive test writing (unit + integration + e2e)
- playwright-cli validation for all UI (runs via Bash)
- One step per loop, tested before marking done
- GitHub Actions UI: collapsible iterations, step summary, annotations
- Pause/resume: one-click workflows (ralph-pause.yml, ralph-resume.yml)
- SMS notifications: phase completion, errors, budget alerts
Next steps:
1. cd {PROJECT_NAME}
2. Start ralph — it will begin from step 1.1 (scaffold Next.js via create-next)
3. Ralph applies skills in dependency order, tests each step
4. Fixes port back to skills/ via symlinks
5. Pause anytime via "Ralph: Pause" in GitHub Actions, resume with "Ralph: Resume"
→ Present Phase 5 Summary, then send Phase 5 SMS (see "Phase SMS Notifications" below)
After EVERY phase completes, present a conversational summary to the user before sending the SMS.
The summary is a narrative recap — not a dry status block. It should read like a developer explaining what just happened to a colleague. Show your work: code references, file paths, exact counts, decisions made, and any issues hit along the way.
What was done — specific actions taken, files created/modified, commands run. Include file paths and line numbers where relevant.
Created project shell at ~/Developer/media-pipeline/.claude/skills/
Symlinked 12 skills: db, auth, ai-core, ai-image-gen, storage, ...
Generated .ralphrc with CLAUDE_MODEL=claude-sonnet-4-6 and Bash(*) permissions
Key decisions — any choices made during the phase and why.
Used claude-sonnet-4-6 for .ralphrc — 20 skills is moderate complexity,
sonnet balances cost/capability well here.
Issues encountered — problems hit and how they were resolved. Be specific.
Symlink for `react-flow` initially pointed to the wrong source path.
Fixed by resolving a single `SKILLS_ROOT` first, then linking from that path.
Progress table — current state across all phases.
┌────────────────┬────────┬────────┐
│ Phase │ Status │ Time │
├────────────────┼────────┼────────┤
│ 1 — Spec │ DONE │ 2m 15s │
│ 2 — Shell │ DONE │ 45s │
│ 3 — Ralph Loop │ ...... │ .......|
│ 4 — Secrets │ ...... │ .......|
│ 5 — Report │ ...... │ .......|
└────────────────┴────────┴────────┘
Phase 2 of 5 complete
What's next — brief preview of the upcoming phase.
Next: Phase 3 — Generate ralph loop files (PLAN.md, PROMPT.md, AGENT.md).
This is the most important phase — plan quality determines ralph's success.
Generated .ralphrc (line 144: CLAUDE_MODEL=claude-sonnet-4-6)Present the summary AFTER the phase work is done, BEFORE sending the SMS. The SMS is a compressed version of the summary (one line). The summary is the full story.
See references/sms-notifications.md for the full send/fallback flow.
Minimum requirements:
SMS_TO in .env.local.See references/lessons-learned.md for historical build issues and fixes (F1-F16).
npx claudepluginhub mattwoodco/skills --plugin skillsInitializes Ralph Loop infrastructure from approved Claude plans by creating .ralph/ with prd.json, loop.py, CLAUDE.md for autonomous multi-step execution.
Generates feature specs, implementation plans with task checklists, and project loop infrastructure via interactive user interviews on scope, risk tolerance, and validation.
Generates structured PROMPT.md files for autonomous AI workflows (Ralph Loops) from rough descriptions or PRDs, with phases, validation criteria, completion promises, and blind review.