.agents/skills/ralph/SKILL.md
Autonomous feature development - setup and execution. Triggers on: ralph, set up ralph, run ralph, run the loop, implement tasks. Two phases: (1) Setup - chat through feature, create tasks with dependencies (2) Loop - pick ready tasks, implement, commit, repeat until done.
npx skillsauth add thesammykins/dotfiles ralphInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Interactive feature planning that creates ralph-ready tasks with dependencies.
Two modes:
todowrite tooldependsOnAsk the user which mode they need:
Are you:
1. Starting a new feature (I'll help you plan and create tasks)
2. Using existing tasks (I'll set up Ralph to run them)
Start by asking the user about their feature. Don't assume - ASK:
What feature are you building?
Then ask clarifying questions:
Keep asking until you have enough detail to break it into tasks.
Each task must be completable in ONE Ralph iteration (~one context window).
Ralph spawns a fresh OpenCode session per iteration with no memory of previous work. If a task is too big, the LLM runs out of context before finishing.
Rule of thumb: If you can't describe the change in 2-3 sentences, it's too big.
Tasks execute based on dependsOn. Earlier tasks must complete before dependent ones start.
Typical order:
Use dependsOn to express this:
Task 1: Schema (no dependencies)
Task 2: Server action (dependsOn: [task-1])
Task 3: UI component (dependsOn: [task-2])
Task 4: Tests (dependsOn: [task-3])
Parallel tasks that don't depend on each other can share the same dependency.
todowrite
content: "[Feature Name]: [One-line description of feature]"
Save the returned task ID - you'll need it for subtasks.
todowrite
content: "[Task title - action-oriented]: [Detailed description with:
- What to implement
- Files to create/modify
- Acceptance criteria
- How to verify (typecheck, tests, browser)]"
Note: OpenCode's todowrite tool doesn't support explicit dependencies. Workaround: List subtasks in parent task description in numbered order to implicitly express dependencies.
task_list create
title: "[Feature Name]"
description: "[One-line description of the feature]"
repoURL: "https://github.com/snarktank/untangle"
**Save the returned task ID** - you'll need it for subtasks.
### Then, create subtasks with parentID and dependsOn:
task_list create title: "[Task title - action-oriented]" description: "[Detailed description with: - What to implement - Files to create/modify - Acceptance criteria - How to verify (typecheck, tests, browser)]" parentID: "<parent-task-id>" dependsOn: ["<previous-task-id>"] // omit for first task repoURL: "https://github.com/snarktank/untangle"
### Task description format:
Write descriptions that a future Ralph iteration can pick up without context:
Implement category name to ID mapping for expenses.
What to do:
Files:
Acceptance criteria:
Notes:
---
## Step 5: Set Up Ralph Files
After creating all tasks, **run the shared setup steps from "Final Setup (Required for Both Modes)" section.**
This ensures:
- Parent task ID is saved to `scripts/ralph/parent-task-id.txt`
- Previous progress.txt is archived if it has content
- Fresh progress.txt is created with Codebase Patterns preserved
---
## Step 6: Confirm Setup
Show the user what was created:
✅ Ralph is ready!
Parent task: [title] (ID: [id])
Subtasks:
To run Ralph:
./scripts/ralph/ralph.sh [max_iterations]
# or directly:
npx tsx scripts/ralph/ralph.ts [max_iterations]
To check status:
todoread()
This reads all tasks. Filter by parent task in memory.
If the user already has tasks created, help them set up Ralph to run them.
Ask the user:
What's the parent task? You can give me:
- The task ID directly
- A search term and I'll find it
- Or say "list recent" to see recent tasks
To search for tasks (always use limit to avoid context overflow):
todoread()
This reads all tasks. Filter by parent task in memory.
Once you have the parent ID, check for subtasks (always use limit):
todoread()
This reads all tasks. Filter by parent task in memory.
If no subtasks found, the parent task might BE the work (not a container). Ask:
This task has no subtasks. Is this:
1. A parent task with subtasks I should find differently?
2. The actual work task (I should create it as a parent with this as the first subtask)?
Review the subtasks and verify:
dependsOn set correctly?If dependencies are missing, offer to fix:
These tasks don't have dependencies set. Should I:
1. Add dependencies based on their order?
2. Leave them parallel (Ralph picks any ready task)?
Run the shared setup steps from "Final Setup (Required for Both Modes)" section below.
✅ Ralph is ready to use existing tasks!
**Parent task:** [title] (ID: [id])
**Status:**
- ✅ Completed: 3 tasks
- 🔄 Ready to work: 2 tasks
- ⏳ Blocked: 5 tasks (waiting on dependencies)
**Next task Ralph will pick:**
[Task title] - [brief description]
**To run Ralph:**
```bash
./scripts/ralph/ralph.sh [max_iterations]
# or directly:
npx tsx scripts/ralph/ralph.ts [max_iterations]
ALWAYS run these steps after creating tasks OR setting up existing tasks:
echo "<parent-task-id>" > scripts/ralph/parent-task-id.txt
Verify it was saved:
cat scripts/ralph/parent-task-id.txt
Read the current progress.txt:
cat scripts/ralph/progress.txt
Archive if:
Archive command:
DATE=$(date +%Y-%m-%d)
FEATURE="previous-feature-name-here"
mkdir -p scripts/ralph/archive/$DATE-$FEATURE
cp scripts/ralph/progress.txt scripts/ralph/archive/$DATE-$FEATURE/
echo "Archived to scripts/ralph/archive/$DATE-$FEATURE/"
Preserve useful Codebase Patterns from the previous run, then reset:
cat > scripts/ralph/progress.txt << 'EOF'
# Ralph Progress Log
Started: [current date]
## Codebase Patterns
[Copy any patterns from previous run that are still relevant]
---
EOF
# Confirm parent ID is saved
cat scripts/ralph/parent-task-id.txt
# Confirm progress.txt is reset
head -10 scripts/ralph/progress.txt
# List subtasks to confirm they exist
# (use task_list list with parentID)
Only after completing all 4 steps is Ralph ready to run.
Each task description MUST include verifiable acceptance criteria:
investorType column to investor table with default 'cold'"npm run typecheck passes
npm test passes
For functional testing (checking behavior, not appearance):
Use Chrome DevTools MCP with take_snapshot to read page content (NOT screenshots)
take_snapshot returns the a11y tree as text that Ralph can read and verifytake_screenshot returns images which Ralph cannot interpret for functional checksFor visual testing (checking appearance):
Use take_screenshot to capture and verify visual appearance
User: set up ralph for adding expense tracking to the legal agent
Assistant: What feature are you building?
User: I want Grace (our legal chat agent) to be able to create, update, and delete expenses when users mention them in conversation.
Assistant: Got it - an expense upsert tool for the legal agent. A few questions:
User: Follow upsert-income.ts. Yes family and child expenses (different tables). Yes list too. Mark APP_EXPENSES_ENTERED task complete.
Assistant: Perfect. Here's my proposed breakdown:
Does this look right? Any tasks to add or remove?
User: Looks good, create the tasks
Assistant: [Creates parent task, then subtasks with dependencies, saves parent-task-id.txt]
✅ Ralph is ready!
Parent task: Legal Agent Expense Upsert Tool (ID: task-abc123)
Subtasks: 14 tasks created with dependencies
To run: ./scripts/ralph/ralph.sh 20
When all subtasks are completed:
completed<promise>COMPLETE</promise>Important: Ralph uses limit: 5 when querying tasks to avoid context overflow. If you have many subtasks, they'll be processed over multiple iterations.
Once setup is complete, Ralph runs the autonomous loop to implement tasks one by one.
First, read the parent task ID that scopes this feature:
cat scripts/ralph/parent-task-id.txt
If this file doesn't exist, ask the user which parent task to work on.
Check if this is a new feature: Compare the parent task ID to the one in scripts/ralph/progress.txt header. If they differ (or progress.txt doesn't exist), this is a NEW feature - reset progress.txt:
# Build Progress Log
Started: [today's date]
Feature: [parent task title]
## Codebase Patterns
(Patterns discovered during this feature build)
---
This ensures each feature starts with a clean slate. Progress.txt is SHORT-TERM memory for the current feature only.
The task hierarchy may have multiple levels (parent → container → leaf tasks). Use this approach to find all descendant tasks:
Step 1: Get all tasks for the repo
todoread()
Important: Always use limit (5-10) to avoid context overflow with many tasks.
Step 2: Build the descendant set Starting from the parent task ID, collect all tasks that are descendants:
parentID equals the parent task ID (direct children)Step 3: Filter to workable tasks From the descendant set, select tasks that are:
ready: true (all dependencies satisfied)status: "open"CRITICAL: Skip container tasks that exist only to group other tasks. A container task has other tasks with its ID as their parentID.
Check if all descendant tasks are completed:
todoread() with repoURL: "<repo-url>" (no ready filter)completed:
DATE=$(date +%Y-%m-%d)
FEATURE="feature-name-here"
mkdir -p scripts/ralph/archive/$DATE-$FEATURE
mv scripts/ralph/progress.txt scripts/ralph/archive/$DATE-$FEATURE/
echo "" > scripts/ralph/parent-task-id.txtgit add scripts/ralph && git commit -m "chore: archive progress for [feature-name]"completedPick the next task:
Execute the task:
Use the /handoff command with this goal:
Implement and verify task [task-id]: [task-title].
[task-description]
FIRST: Read scripts/ralph/progress.txt - check the "Codebase Patterns" section for important context from previous iterations.
When complete:
1. Run quality checks: `npm run typecheck` and `npm test`
- If either fails, FIX THE ISSUES and re-run until both pass
- Do NOT proceed until quality checks pass
2. Update AGENTS.md files if you learned something important:
- Check for AGENTS.md in directories where you edited files
- Add learnings that future developers/agents should know (patterns, gotchas, dependencies)
- This is LONG-TERM memory - things anyone editing this code should know
- Do NOT add task-specific details or temporary notes
3. Update progress.txt (APPEND, never replace) - this is SHORT-TERM memory for the current feature:
Session: [current sessionID] Task ID: [task-id] - What was implemented - Files changed - Learnings for future iterations: - Patterns discovered - Gotchas encountered - Useful context --- ```
If you discovered a reusable pattern for THIS FEATURE, add it to the ## Codebase Patterns section at the TOP of progress.txt
Commit all changes with message: feat: [Task Title]
Mark task as completed using todowrite to update status to "completed"
Invoke the ralph skill to continue the loop
---
## Progress File Format
```markdown
# Build Progress Log
Started: [date]
Feature: [feature name]
Parent Task: [parent-task-id]
## Codebase Patterns
(Patterns discovered during this feature build)
---
## [Date] - [Task Title]
Session: [sessionID] # e.g., sess_01jxyz123abc...
Task ID: [id]
- What was implemented
- Files changed
- **Learnings for future iterations:**
- Patterns discovered
- Gotchas encountered
---
Note: When a new feature starts with a different parent task ID, reset progress.txt completely. Long-term learnings belong in AGENTS.md files, not progress.txt.
While working, liberally create new tasks when you discover:
Use todowrite to create new task immediately. Note: todowrite doesn't support explicit dependencies - embed subtask ordering in task description.
For UI tasks, specify the right verification method:
Functional testing (checking behavior, not appearance):
Use the agent-browser skill
Visual testing (checking appearance):
Use the agent-browser skill
---
## Accessing Previous Session Context
When the handoff summary in a new session lacks specific details needed to complete a task, the AI can use the `read_session` tool to retrieve the full conversation transcript from the source session.
**Example scenarios where this is needed:**
- You need to recall specific error messages from earlier iterations
- You need exact implementation decisions that were made
- You need user preferences discussed in previous iterations
- You need technical details not captured in the handoff summary
**How to use:**
The handoff context automatically includes a session reference line:
Continuing work from session sess_01jxyz123. When you lack specific information you can use read_session to get it.
The AI can then call:
read_session(sessionID="sess_01jxyz123", limit=100)
This retrieves the formatted transcript without needing the original session to still be open.
**Important:** The `read_session` tool is available from the handoff plugin we installed. Use it when the handoff summary doesn't contain enough context to continue work effectively. This is especially useful when the original source session is no longer available.
---
## Quality Requirements
Before marking any task complete:
- `npm run typecheck` must pass
- `npm test` must pass
- Changes must be committed
- Progress must be logged
---
## Stop Condition
When no ready tasks remain AND all tasks are completed:
1. Output: "✅ Build complete - all tasks finished!"
2. Summarize what was accomplished
---
## Important Notes
- Always use `ready: true` when listing tasks to only get tasks with satisfied dependencies
- Always use `limit: 5-10` when listing tasks to avoid context overflow
- Each handoff runs in a fresh session with clean context
- Progress.txt is the memory between iterations - keep it updated
- Prefer tasks in the same area as just-completed work for better context continuity
- The handoff goal MUST include instructions to update progress.txt, commit, and re-invoke this skill
development
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
tools
Enforces the 2025 Python stack. Replaces legacy tools (pip, flake8, isort) with modern, fast equivalents (uv, ruff). Mandates strict type hints.
documentation
Generate a Product Requirements Document (PRD) for a new feature. Use when planning a feature, starting a new project, or when asked to create a PRD. Triggers on: create a prd, write prd for, plan this feature, requirements for, spec out.
content-media
Senior DB Engineer skills for PostgreSQL. Focuses on performance (indexing, analysis), modern schema design (UUIDv7), and safe migration patterns.