AI Shipping Labs launched - early members get extra onboarding benefits.Read more
Back to Blog

Experiments with Claude Code: Slash Commands and Persistent Coding Loops

I built funny projects with custom Claude Code slash commands (/kid and /parent), then explored stop hooks, the Ralph Wiggum plugin, and a Python-based continue loop to keep Claude coding continuously.

Alexey GrigorevJanuary 9, 20264 min read
aiclaude-codeslash-commandspersistent-coding-loops

A few weeks ago I came across Claude Life Assistant, “a personal coach that lives in your filesystem”. I looked at the Quick Start and wondered, “What are these commands?”

So I decided to figure it out.

I discovered that these commands are defined in a very simple way: you add a markdown file to the .claude/commands folder and describe what the command should do, in plain text.

Kid and Parent commands

Out of curiosity, I created a new project two commands: /kid and /parent.

The kid comes up with a completely random, often absurd project idea. The parent takes that idea and implements it in HTML+JavaScript. Then the process repeats: kid asks, parent builds.

I asked Claude to run this in a loop, and as a result, it created a lot of funny projects. Here’s the repository with the code.
There are now more than 25 projects. Most of them are standalone HTML files with embedded CSS and JavaScript. There are no external dependencies. You can open the HTML files directly in a browser. Of course, I published it as GitHub Pages.

Other projects: Invisible Pet Walker with awkwardness meters, a Sneeze Simulator with randomized power levels, a Garden of Weird Plants with personalities, a Silly Symphony built on the Web Audio API, and a Robot Chef that invents bizarre dishes.

Ralph Wiggum: Running Claude Code Forever

I asked Claude to run the /kid and /parent commands forever. But it didn’t. After a few iterations, it stopped, so I had to ask it to continue repeatedly.

I wondered whether I could make it run without my involvement. The answer is yes: with stop hooks. I got very excited, and copied the example from the docs, only to find out that the documentation was outdated and the prompt hooks didn’t work.

Eventually I found the plugin called “Ralph Wiggum”. That’s a boy from The Simpsons (the son of the police chief) who’s “persistent despite setbacks”. It automatically prompts Claude to continue when it stops.

Ralph Wiggum is “the future of AI coding”, according to some YouTubers (I haven’t checked the video though)

Use the /plugin command to install it:

/plugin install ralph-wiggum

And now you run it:

/ralph-wiggum:ralph-loop "prompt"

I tested on another project: a metabolism simulator. I want to know how metabolism in the human body works, so I thought a simulator would help me understand this topic better.

I gave it an initial prompt, asked it to plan the app, and then activated the loop:

Sadly, Ralph stops on my computer. It’s implemented as a Bash command (without prefixing it with “bash”), and it wouldn’t execute properly on Windows.
Claude saying that the Ralph loop will continue - but it’s not doing anything

But if you’re on Mac or Linux - it should work.

My Own Ralph with Python

But I thought “what if I implemented it with Python?”

Nano Banana made Ralph pet a python

And it worked! Steps:

  • Create a stop hook in .claude/settings.json with type command and command python .claude/continue-hook.py
  • Add continue-hook.py and continue.md to the .claude folder
  • If you want to stop the loop, remove or rename continue.md

See the code here.

Another problem: Claude Code sometimes fails and exits with an error. I don’t know why it happens.

Claude Code exiting with error after almost 6 hours of non-stop working

To fight it, I created a script that continues running it after it stops, so it can run indefinitely (until my Windows decides to install an update and reboot).

After a few days it created a nice-looking website with a lot of features. Not everything worked but I’m sure it’s fixable. Here’s what it created:

It’s a fun idea, but I wouldn’t let it run loose on any of my real-life projects. I want to steer it in the right direction and force it to follow the best engineering practices. At times it’s very sloppy and lazy: instead of fixing a test, it may simply delete it “because it’s an existing regression”.

I used Claude Code (without the Ralph loop) for a few other projects, and I switched from Opus to GLM-4.7 from Z.ai. I’ll write more about my experience with Claude Code in the next posts.