My Easy Claude Code Passive Income AI Automation Setup
I have been quietly building out a portfolio of small Claude Code automation loops that each generate a little passive income. None of them is a goldmine. But stack ten of them and the numbers start to matter — and the marginal cost of adding the next one is basically zero. Today I want to share the simple pattern I use for all of them, and walk through one real example end to end.
Watch the video:
The Pattern: Skill + While Loop + Sleep
The whole setup boils down to three pieces:
- A Claude Code skill — a markdown file describing the steps to take
- A while-true loop in bash that calls
claude -p "/skill-name" - A sleep between iterations
That is the whole framework. The bash command is literally:
while true; do
claude -p "/auto-kalshi"
sleep 60
done
If you have a Claude Code skill called auto-kalshi, this triggers it every 60 seconds in a loop. Headless, unattended, runs forever (or until you ctrl-C). This is the same headless primitive I covered in detail in my headless AI agents post — the -p flag is the unlock.
The Real Example: Kalshi Market Bug Bounty
One of my loops monitors the Kalshi prediction market for bug bounty opportunities. Their bounty program pays:
- $25 for minor bugs
- $50 for moderate
- $100 for severe (rare)
- $10 extra for pre-listing finds
The skill is called auto-kalshi. It scans new prediction markets for bug-bounty-worthy patterns. When it finds something, it sends an email to Kalshi support with the report. Fully autonomous. This loop nets me roughly $100-$200/week on average. Some weeks more, some weeks nothing — but the cost of running it is zero (I am on the Claude Max plan, and the loop runs on a dedicated Mac mini).
The skill itself is just a structured Markdown file: step one — check for new market batches; step two — claim the log; step three — group by event; and so on through a checklist. Claude reads it on every loop and follows the steps in order.
How to Build Your Own Loop in 10 Minutes
Let me walk through a fresh example I built in the video: a daily Hacker News digest emailed to me. Here is how to set this up from zero.
Step 1: Create the skill
In Claude Code, prompt:
"Fetch docs for Anthropic Claude Code skills, then create a placeholder for our auto-mail skill."
Claude will create .claude/skills/auto-mail/SKILL.md with a template. Restart Claude Code and run /skills to confirm it is recognized.
Step 2: Define what the skill does
Inside that SKILL.md, write the steps you want executed. For my Hacker News example:
For the auto-mail skill, set up step-by-step automation of getting the top 5 Hacker News posts sent to my email using send_report. The token.json is in the project root for Gmail auth. Step 1: fetch top 5 posts, store in news.json. Step 2: send the email with the post URLs. Understood?
Claude builds out the supporting Python scripts (fetch_hn.py, send_report.py) and wires them into the skill. The skill becomes the brain that runs them in order.
Step 3: Wrap it in a while loop
Outside Claude Code, in a separate terminal:
while true; do
claude -p "/auto-mail"
sleep 3600
done
3600 seconds = once an hour. Adjust to taste. For some loops 60 seconds is right; for daily loops use a cron job instead so you don't waste cycles.
Step 4: Allow the bash commands
One gotcha: in Claude Code's settings.json, you need to allow the bash commands the skill calls (e.g. python fetch_hn.py, python send_report.py) so the loop runs without permission prompts. Once that is in place, the loop runs unattended forever.
Why This Stays Within Anthropic's Terms
One important thing: this approach uses Claude Code's -p flag, which is a fully supported, first-class feature. Some third-party setups (like piping Claude's session through opencode for automation) have run into terms-of-service issues. The claude -p + skill combination is the sanctioned path. You stay on your Claude Max subscription, you stay supported, you avoid surprises.
Stacking Loops
The reason this matters is that you can stack many of these. I have one for the Kalshi bounty, several for content automation, the iOS app pipeline (covered in my iOS apps post), and several others. None of them is huge. Some make $20/week. Some make $300. A couple lose money and get retired. But the discovery cost of "try a new loop" is one afternoon.
This is the same "agents are basically free" insight that powers the 3-part automation framework. Once individual agent runs cost effectively zero, you stop optimizing per-loop and start optimizing per-portfolio.
Resources
- My GitHub — repos and code samples.
Leave a comment on the video if you want a follow-up that shows more of my actual loops in detail. I have a backlog of these I have not shared yet.