skills/ralph-loop/SKILL.md
Autonomous coding workflow using Claude in a bubblewrap sandbox with iterative execution. Use when the user mentions a ralph loop, setting up a ralph loop, or designing prompts for autonomous work.
npx skillsauth add MoonBoi9001/claude-code-cli-tools ralph-loopInstall 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.
The ralph loop is an autonomous coding workflow where Claude runs iteratively inside a bubblewrap sandbox with --dangerously-skip-permissions. Each iteration Claude reads a prompt and progress file, does work, commits changes, and continues until done. The goal isn't to finish in one cycle -- it's to force Claude to keep iterating on a task until completion reaches an exceptional standard.
The loop infrastructure comes from claude-tools, which provides two scripts that should be installed on PATH:
loop -- The orchestrator. Runs Claude iteratively in a sandbox, pipes output through clox for real-time viewing, and manages iteration state. Supports two prompt modes: -f <prompt-file> for a raw prompt file, or -s <file> to have Claude study task files (repeatable). Accepts -n for max iterations (default 20) and -d for a custom state directory. The loop exits when Claude creates a stop file, max iterations are reached, or Claude errors.
sandbox (symlinked to sandbox/bubblewrap) -- The bubblewrap wrapper. Creates an isolated environment with read-only system directories, read-write access to the current git repo, isolated PID namespace, resource limits via prlimit, and a clean environment. Detects the git root automatically, handles git worktrees, and works with any repo. Network stays shared (needed for package managers).
clox is a required dependency -- a TUI viewer that renders Claude's JSON stream output in real-time so you can watch it work, or review past sessions offline.
Usage examples:
loop -f PROMPT.md # Run with a prompt file
loop -f PROMPT.md -n 10 # Cap at 10 iterations
loop -s PLAN.md # Study a plan file, work through tasks
loop -s PLAN.md -s SPEC.md # Multiple study files
touch target/loop/stop # Stop early
clox target/loop/iter-0.json # Review a past iteration
Everything needed to run ralph loops is already installed:
| Tool | Location | Notes |
|------|----------|-------|
| claude | ~/.local/bin/claude | Native installer, not npm global |
| clox | ~/.local/bin/clox | Pre-built binary |
| bwrap | /usr/bin/bwrap | System package |
| loop | ~/.local/bin/loop | Symlink to ~/claude-tools/bin/loop |
| sandbox | ~/.local/bin/sandbox | Symlink to ~/ralph-loop/sandbox.sh (Ubuntu-adapted, has npm cache + NODE_OPTIONS) |
| node | /usr/local/bin/node | v24, installed via npx n lts |
| npm | /usr/local/bin/npm | v11 |
| cargo | ~/.cargo/bin/cargo | For building Rust tools if needed |
AppArmor: A profile at /etc/apparmor.d/bwrap grants bubblewrap permission to create unprivileged user namespaces (Ubuntu 24.04 restricts this by default).
PATH in login shell: ~/.local/bin:~/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin. Non-interactive SSH shells won't source the profile, so always use bash -l -c "..." or run scripts from an interactive session.
Do NOT reinstall claude, clox, bwrap, node, or npm. They are already present and working. If a non-interactive SSH check reports them missing, it's a PATH issue -- verify with bash -l -c "which claude".
OAuth token expiry: Tokens expire periodically and headless mode (-p) cannot refresh them. Refresh interactively: SSH into the server, then run claude > /login > /exit. Verify with claude -p "say hello". Must be done outside sandbox since ~/.claude.json is mounted read-only.
Custom scripts: ~/ralph-loop/ contains the Ubuntu-adapted sandbox (sandbox.sh, symlinked as sandbox on PATH) and a project-specific loop.sh with post-iteration verification and auto-deploy. The generic loop from claude-tools is preferred -- verification logic belongs in the prompt instead.
PROMPT.md in the project root -- the task description Claude reads each iteration. Should instruct Claude to read PROGRESS.md, do work, commit, update progress, verify (build/lint/test), and signal completion by creating target/loop/stop.PROGRESS.md -- tracks what's been done across iterations. Claude reads this at the start of each cycle to know where it left off.git push, then ssh <user>@<server> and cd ~/ProjectName && git pull.nohup, &, or backgrounded SSH commands -- clox is a TUI that requires a real terminal and will fail with "Failed to enable raw mode" if stdout is not a TTY. Use: tmux new-session -s ralph "cd ~/ralph-loop && ./loop.sh -n 20". The loop script auto-detects whether a TTY is present and skips clox if not, but you lose the real-time rendering.ssh <user>@<server> -t tmux attach -t ralph. Check target/loop/progress.txt for timing. Create target/loop/stop to halt early.target/loop/iter-N.json, viewable with clox target/loop/iter-0.json.Verification logic belongs in the prompt, not the loop script. This keeps the loop generic and lets Claude adapt verification per-project. A good prompt should:
PROGRESS.md first to understand current statePROGRESS.md with what was accomplishedtarget/loop/stop when all work is completeDescribe what the feature should do and why, not how. Claude follows instructions literally -- specifying an exact file to edit prevents it from considering a cleaner structure. Provide architectural context, leave implementation open, but keep real constraints explicit (don't bundle images, keep the dark theme, etc.).
Without explicit instruction, Claude might incorrectly batch all work into one commit. Prompts should instruct it to commit after each logical unit of work -- one per sub phase, feature, or milestone. A 6-phase prompt should ideally produce more than 6 commits.
Build success, linting, and passing tests are necessary but insufficient -- they say nothing about runtime correctness. Prompts should include a QA step that verifies actual output: browser testing for frontends, curl/httpie for APIs, manual invocation for CLIs, etc. Use MCP tools (browser automation, HTTP clients) when available. At minimum, instruct Claude to exercise changed functionality and verify results before marking a phase complete.
testing
Bring a branch up to date with its base by MERGING the base in (a merge commit), never rebasing — so no commit hashes are rewritten and no force-push is needed. Use this whenever the user asks to "use the merge skill", "bring my branch up to date", "merge main/the base into this branch", "update my branch from its base without rebasing", "do a merge commit instead of rebasing", or "clear the conflict on my stacked PR without a force-push" (a common situation right after a parent PR squash-merges and the child branch suddenly shows conflicts). It handles both cases: a base that only re-packaged work the branch already has, and a base that carries genuinely new work to fold in. It always verifies the merge preserved exactly the branch's own change before pushing. This is an explicitly-invoked workflow — reach for it when the user talks about merging or updating a branch from its base, but don't hijack unrelated git merges.
development
Run a deep multi-agent review of a GitHub PR — 6 specialized agents covering architecture, correctness, security, tests, code quality, and integration. ONLY trigger when the user's message contains the explicit phrase 'deep review' (e.g. 'deep review this PR', 'deep review PR #1234', 'do a deep review of 1234', '/deep-review'). Do NOT trigger on bare 'review', 'review this', 'review the PR', 'code review', 'what do you think of this PR', or pasted PR URLs without 'deep review' in the message — those are handled by the lighter /review skill. The literal phrase 'deep review' must appear in the user's message; absence of that phrase means do not invoke this skill.
data-ai
--- name: re-explain description: Re-explain a concept from the ground up when an earlier explanation didn't land. Trigger aggressively whenever the user signals confusion about recent technical content — phrases like "i don't get it", "from scratch", "ground up", "explain again", "this makes no sense", "try again", "you need to work better", "what's X" (where X was something just mentioned), or invoking /re-explain directly. Also trigger on quieter cues like the user re-quoting a phrase from th
development
Load a high-fidelity recap of a prior Claude Code session into the current session's context. The goal is to be LESS lossy than running /compact would be — the user is invoking this skill precisely because /compact discards detail they need. Use this when the user wants to "resume", "pick up", "continue", or "load context from" a previous session — especially a long one (hundreds of thousands of tokens) where actually resuming the session would be prohibitively expensive, or where the session was auto-compacted mid-flow and a lot of detailed work happened after the last compaction that another /compact pass would crush. Also trigger on phrases like "recap the last session", "what was I working on yesterday", "load the prior chat", or "/load-prior-session". The skill extracts via a subagent so the full transcript never enters the current session's context.