← Back to the portfolio

Engineering notes · Workflow

The AI coding workflow I follow

This is Matt Pocock’s end-to-end workflow for building software with AI agents. I follow it on my projects, and I’ve layered a few steps of my own on top. His thesis, and the reason it works: the boring fundamentals (small tasks, vertical slices, tests first, deep modules) are exactly what make agents reliable.

Workflow by Matt Pococknotes & additions by Md Shadi RohanNov 20268 min read
Source · videoFull Walkthrough: Workflow for AI Coding by Matt Pocock ↗Matt’s workflow his stages & skills+ My addition how I extend it

TL;DR

  • Day shift (me + agent): get interviewed until the design is clear, turn it into a PRD, split it into thin end-to-end tickets.
  • Night shift (agents): pick an unblocked ticket, build it test-first in an isolated worktree, get reviewed by a fresh session, commit.
  • Back to me: I QA the running app. Anything off becomes a new ticket.

Mental model

The two constraints behind it

Matt builds the whole workflow around two limits of today’s models. Once they clicked for me, most of the stages explained themselves.

The smart zone and the dumb zone

A 200k or 1M token window doesn’t mean 1M tokens of good decisions. As a session fills up, the model’s attention spreads thinner. Past roughly 100k tokens it starts missing things it handled perfectly an hour ago. So I don’t try to cram a whole feature into one session. I make the work small enough to finish while the model is sharp.

0~100k tokens200k+
smart zone
dumb zone
Attention thins out as a session fills up. Every ticket I hand to an agent is sized to finish on the left side of this bar.

Clear, don’t compact

Every fresh session starts with no memory, like the guy in Memento. That sounds like a weakness, but it’s actually the feature I lean on. Summarising a long, messy chat leaves sediment behind: half-abandoned ideas and stale assumptions the model keeps tripping over. Instead I clear the context between stages and hand the next session a clean artifact (a PRD, a ticket, a diff). Each stage starts back in the smart zone.

The process

The workflow, stage by stage

Matt splits the work into two shifts. In the day shift I’m at the keyboard, making decisions with the agent. In the night shift agents execute on their own, away from keyboard, while I do something else, often the next day-shift task.

1
Human in the loop/grill-me

Align: let the agent grill me

The worst thing an agent can do is start coding the moment I finish a sentence. Matt’s fix is to flip it: with his /grill-me skill, the agent interviews me instead. A sub-agent explores the codebase first, so the main session doesn’t spend its context reading files. Then the agent asks me one question at a time, each with its own recommended answer: what happens on a duplicate invite? who can revoke? what about expired links?

We keep going until there’s nothing left to ask. This is where most of my engineering judgement goes, and it’s the cheapest place to catch a bad idea.

Output · A shared design concept: scope, edge cases and the assumptions we both agree on.

2
Human in the loop/write-a-prd

Spec: write the destination document

Once we agree, the agent turns the conversation into a product requirements doc: problem statement, user stories, out-of-scope boundaries, implementation decisions and the exact modules it expects to change.

I skim it, but I don’t polish it line by line. The alignment already happened in the grilling, and models are genuinely good at summarising. The PRD is a destination, not a contract.

Output · A PRD with the problem, user stories, what’s out of scope, key decisions and the modules to touch.

3
Human in the loop/prd-to-issues

Slice: break it into vertical tickets

Left alone, an agent plans horizontally: every schema, then every endpoint, then every screen. Feedback arrives at the very end, when it’s most expensive. I push back on that and ask for vertical slices, or tracer bullets: thin features that touch the database, the API and the UI together, so every finished ticket is something I can actually use.

Horizontal · what agents do by default

UI#1#1#1#1
API#2#2#2#2
DB#3#3#3#3

All schemas, then all endpoints, then all screens. Nothing works until the last ticket lands.

Vertical · what I ask for

UI#1#2#3#4
API#1#2#3#4
DB#1#2#3#4

Each ticket cuts through every layer, so ticket #1 is already something I can click.

Each ticket gets a mode (can an agent do it alone, or does it need my taste?) and its blockers. That dependency graph is what lets several agents work in parallel without stepping on each other.

