How I Made Claude Code Do Its Own Deployments
Most developers use AI assistants to write code, then manually run migrations, deploy functions, and push to production. That's leaving 40% of the workflow on the table.
I fixed that. Now when I ask Claude to add a feature, it writes the code AND deploys it. The entire backend-to-production loop happens in one conversation.
This is the difference between using AI as a typing assistant and using AI as an operator.
The Problem
Here's what my workflow looked like before:
- Ask Claude to implement a feature
- Claude writes migration file
- Claude says: "Now run
supabase db push --linked" - I copy the command, open terminal, run it
- Claude writes edge function
- Claude says: "Deploy with
supabase functions deploy agent-think" - I copy, paste, run
- Repeat for web, iOS, etc.
I was the bottleneck. Claude had to wait for me to context-switch, copy commands, run them, paste output back. It broke flow. It was slow.
The insight: Claude already knows the commands. Why am I the one running them?
The Fix: A Single Source of Truth
I created SOP.md (Standard Operating Procedures) — one
document that tells Claude exactly how to operate in my codebase.
The key sections:
1. Default Behaviors
Things Claude does automatically without asking:
| Action | Tool/Command |
|---|---|
| Database migrations | supabase db push --linked |
| Edge function deploy | supabase functions deploy <name> |
| Web deploy | vercel --prod |
| Migration repair | supabase migration repair --status reverted <id> --linked |
This isn't just documentation. It's permission. Claude reads this and knows: "I can run these commands. I don't need to ask."
2. Tool Access Map
Explicit about what requires human intervention:
| Action | Claude Can Do | Needs Me |
|---|---|---|
| Supabase migrations | Yes | |
| Supabase edge functions | Yes | |
| Supabase secrets | Yes (dashboard) | |
| Vercel deploy | Yes | |
| iOS TestFlight | Yes (Xcode) |
Claude knows when to stop and when to proceed.
3. Decision Trees
What to do when things break:
Error: "Remote migration versions not found"
→ Run: supabase migration list --linked
→ Find orphaned remote IDs
→ Run: supabase migration repair --status reverted <id> --linked
→ Retry: supabase db push --linked This happened today. Instead of me debugging, Claude diagnosed and fixed the migration history mismatch on its own.
Real Example: The Session That Made This Clear
I asked Claude to implement a comprehensive notification system. Here's what happened:
Me: "Implement granular notification preferences — let users toggle morning briefing, afternoon check-in, proactive nudges separately."
Claude:
- Created migration file with new columns
- Ran
supabase db push --linked - Hit migration history error
- Diagnosed: orphaned remote migrations
- Ran
supabase migration repairtwice - Re-ran migration successfully
- Updated edge function
- Deployed edge function
- Created iOS service
- Created iOS settings view
- Updated web app
All in one conversation. I watched. That's it.
Total human intervention: zero commands typed.
What Makes This Work
1. Explicit Permission
Claude is cautious by default. If you want it to deploy to production, you have to say so clearly. The SOP document is that explicit permission.
2. Context That Persists
The SOP lives in the repo as SOP.md. Claude reads it at the
start of every session. The context carries forward.
3. Failure Handling Documented
Most "let Claude do it" setups fail at the first error. By documenting decision trees for common failures, Claude can self-recover.
4. Clear Boundaries
"Deploy edge functions: yes. Create Supabase secrets: no." When boundaries are clear, Claude operates with confidence inside them.
The Full SOP Structure
Here's what ended up in the document:
- Default Behaviors — Things Claude does automatically
- Tool Access Map — What Claude can/can't do
- Workflows — Step-by-step for features, bugs, deploys
- Decision Trees — Error recovery paths
- Tech Stack — Where everything lives
- Design System — UI principles (absorbed from existing docs)
- Quality Gates — Checklists before "done"
- Patterns — Learnings from previous sessions
Total: ~400 lines. One file. Single source of truth.
Results
Before: Feature requests took 2-3 back-and-forth sessions. I'd forget to deploy something. Things would break in production hours later.
After: Feature to production in one conversation. Claude handles the full loop. I review what shipped.
Time savings: Hard to measure, but context-switch elimination alone is probably 30-40% of my previous workflow.
Error reduction: Claude doesn't forget to deploy. I do.
The Meta-Lesson
This is what "AI-native workflow" actually means. Not using AI to type faster. Using AI to operate.
The companies winning right now aren't the ones with the best AI code generators. They're the ones who've figured out how to let AI handle the entire shipping loop.
Migrations. Deployments. Error recovery. All of it.
If you're still copy-pasting commands from Claude's output, you're leaving most of the leverage on the table.
Try This
- Create an
SOP.mdin your repo - Start with three sections:
- Default Behaviors (what Claude can run)
- Tool Access Map (what requires you)
- One Decision Tree (your most common error)
- Tell Claude to read it at session start
- Watch what happens
The leverage is real.
Code
The full SOP template is available in the project repo. Adapt it for your stack.