Short answer: I split the work into four phases. Plan first (UI for a feature, logs for a bug), then plan mode with a stronger model. The plan must list small PRs of 200 to 400 lines. Claude Code loops through them, Codex reviews before each PR, Codacy reviews after, everything merges to staging, and Playwright tests it.
Here is the full video if you would rather watch it. It runs about eight and a half minutes.
Watch on YouTube: How I Ship 30 PRs a Day with Claude Code (My Full AI Workflow)
What does the whole Claude Code PR workflow look like?
It is four phases: planning, pre-PR, PR and post-PR. Planning matters most. Everything after it is the AI executing a plan I already agreed with, and checking its own work along the way.
This is the whole loop, start to finish:
- PlanningDecide what you are doing. New feature: have the AI build the UI only. Bug: give it the logs and traces.
- PlanningEnter plan mode with a stronger model. The plan says how many PRs, and what each one does.
- ExecutionSwitch back to Sonnet and start
/loop. It works through the PRs one at a time. - Pre-PRBefore opening each PR, Claude gets a second opinion from Codex.
- PROnce the PR is open, a review tool (Codacy, for me) reviews it. Then it merges to staging.
- Post-PRWhen the batch is merged, deploy staging once. Playwright opens staging and tests the features.
- DoneThe AI fixes what it found, then exits the loop. I look at logs and traces for anything that slipped.
My setup is Claude Code inside VS Code. My everyday model is Claude Sonnet. I don't use the bigger model for building, and the reason is simple: I back Sonnet up with so many tools (a second model, a review bot, browser tests) that it doesn't need to be the most expensive model in the room. The tools cost something too, but they save me far more time than they cost.
How should you start a new feature with an AI agent?
Ask it to build the user interface first, and nothing else. Even a local demo is fine. You want to see the screens before any logic gets written.
I go to Claude Sonnet and say: I'm planning a feature that does X, Y and Z. Build the UI and UX only. Then I open it and click around. The buttons don't work yet. There is no user experience, just the interface.
Then I go back to the model and ask it to tell me what each button will do. Once we agree, we move to plan mode.
How do you fix a bug with Claude Code?
Describe the bug, or take a screenshot of it, and give the AI access to your logs. Without logs it is guessing.
I host on AWS, so I gave my AI access to Amazon CloudWatch Logs, which holds my website's logs. If you use Datadog, same idea. I tell it what is going on and ask it to go check the logs itself.
If the bug is inside an agentic system, where several agents work together on one workflow, logs are not enough. The best tool I've found there is Langfuse. It records traces for your agents, so you can follow the prompts and the hand-offs between them. Give your coding agent access to those traces too. That is how it finds which agent in the chain went wrong.
Why use plan mode with a different model?
Because a good plan is the thing I care about most, and I want the strongest model writing it. Once the UI is agreed or the bug is identified, I ask Claude to enter plan mode and I switch the model to Fable.
When the plan is done, I switch back to Sonnet to build it.
Some people will say I'm wasting tokens. They're right: switching models re-sends the same context, so Sonnet to Fable and back means paying for it again. I don't mind. Execution is the long part. I let my tools run for a long time anyway, and the extra cost of a good plan is small next to the cost of a long execution built on a bad one.
How big should each AI pull request be?
200 to 400 lines of code. Up to 1,000 if it has to be. Never more.
When humans write PRs, we usually land in that 200 to 400 line range. AI tools don't have that instinct. They will write one PR that is thousands of lines long, and nobody reviews that well, human or machine.
So the size limit goes into the planning prompt. I ask something like this:
According to this plan, tell me how many PRs you need to execute it and what each PR will do. Break it into small, focused PRs of around 200 to 400 lines each. Up to 1,000 lines is OK, but don't go beyond that.
When the plan comes back, I know how many PRs it will take and what each one contains. That list is what the loop works through.
How does /loop help you ship faster?
It keeps Claude working through the whole PR list without me prompting each step. Two things help me most in execution: loops and goals.
Once the plan is done, I tell Sonnet to enter execution and start a loop. In Claude Code that is the /loop command. The instruction is: enter the loop and execute these PRs one after the other. Each pass through the loop runs the same review steps below. When everything is merged and tested, I tell it to exit the loop.
How do you review pull requests with AI?
Two separate reviews, by two different tools, at two different moments. One before the PR exists, one after.
Pre-PR: a second opinion from Codex. I use the Codex plugin for Claude Code, which lets Sonnet chat with Codex directly. Before opening each PR, Sonnet checks its work with Codex. You don't need maximum effort for this. Thinking on medium or high is more than enough.
PR: a review bot on every PR. Once the PR is open, the AI tags a review tool. I used CodeRabbit in the past and found it very expensive at my volume. I switched to Codacy. It is a bit cheaper and it has been doing great. GitHub Copilot code review also works. I've used all three. These days it is mostly Codacy, sometimes Copilot.
The point is that the model that wrote the code is not the only one grading it. Then the PR merges into staging, or whatever branch you are working on.
| Phase | What happens | Tool I use | Why |
|---|---|---|---|
| Planning (feature) | Build the UI only, click through it, agree on what each button does | Claude Sonnet in Claude Code | Cheap to change your mind before logic exists |
| Planning (bug) | Screenshot or describe the bug, read logs and traces | CloudWatch, Langfuse | The AI sees evidence instead of guessing |
| Plan mode | Write the plan, split into small PRs | Fable | The plan is where quality is decided |
| Execution | Work through the PRs one at a time | Sonnet with /loop | No prompting each step |
| Pre-PR | Second opinion before the PR is opened | Codex plugin | A different model checks the work |
| PR | Automated review on the open PR, then merge to staging | Codacy (or GitHub Copilot) | Independent review on every PR |
| Post-PR | Deploy staging once, test the features in a browser | Playwright | The AI sees what it built and fixes it |
Why merge to staging and deploy only once?
Because every deploy runs GitHub Actions, and GitHub Actions minutes are billed. At around 30 PRs a day, a deploy per PR gets expensive.
I keep a staging branch and a production branch. The AI merges each PR into staging, one by one, without deploying. When the whole batch is merged, staging deploys once.
How do you run several Claude Code sessions at the same time?
One git worktree per session. A worktree is a copy of your code in a separate folder, so each AI works in its own folder and they don't step on each other.
I open multiple tabs, one per feature, and tell each Claude instance: other Claude Code instances are working on this repository, so create your own worktree and work there. With that, I can move two, three, four or five features forward at once. The Claude Code docs have a section on running parallel sessions with worktrees if you want the setup details. I wrote more about the rules I give parallel agents in running several Claude Code agents.
How does the AI test its own work?
After staging deploys, I ask the AI to open Playwright, go to the staging site and test the features it worked on.
This step matters more than it sounds. Now the AI can see what it built and how it behaves in a real browser, which gives it the ability to correct itself. Then it exits the loop.
Where does the human come in?
Mistakes still happen, even with all of this. My job is to look at the traces and the logs, understand where a mistake came from, and fix the process so it doesn't happen again.
Here is the checklist I run through for every feature:
- Feature or bug? UI first for a feature, logs and traces for a bug.
- Plan mode with the strongest model, then back to the everyday model.
- The plan lists every PR and what it does, 200 to 400 lines each, never past 1,000.
- Its own worktree, if other sessions are on the same repo.
/loopthrough the PRs one at a time.- Codex second opinion before each PR.
- Codacy or Copilot review on each open PR.
- Merge to staging, deploy once at the end.
- Playwright tests staging, the AI fixes what it finds, then exits the loop.
- I read the logs and traces for anything that still went wrong.
The AI does the typing and most of the checking. Deciding what to build, and noticing when the system itself is wrong, is still on me.
If you are new to building with AI, my courses start from the basics. I also talk about building in healthcare with founders on the Delta: HealthTech Innovators podcast.
Frequently asked questions
I ask for 200 to 400 lines of code per PR, which is roughly what a human engineer writes. Up to 1,000 lines is acceptable, but never more. Left alone, AI tools will happily write a single PR thousands of lines long, and nobody, human or AI, reviews that well. I put the limit in the planning prompt so the plan itself is split into small PRs.
I build with Claude Sonnet in Claude Code inside VS Code, because I surround it with so many review and testing tools that a cheaper, faster model is enough. For plan mode only, I switch to Fable, then switch back to Sonnet to execute. Switching re-sends the context to the other model and costs tokens, but a good plan is worth it.
Twice. Before the PR is opened, Claude Code asks Codex for a second opinion through the Codex plugin, with thinking set to medium or high. After the PR is opened, a separate review tool reviews it. I mostly use Codacy, and sometimes GitHub Copilot. I used CodeRabbit before but found it too expensive for my volume.
Because every deploy runs GitHub Actions, and GitHub Actions minutes cost money. With around 30 PRs a day, a deploy per PR adds up fast. I have the AI merge each PR into the staging branch without deploying, then deploy staging once when the batch is done. Production is a separate branch.
Each session gets its own git worktree, which is a separate folder with its own copy of the code. I open several tabs and tell each Claude Code instance that other instances are working on the same repository, so it must create and work in its own worktree. That way two or more features move forward at once without the sessions overwriting each other.