协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
ralph【开发与工程】Create PRDs and automate the RALPH BUILD LOOP workflow with Claude Code. Use when starting a new project and want Claude Code to follow structured PRD-based development with automatic task tracking, testing, and git commits.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Automate project development using Product Requirements Documents (PRDs) and the RALPH BUILD LOOP.
# Create a PRD file
ralph init --name "My Project" --language python
# Start Claude Code with the PRD
ralph build
# Check progress
ralph status
# Clean up when done
ralph cleanup
--dangerously-skip-permissions flagRalph follows this 8-step workflow automatically:
1. START → Create .gitignore + .env.example (security first!)
2. LOOP → Pick highest priority incomplete task
3. READ → Check if file exists, read existing code
4. BUILD → Implement task per acceptance_criteria
5. TEST → Run test command, verify it works
6. COMMIT → git add + commit with task ID
7. MARK → Update task status to "complete"
8. REPEAT → Go to step 2 until all tasks done
9. DONE → Run full test suite
Ralph automatically monitors Claude Code builds in the background:
# Monitor a running build
ralph monitor --session <session_id> --dir <project_dir>
# With custom check interval (default 30s)
ralph monitor --session <session_id> --dir <project_dir> --interval 60
What monitoring does:
Output example:
📊 BUILD STATUS CHECK
⏱️ Session: fast-slug...
🟢 RUNNING
📝 Recent files (5):
- package.json
- src/App.jsx
- Dockerfile
- ...and 2 more
💬 Recent activity: CORE-001: Implementing chess logic...
The monitor runs continuously and reports status every interval, so you don't have to manually check!
Initialize a new PRD-based project.
ralph init --name "Project Name" --language python
ralph init --name "Web App" --language javascript --github
Options:
--name (required) - Project name--language (optional) - Programming language (python, javascript, go, rust, etc.)--github (optional) - Create GitHub repo on initialization--path (optional) - Project directory (default: current)Creates:
PRD.json - Project requirements document.gitignore - Security baseline.env.example - Environment templateralph.config.json - Ralph configurationStart Claude Code with the PRD and begin the RALPH BUILD LOOP.
ralph build # Use PRD.json in current dir
ralph build --prd custom-prd.json # Use custom PRD
ralph build --auto-commit # Auto-commit after each task
Options:
--prd (optional) - Path to PRD file--auto-commit (optional) - Automatically commit after each task--section (optional) - Start from specific section (00_security, 01_setup, etc.)Show current project status and task progress.
ralph status
Shows:
Update PRD task status after manual changes.
ralph update --task SEC-001 --status complete
ralph update --task SEC-001 --comment "Security baseline added"
Run project test suite (language-specific).
ralph test # Run all tests
ralph test --task SEC-001 # Test specific task
Create a commit with task ID (called automatically by ralph build).
ralph commit --task SEC-001 --message "Add .gitignore"
Clean up after project completion.
ralph cleanup # Archive PRD and config
ralph cleanup --full # Remove entire project
Ralph creates PRDs with this structure:
{
"pn": "Project Name",
"pd": "Project description",
"sp": "Starter prompt for Claude Code",
"gh": true,
"ts": {
"language": "Python",
"framework": "Flask"
},
"p": {
"00_security": {
"n": "Security",
"t": [
{
"id": "SEC-001",
"ti": "Create .gitignore",
"d": "Add .gitignore with secrets and dependencies",
"f": ".gitignore",
"pr": "high",
"st": "pending",
"ac": "[x] .gitignore created, [x] .env.example created"
}
]
},
"01_setup": {...},
"02_core": {...},
"03_api": {...},
"04_test": {...}
}
}
Fields:
id - Task identifier (e.g., SEC-001)ti - Task titled - Task descriptionf - File(s) involvedpr - Priority (high, medium, low)st - Status (pending, in_progress, complete, blocked)ac - Acceptance criteria (checklist form)Ralph stores config in ralph.config.json:
{
"project_name": "My Project",
"language": "python",
"prd_path": "PRD.json",
"test_command": "pytest",
"auto_commit": false,
"claude_code_flags": ["--dangerously-skip-permissions"],
"git_user": "name",
"git_email": "email@example.com"
}
Ralph always works in this order:
# 1. Initialize new Python project
ralph init --name "Todo API" --language python
# 2. Edit PRD.json with your specific tasks
# (Ralph adds defaults; customize as needed)
# 3. Start Claude Code with RALPH loop
ralph build --auto-commit
# 4. Monitor progress
ralph status
# 5. When done, review and clean up
ralph cleanup
Ralph auto-detects test commands by language:
Python → pytest
Node.js → npm test
Go → go test ./...
Rust → cargo test
Override in ralph.config.json:
{
"test_command": "python -m pytest --cov"
}
Ralph can create GitHub repos and set up CI/CD:
ralph init --name "Project" --github
This creates:
.github/workflows/test.yml for CI/CDMark tasks that depend on others:
{
"id": "CORE-005",
"ti": "Setup database",
"depends_on": ["CORE-001", "CORE-002"],
"st": "pending"
}
Ralph won't start CORE-005 until CORE-001 and CORE-002 are complete.
# Initialize a new project
ralph init --name "My Project" --language python
# Edit PRD.json with your specific tasks
# Start Claude Code (WITHOUT --dangerously-skip-permissions)
cd ~/Desktop/my-project
claude exec "Follow the RALPH BUILD LOOP. Here's the PRD: $(cat PRD.json)"
# Approve the security prompt when Claude Code asks
# Then let it work through each task
Important: Don't use --dangerously-skip-permissions - it causes Claude Code to get confused. Let it ask for permission normally when needed.
I (Clawd) am in charge of granting permissions during builds. You've indicated you're very tolerant of most operations as long as they:
Philosophy (from you):
"I take safety seriously. I want you to have an eye out for security AND balance good UX/good UI. I don't like security to the point of making user experiences unusable. Security is mostly theater. But the security that isn't theater—like .gitignore and envelopes—that is non-negotiable."
Translation: Optimize for user experience, but NEVER skip the fundamentals:
I will auto-approve safe operations:
I will ask or refuse:
During builds: When Claude Code asks for permission, I'll handle it automatically if it's safe. You focus on the bigger picture while I manage the operational details AND ensure the fundamentals are solid.
Claude Code won't start
claude CLI is installed--dangerously-skip-permissions is supported in your versionTasks aren't committing
git initgit config user.emailTests failing
ralph build --section 04_test