Pair Programming Patterns with AI
Humans and AI work best together when it's clear who's driving and who's navigating โ and when you step in.
Driver and navigator
Classic pair programming gives us an image that fits working with AI too: one person "drives" (writes/executes), the other "navigates" (thinks along, corrects, keeps the big picture). With an agent, you usually flip that role: the agent drives (writes the code), you navigate (set direction, correct early).
Plan, review, execute
A proven pattern has three phases: have a plan created first (no code yet), read and correct the plan, only then have it implemented. That stops the agent from writing a lot of code for the wrong solution.
When to step in
Step in as soon as you notice things heading the wrong way โ not only at the end. If you've had to correct the same mistake twice, a restart with a more precise prompt usually beats a third correction.
Feedback loops
The shortest loop is the best one: the agent takes a step, you (or a second agent) check it, feedback goes back, next step. That applies to code just as much as to reviews โ a fresh look from someone who didn't write the solution themselves catches more.
EXAMPLE
Workflow for a new feature: 1) 'Explore how we currently handle sessions, and read the relevant files. No code yet.' 2) 'Create a plan for Google OAuth login.' โ read the plan, cut a step that's too big. 3) 'Implement the plan, write tests for the callback.' 4) 'Use a subagent and review the diff against the plan โ report gaps, not style preferences.'
๐ ๏ธ EXERCISE โ TRY IT YOURSELF
Practice the plan-review-execute workflow on a small real task in your project.
- Pick a small but non-trivial task (e.g. a new form field with validation).
- Have only a plan created first, no code: 'Create a plan in 3-5 steps, no code yet.'
- Read the plan, deliberately correct at least one step, then have it implemented step by step.
โ SELF-CHECK
- โ Did you actually correct a step in the plan before any code was written?
- โ Is the finished code closer to what you actually wanted than if you'd just said 'build X' right away?
- โ Where would you have needed to step in if you hadn't read the plan?
QUICK QUIZ
What's the core benefit of splitting planning and implementation into separate steps when working with an agent?
SOURCES
- Claude Code Docs: Best Practices (Explore, plan, code, commit) โ code.claude.com
- Claude Code Docs: Permission Modes โ code.claude.com
- Claude Code Docs: Subagents โ code.claude.com