backlog · team-invites4 tickets · 2 ready now
  • #1Invite a teammate by email (form → API → table)ready AFK · agents
  • #2Accept invite and land on the dashboardblocked by #1 AFK · agents
  • #3Pick the copy and empty states for invitesready Human in the loop
  • #4Revoke a pending inviteblocked by #1 AFK · agents
#1 and #3 can start in parallel: an agent takes #1 while I make the call on #3.

Output · A backlog of small tickets, each tagged AFK or human, with explicit blockers between them.

4
AFK · agentsClaude Code in a loop · git worktrees

Build: agents work the backlog, test-first

A simple loop picks the next unblocked AFK ticket, creates an isolated git worktree and lets the agent implement it. Isolation matters: a bad run never touches my working tree, and I can throw it away in one command.

night-shift.sh
# pseudocode: the AFK loop
while ticket=$(next_unblocked --mode afk); do
git worktree add ../wt-$ticket # isolated copy, my tree stays clean
agent "implement $ticket, red → green → refactor"
pnpm typecheck && pnpm test || continue # gates, not vibes
reviewer --fresh-context --rules CODING.md # new session reads the diff
git commit -m "$ticket"
done

The agent works red → green → refactor: write a failing test, watch it fail, then write the code that passes it. Seeing the test fail first is the point. Otherwise it’s easy for a model to write a test that passes no matter what the code does.

Before anything is committed, a separate reviewer session reads the diff with a cleared context and our coding standards in its prompt. It reviews from the smart zone, not from the bottom of the implementer’s very long chat.

Output · Small, tested, type-checked commits, one ticket each, already reviewed.

5
Human in the loopthe running app · Cursor for quick fixes

QA: my taste, my call

Agents are still weak at judging whether a screen feels right. So I test the running app myself, on desktop and on my phone. Spacing, copy, empty states, the flow between screens. Tiny tweaks I make directly. Anything bigger goes back on the board as a new ticket for the night shift.

When the feature is done, I close the PRD and delete the temporary planning files. Stale docs rot, and a future agent will happily trust a plan that stopped being true weeks ago.

Output · Follow-up tickets on the board, and planning docs deleted once the feature ships.

Long-term health

Keeping the codebase agent-friendly

The workflow only stays fast if the code stays easy to navigate. Matt leans on an idea from John Ousterhout’s A Philosophy of Software Design: prefer deep modules, meaning a lot of behaviour behind a small, simple interface, over dozens of shallow files that each do a little.

Shallow · many tiny files

Wide interfaces, logic everywhere. An agent burns context just finding things.

Deep · small interface, lots inside

invites.service

One door in. Tests wrap the whole flow, and agents can change the inside safely.

Deep modules help agents in two ways: there’s less to read to find the right place, and I can put broad, high-value tests around a whole flow instead of mocking every tiny piece. Every so often I run his architecture pass (/improve-codebase-architecture) that looks for clusters of tightly coupled files and folds them into one testable module.

Cheat sheet

The whole thing on one table

  1. 1Align Human in the loop

    /grill-me

    Shared understanding of scope and edge cases

    + Rules files loaded first

  2. 2Spec Human in the loop

    /write-a-prd

    PRD and a map of modules to touch

    + A verification plan

  3. 3Slice Human in the loop

    /prd-to-issues

    Backlog of vertical-slice tickets with blockers

    + Done = commands pass

  4. 4Build & review AFK · agents

    AFK loop + TDD

    Tested, type-checked commits from worktrees

    + I read every diff, CI gates

  5. 5QA Human in the loop

    Me, the running app

    Follow-up tickets back on the board

    + Phone widths, both themes

Where it shows

See it in real projects

The workflow, the smart-zone model and the skills (/grill-me, /write-a-prd, /prd-to-issues, /improve-codebase-architecture) are Matt Pocock’s, from Full Walkthrough: Workflow for AI Coding. Watch it, it’s worth the time. The notes marked “My addition” are how I extend it on my own projects.

Want this on your team?

I’m open to software engineering roles and selected freelance work. Happy to walk through any of it live.