DEV Community

Cover image for Pair programming with AI: roles for humans and assistants
Sascha Mirow-Stanitzok
Sascha Mirow-Stanitzok

Posted on Originally published at sascha-ms.de

Pair programming with AI: roles for humans and assistants

Pair programming with AI sounds like simple math: if a coding assistant is already reading along, suggesting code and answering questions, why bother with a second person at the screen? Some tools even advertise exactly that and call themselves an “AI pair programmer”. For teams that have only just managed to introduce pairing, that is a tempting shortcut.

I care about this question both as a developer and as a team lead. As a developer, because AI assistants are a fixed part of my working day and it is convenient to simply hand them the role of the thinking partner. As a manager, because I see pairing mainly as a team tool: spreading knowledge, sharing responsibility, learning from each other. My article on remote pair programming covered roles, timers and rotation between two people. This one adds a third seat at the table and asks who should actually sit there.

In short

An AI assistant does not replace the second human in pair programming, but it can be a very good third seat at the table. It works best when the pair steers it together and checks every suggestion out loud. The biggest pitfall: one person types and prompts while the other just watches.

What you will learn in this article

  • Which benefits of pairing an AI assistant covers and which it does not
  • How to split driver, navigator and assistant sensibly
  • How a pairing session with AI works step by step
  • How to tell when the assistant is pushing the pair aside
  • What managers can do without mandating AI pairing

What is pair programming with AI?

In classic pair programming, two people work on the same task at the same time. The driver has the keyboard and takes care of the next small step. The navigator thinks ahead, keeps the goal in view and reviews the code as it is written. Both switch roles regularly.

An AI assistant is a tool such as GitHub Copilot, Claude Code or Cursor that is built on a large language model (LLM). It comes in three forms: as suggestions directly in the editor, as a chat with access to the code, and as an agent that changes files, runs commands and starts tests on its own. In this article, pair programming with AI means any way of working in which such an assistant deliberately gets a role in pairing. In practice you can distinguish three setups.

Setup Who steers? Good for Biggest risk
One person with an assistant One human, the assistant contributes Routine work, research, prototypes Nobody really questions the suggestions
Two people with an assistant The pair together New features, tricky code, onboarding One person takes keyboard and prompts, the other becomes a spectator
Whole team (mob) with an assistant The group, one driver types Architecture spikes, learning together Debating prompts instead of the problem

The first variant is what marketing calls an “AI pair programmer”. It is useful, but it is not pairing in the real sense. The second and third variants are where it gets interesting for teams, and they are what the rest of this article is about.

Which benefits of pairing an AI assistant covers

In a 2023 piece on martinfowler.com, Birgitta Böckeler of Thoughtworks sorted the benefits of pair programming into five groups and checked, for each one, how much a coding assistant can take over. Her answer is sobering: only a small part. I find this breakdown helpful because it turns a gut-feeling debate into a list a team can discuss. The table sums it up in my own words.

Benefit of pairing What the assistant contributes What stays with the humans
Two people know more than one Explains frameworks and APIs, helps when you are stuck, speeds up routine code Knowledge of the domain, the history of the code and everything that is not written down anywhere
Focus and flow Removes small hurdles such as syntax or boilerplate Keeping each other from drifting off, sticking with it together
Avoiding waste Little, mostly indirectly through faster drafts Spotting mistakes and unnecessary work early, together
Integrating frequently Little Shorter review paths, because two people already know the code
Practicing team skills Nothing Communication, feedback, empathy, slicing work together

Why tacit knowledge makes the difference

The most important point is in the first row. A language model only knows what is in the code, in the documentation or in the prompt. Why a field is called “legacyStatus”, which department gets nervous about which change and which approach already failed a year ago: it has no idea. Exactly this knowledge moves from head to head as a side effect of pairing. That is why an assistant helps you get into a technology, but hardly helps you get into a team.

Shared responsibility for the code

