Skip to content

Instantly share code, notes, and snippets.

@markphelps
Created January 6, 2026 15:17
Show Gist options
  • Select an option

  • Save markphelps/07fbcda50c3b99de491495d1dfa4f929 to your computer and use it in GitHub Desktop.

Select an option

Save markphelps/07fbcda50c3b99de491495d1dfa4f929 to your computer and use it in GitHub Desktop.
Ralph.sh with DevContainers and improved error handling
set -e
if [ -z "$1" ]; then
echo "Usage: $0 <iterations>"
exit 1
fi
i=1
while [ $i -le $1 ]; do
echo "Iteration $i"
echo "--------------------------------"
echo "Running claude command..."
if ! result=$(claude --dangerously-skip-permissions -p "@docs/specs/prd.json @progress.txt \
1. Find the highest-priority feature to work on and work only on that feature. \
This should be the one YOU decide has the highest priority - not necessarily the first in the list. \
2. Check that the types check via pnpm typecheck and that the tests pass via pnpm test. \
3. Update the PRD with the work that was done. \
4. Append your progress to the progress.txt file. \
Use this to leave a note for the next person working in the codebase. \
5. Make a git commit of that feature. \
ONLY WORK ON A SINGLE FEATURE. \
If, while implementing the feature, you notice the PRD is complete, output <promise>COMPLETE</promise>. \
" 2>&1); then
echo "ERROR: Claude command failed with exit code $?"
echo "Output: $result"
exit 1
fi
echo "$result"
if echo "$result" | grep -q "<promise>COMPLETE</promise>"; then
echo "PRD complete, exiting."
exit 0
fi
i=$((i + 1))
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment