Your Claude Code agent cannot create a bill.
Spend Guard is a Claude Code plugin. Every shell and MCP call passes one hook before it runs. Anything that creates a billable cloud resource is refused. Anything outward or hard to undo (a deploy, a publish, a push to main, a migration, a payment write) stops and asks you.
Buy for $19, once
Card or Apple Pay through Square. You get access to the private repository within 24 hours.
What it catches
| Refused | wrangler d1 create, aws ec2 run-instances, aws s3 mb, gcloud ... create, az ... create, terraform apply, pulumi up, cdk deploy, fly launch, heroku addons:create, supabase projects create, MCP create_project and *_database_create |
|---|---|
| Asks you | wrangler deploy, vercel --prod, npm publish, git push origin main, git push --force, supabase db push, prisma migrate deploy, kubectl apply, MCP apply_migration, deploy_* and payment writes. In bypassPermissions mode nobody can be asked, so these are refused too. |
| Runs | Everything else: tests, builds, git push to a feature branch, terraform plan, list and describe calls. |
Why it is not a regex in your settings file
It judges the command each segment runs, not the text, so a commit message that mentions terraform apply passes. It sees through &&, pipes, subshells, $(...), bash -c, eval, npx, sudo and quote splitting such as wr"an"gler. And it fails closed: Claude Code lets a call through when a hook crashes with any exit code but 2, so every error path here exits 2. A broken config blocks rather than widens.
It came from running Claude Code unattended on a production SaaS held to a zero-dollar infrastructure budget. 12 test groups cover the rules, the laundering cases and the real hook process.
Install
/plugin marketplace add <your-invite>/spend-guard /plugin install spend-guard@spend-guard
Add your own rules or allow an exact command in .claude/spend-guard.json.
What it cannot do
It is a string matcher in front of the tool call, not a sandbox. A command assembled at runtime, a script that provisions resources when run, or a CLI it has no rule for can get past it. Keep billing alerts and spend caps on at your providers. It stops the commands agents actually write.
License: use on any machines you or your company use, any number of projects. No redistribution. Questions or a refund within 14 days: reply on the post you found this through.