Pairing also creates something that is hard to measure: two people feel responsible for the code and can explain it later. If one person writes code alone with their assistant, exactly one human knows that code at the end. For the bus factor in your team, that is a step backwards.

I share Böckeler’s conclusion: do not play the assistant off against pairing, use it inside the pair. Two people catch the typical weaknesses of AI suggestions much better than one, for example invented APIs, outdated patterns or code that runs but does not fit the rest.

Roles in pair programming with AI

As soon as an assistant joins in, the pair needs a new agreement: who talks to the AI, and who decides what gets accepted? Without that agreement, both end up with the driver and the navigator slides into a spectator role. I consider the following split sensible.

Diagram: the driver gives the assistant short tasks, suggestions come back, driver and navigator decide together

Driver, navigator and assistant: the pair decides, the assistant only makes suggestions.

Driver: types and writes the prompts

The driver stays at the keyboard and talks to the assistant. One rule seems silly at first but matters: every suggestion is read out loud, or at least summarized out loud, before it is accepted. Only then can the navigator think along at all. Long agent runs in which the assistant changes files for minutes are rarely a good idea when pairing. Short tasks with a clear result fit the rhythm of two people better.

Navigator: holds the goal and has the final say

The navigator checks every suggestion against three things: the goal of the session, the existing architecture and what the team has agreed on. Together with the driver, the navigator decides whether a suggestion is accepted, adjusted or thrown away. In remote sessions, the navigator can use the assistant’s chat on their own machine for research, for example to look up an error message while the driver keeps typing. That is a good division of labor as long as the navigator brings the results back into the conversation instead of disappearing into a separate world.

Assistant: delivers drafts, decides nothing

The assistant is the third seat at the table. It suggests code, tests and explanations, it researches and it phrases alternatives. It has no vote on decisions. This boundary sounds obvious, but it blurs quickly when a suggestion looks good and both people are tired.

Strong-style with AI for beginners

In strong-style pairing, the experienced person navigates and the less experienced person types. Every idea has to pass through the other person’s hands. With an assistant, I add one rule: an AI suggestion is only accepted once the driver can explain it in their own words. That costs time at first, but it prevents juniors from turning into copy machines that wave through code they do not understand.

Step by step: a pairing session with an AI assistant

To keep this concrete, here is a complete flow for a session of about two hours. The example is a made-up library app: the pair is supposed to build a function that lets readers extend the loan period of a book.

Prerequisites

You need an editor with an AI assistant, a way to work on the code together (screen sharing or a tool like Visual Studio Live Share), a timer and a repository with working tests. A file with project context for the assistant also helps. My article on AGENTS.md shows what such a file looks like.

1. Set a goal and a stop criterion

Take five minutes and write down the goal in one sentence, for example: “A loan can be extended once by 14 days, but not if the book is reserved.” Also agree on when you stop and re-plan, for instance if you do not have a green test after 45 minutes.

2. Prepare context for the assistant

Check together whether the assistant knows the most important rules of the project. A short section in the context file is often enough:

# AGENTS.md (excerpt)
## How we work when pairing
- Suggest small steps, at most one function or one test at a time.
- Do not change files outside src/loans/ without asking.
- Use the existing error classes from src/errors.ts instead of new exceptions.
- For every suggestion, explain in two sentences why you built it that way.
Enter fullscreen mode Exit fullscreen mode

3. Agree on roles and a timer

Start with 20 minutes per round. When you switch, not only the keyboard changes hands but also the right to talk to the assistant. That way you both learn to write good instructions, and nobody becomes the permanent prompter.

4. Start with a test

A variation of ping-pong pairing works well here. Person A writes a failing test, person B has the assistant suggest the implementation, and person A reviews the result. Then you switch. The test captures what the humans want, and the assistant only delivers the how. A first test for our example could look like this:

// src/loans/extend.test.ts
import { describe, expect, it } from 'vitest';
import { extendLoan } from './extend';

