Build software projects using structured spec-driven development with the Ralph Wiggum pattern. Use when asked to build, implement, or code a project, feature, or application. Covers discovery (requirements gathering), spec generation, AGENTS.md context generation, and autonomous implementation with fresh-context iterations. Supports any language/framework.
Structured approach to building software: discover → spec → match stack → implement with fresh-context iterations.
Four phases:
Conversational requirements gathering (3-5 exchanges max). Gather:
Produce a spec JSON and save to .spec.json:
{
"goal": "Build a CLI tool for ...",
"project_name": "my-tool",
"language": "Go",
"framework": "cobra",
"features": ["Feature 1", "Feature 2"],
"requirements": ["Must support X"]
}Confirm spec with user before proceeding.
Tech-stack skills capture how we build with a given stack. They accumulate patterns, conventions, and preferences over time so every project is built the way we want.
Check stacks/ directory for a matching stack file:
Available stacks: (read from stacks/ dir)
cloudflare-hono.md — Cloudflare Workers + Hono + Durable Objectsgo-cli.md — Go CLI with Cobra/TooeyIf no stack matches, create one during discovery:
web_fetch official docs)stacks/<name>.mdStack file format:
# Tech Stack: {Name}
**Tags:** tag1, tag2, tag3
{Description of when to use this stack}
## Project Structure
{preferred directory layout}
## Conventions
- **Naming:** {conventions}
- **Extensions:** {file types}
## Key Patterns
{Code examples for routing, DB, error handling, etc.}
## Dependencies
{default packages to install}
## Preferences
{build commands, runtime choices, style preferences}After completing a project, review what worked and update the stack:
This is the key differentiator: stacks improve with every project. Over time, they encode exactly how we build things.
Generate an AGENTS.md that becomes the single source of truth for implementation.
See references/agents-template.md for the template. The AGENTS.md combines:
Save as AGENTS.md in the project root.
Each iteration is a separate sessions_spawn = genuinely fresh context.
See references/ralph-pattern.md for full implementation guide.
Context degrades over long sessions. By spawning a new session per iteration, each gets a full 200K context window. No accumulated confusion, no contradictions.
The main session is the orchestrator — it does NOT implement. It only:
.ralph-state.jsonsessions_spawn (each = fresh context)status: "completed" or max iterations# Pseudocode — main session runs this
init_state(task, project_dir)
while state.status == "running" and state.iteration < max:
sessions_spawn(task=build_iteration_prompt(state, project_dir))
state = read_state_file(project_dir)
report_progress(state)
report_final_result(state)You are implementing a project. Iteration {N}, fresh context.
CRITICAL: You have NO memory of previous iterations. Everything is on disk.
1. Read {project_dir}/AGENTS.md for spec and rules
2. Read {project_dir}/.ralph-state.json for progress
3. Implement from where the last iteration left off
4. Update .ralph-state.json with progress
5. Set status to "completed" only when everything builds and works.ralph-state.json){
"task": "Build the REST API",
"iteration": 3,
"status": "running",
"completed_steps": ["setup config", "create models"],
"current_step": "implement handlers",
"last_output": "summary (max 1000 chars)",
"last_error": "",
"context": { "key": "value" }
}status: "completed" in state file| Phase | Input | Output | Key File |
|---|---|---|---|
| Discovery | User conversation | .spec.json | — |
| Stack Match | Spec language/framework | Stack patterns | stacks/*.md |
| Planning | Spec + Stack | AGENTS.md | references/agents-template.md |
| Implementation | AGENTS.md + State | Working code | .ralph-state.json |
8d2a2a1
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.