const loan = {
  bookId: 'b-42',
  dueOn: new Date('2026-12-01'),
  extensions: 0,
  reserved: false,
};

describe('extendLoan', () => {
  it('extends a loan by 14 days', () => {
    const result = extendLoan(loan);
    expect(result.dueOn).toEqual(new Date('2026-12-15'));
    expect(result.extensions).toBe(1);
  });

  it('rejects the extension if the book is reserved', () => {
    expect(() => extendLoan({ ...loan, reserved: true })).toThrow(/reserved/);
  });

  it('allows only one extension', () => {
    expect(() => extendLoan({ ...loan, extensions: 1 })).toThrow(/already extended/);
  });
});
Enter fullscreen mode Exit fullscreen mode

Person B then keeps the instruction to the assistant deliberately short and verifiable:

Implement extendLoan in src/loans/extend.ts so that the tests in
extend.test.ts pass. Return a new object instead of mutating the one
passed in. No new dependencies. Afterwards, explain in two sentences
how you handled the date calculation.
Enter fullscreen mode Exit fullscreen mode

5. Check every suggestion out loud

Before you accept a suggestion, answer three questions together: Does it fit the goal from step 1? Do we understand every line? Would we wave this code through in a colleague’s review? If any answer is “no”, adjust or discard it. The second question in particular is uncomfortable, because AI code often looks plausible. In our example, the date calculation deserves a closer look: time zones and daylight saving time are classic spots where a suggestion passes the tests and is still wrong.

6. Commit in small steps

Commit after every green test. Small steps make it easy to roll back a bad suggestion, and they keep the rhythm of driver and navigator. If you let the assistant change five files at once, nobody reviews them thoroughly at the end.

7. Five-minute retrospective

At the end of each session, ask yourselves: Where did the assistant really help us? Where did it slow us down or lead us astray? Which of us learned more today, and how do we balance that next time? Jot down the answers. After three or four sessions, you will see a pattern.

Expected result

After such a session you have a small, tested function that both of you can explain, and a first idea of what you want to use the assistant for in the pair. Whether you were faster than without AI, you do not know yet. More on that in a moment.

When the assistant complements the navigator well

An assistant adds the most value in a pair where both people would learn little but type a lot. That includes test data, mapping code, configuration and regular expressions. It is just as helpful with unfamiliar libraries: instead of scrolling through the docs together, the navigator asks and the pair checks the answer against the code.

Brainstorming test cases is another good example. Ask the assistant which edge cases you are missing, then decide together which of them really matter. It is also a good conversation partner for understanding legacy code, as long as you verify its explanations against the code.

When to close the assistant

There are moments when the assistant gets in the pair’s way. Architecture and interface decisions are one example: they involve trade-offs that depend on your team’s context, and that conversation should happen between humans. You can ask the assistant to sketch variants afterwards, but the decision belongs to the pair.

During onboarding into the business domain, the assistant should also stay on the sidelines. If a new colleague needs to understand why lending works the way it does, a conversation is worth more than any generated explanation. And close the assistant when one of you is noticeably falling behind. Then the pace is the problem, not missing code.

Common mistakes in pair programming with AI

The spectator navigator

The most common mistake: the driver types, prompts, reads and accepts while the navigator only nods. From the outside it looks like pairing; in reality one person is working with their AI and a second one is watching. Rotating the right to prompt from step 3 fixes this.

Prompt ping-pong instead of thinking

When the assistant does not deliver what you want, many people rephrase the prompt, and again, and again. After the third attempt it almost always pays off to step back and clarify as a pair what you actually want. Often what is missing is not a better prompt but a clearer understanding of the problem.

Perceived speed

A randomized study by the research organization METR from 2025 observed 16 experienced open-source developers working on 246 real tasks in their own projects. With AI tools, they took 19 percent longer on average. At the same time, they estimated afterwards that AI had sped them up by about 20 percent. The study has clear limits (small sample, very familiar codebases, tooling as of early 2025), and METR itself points out that the results cannot be generalized. Still, the gap between perceived and measured speed is a good warning. Do not rely on gut feeling alone in your retrospective.

One person and their AI replace the pair

The quietest mistake happens at team level. Pairing sessions become rarer because “I have the assistant anyway”. In the short term that feels efficient. In the medium term, knowledge silos grow, reviews take longer and new colleagues ramp up more slowly because nobody sits next to them anymore.

What managers can do

The 2025 DORA report from Google Cloud describes AI primarily as an amplifier: it magnifies the strengths and weaknesses an organization already has. For pairing, this means a team that collaborates well will probably get better with an assistant in the pair, while a team in which everyone works alone anyway will become even more isolated with AI.

As a manager, I would therefore not mandate anything, neither “pair only with AI” nor “no AI when pairing”. Instead, suggest a two- to four-week experiment in which the team tries the roles from this article and evaluates them in a retrospective. Pay attention to lead time, defects after release and how many people can explain a given part of the code. Lines per day or the number of accepted AI suggestions say little.

Also give people time to learn. Writing good instructions for an assistant and critically reviewing its suggestions is a skill that needs practice. And model that it is fine to say in a pair: “I don’t understand this suggestion.” Many people find that harder when a seemingly all-knowing AI sits next to them.

My take

I find the term “AI pair programmer” misleading. An assistant can type, explain and make suggestions, but it carries no responsibility, it learns nothing about your team and it will not be at the table during the next incident. Pair programming was never just a way to write code faster. It is a way to get better together as a team.

At the same time, it would be silly to keep the assistant out of pairing. Used inside the pair, with clear roles and checks out loud, it is a good third seat at the table. Kief Morris describes on martinfowler.com that humans working with agents should ideally be “on the loop”: instead of checking every line, they improve the environment the agent works in, meaning specifications, tests and workflows. The pair is a good place for that. Two people notice faster which rule is missing from the context file or which test would have caught the next wrong suggestion.

Where I disagree: with the hope that AI makes pairing unnecessary for beginners. Juniors in particular benefit from a human who asks why a suggestion is good. An assistant delivers answers. A good pairing partner teaches you to ask the right questions.

FAQ

Can AI replace pair programming?

No. An AI assistant can help with writing, explaining and researching, but knowledge sharing within the team, shared responsibility for the code and team skills only develop between people. It works best as an addition inside a pair.

Is GitHub Copilot a pair programmer?

GitHub has long marketed Copilot as an “AI pair programmer”. Technically, it is more of a very good assistant: it makes suggestions, but it does not make decisions and carries no responsibility. The navigator role stays with the human.

How long should a pairing session with AI last?

Rounds of 15 to 25 minutes with a role switch and a total of one to three hours with breaks work well. More than about six hours of pairing per day is exhausting, with or without an assistant.

Is pair programming with AI worth it for junior developers?

Yes, if an experienced human is involved and the rule applies that every suggestion must be explained before it is accepted. Alone with an assistant, beginners pick up syntax quickly but learn less about trade-offs and team context.

Your next step

Plan a two-hour session for two with an assistant next week. Set a goal and a stop criterion, switch keyboard and prompting rights every 20 minutes, and take five minutes at the end for the three retrospective questions. After that you will know more than after any debate on principles.

Now I am curious about your experience: does the AI assistant sit at your pairing table, or has it quietly replaced pairing?

Sources

This post was created with AI assistance.


👉 Next step: More for team leads: my cheat sheets put the essentials on one printable page.

📬 Stay updated: New articles on serverless, AI and leading tech teams via RSS, browser push or the weekly newsletter (in German).

Originally published on sascha-ms.de. More articles on serverless, AI in everyday development and leading tech teams: sascha-ms.de/en

Top comments (0)