Skip to content
PKResources
Guides

The agentic coding workflow: plan, execute, verify

A hands-on guide for developers moving from autocomplete and chat to delegating real tasks to coding agents, with task briefs, feedback loops and review habits.

by Patrick Kamtchueng Kom · Published

Autocomplete and pasting errors into a chat window are useful, but they aren’t delegation. Coding agents change the unit of work: you hand over a task, and the agent reads files, edits code, runs commands and reports back.

When it works, it’s like pairing with a tireless junior. When it doesn’t, you’re cleaning up after someone who confidently rewrote half your codebase. The difference is rarely the model. It’s the workflow around it.

  1. PlanSize the task, write the brief, review the agent's plan
  2. ExecuteAgent works inside tests, types and lint
  3. VerifyYou check the diff: files, tests, then code

↺ Commit at green, discard freely, repeat with the next small task

The whole guide in one loop. It works with a CLI agent or one built into your IDE.

The mental shift: from typing to delegating

With autocomplete, you’re the author. With an agent, you’re closer to a tech lead: you define the work, set the boundaries and review the result.

🃏 The three skills that now matter most

Tap a card to flip it

Step 0: size the task

Task size is the biggest predictor of success I see. Too small and the brief isn’t worth writing; just type the code. Too big and the agent loses the thread and hands you a 40-file diff you can’t review.

✅ A task is well-sized when…

0 / 4 completed

🎮 Delegate it or keep it?

1 / 9 · Score: 0

Would you hand this to an agent as a single task?

If a task is too big, don’t hand it over as-is. Ask the agent to help you split it, then delegate the pieces one at a time.

Step 1: write a real task brief

One-line prompts work for trivial changes. For anything else, a short brief takes two minutes and saves twenty.

  1. 1

    Goal

    What should be true when the task is done, and why.

  2. 2

    Constraints

    What the agent must not do or must respect: no new dependencies, don't change the public API, follow the pattern in file X.

  3. 3

    Acceptance criteria

    Concrete, checkable conditions. Ideally commands that pass.

  4. 4

    Relevant files

    Where to start looking, so the agent doesn't wander.

A brief for a small feature:

## Goal
Add cursor-based pagination to GET /api/orders. The mobile app
currently loads all orders at once and times out for large accounts.

## Constraints
- Keep the existing response shape; add `nextCursor` at the top level.
- Don't add new dependencies.
- Follow the pagination pattern already used in `src/api/invoices.ts`.
- Don't modify the database schema.

## Acceptance criteria
- `limit` query param, default 50, max 200.
- `cursor` query param returns the next page, ordered by createdAt desc.
- New tests in `tests/api/orders.test.ts` cover: first page, next page,
  last page (nextCursor null), invalid cursor (400).
- `npm test` and `npm run typecheck` pass.

## Relevant files
- src/api/orders.ts
- src/api/invoices.ts (reference pattern)
- src/db/queries/orders.ts

Note the reason (so the agent makes sensible trade-offs), the reference pattern (so it doesn’t invent one) and a definition of done a machine can check.

A brief for a bug fix:

## Goal
Fix: users with an apostrophe in their last name (e.g. O'Brien) get a
500 when updating their profile.

## Reproduction
1. Create a user with last name "O'Brien".
2. PATCH /api/profile with any change.
3. Server logs show a query error in updateProfile.

## Constraints
- Fix the root cause, not the symptom. No string escaping hacks.
- Don't touch unrelated queries, even if they look similar. List them
  in your summary instead and I'll decide.

## Acceptance criteria
- Write a failing test that reproduces the bug FIRST, show me it fails.
- Then fix it and show the test passing.
- Full test suite passes.

## Relevant files
- src/services/profile.ts
- src/db/queries/users.ts

🧠 Brief check

Score: 0 / 4

  1. 1. Which acceptance criterion is most useful to an agent?

  2. 2. Why include a reference file like src/api/invoices.ts?

  3. 3. Why state the reason behind the goal ("the mobile app times out")?

  4. 4. In a bug-fix brief, what should come before the fix?

Step 2: give the agent repo context once

You shouldn’t repeat “we use pnpm, not npm” in every brief. Most agents load a project-level instructions file at the repo root, often named something like AGENTS.md or CLAUDE.md. Check your tool’s docs for the exact filename.

✕ Leave out

  • –Long prose
  • –Aspirational standards nobody follows
  • –Anything that changes weekly
  • –Stale lines the agent will follow confidently

✓ Put in

  • +Commands: install, run, test (including a single file), typecheck, lint, format
  • +Architecture in a paragraph: main folders and what lives where
  • +Conventions: naming, error handling, where tests go
  • +Guardrails: generated code, vendored libs, applied migrations to never edit
  • +Gotchas: "the dev server needs Redis", "dates are stored in UTC"

Treat this file like code: review changes, keep it current, delete dead lines. If the agent keeps making the same mistake, add one line here rather than repeating yourself in every prompt.

Step 3: plan first, then review the plan

For anything beyond trivial, ask for a plan before edits. Many agents have a plan or read-only mode; otherwise say “Don’t edit any files yet. Read the relevant code and propose a plan.”

A useful plan lists the files that will change and why, the approach in a few steps, assumptions, and how it will verify the change. Reading it is the cheapest review you’ll ever do: catching “I’ll add a new caching library” here costs one sentence, not a rewrite.

🃏 Red flags in a plan

Tap a card to flip it

Correct the plan in plain language; two rounds is normal. On round four, the task is too vague or too large, so rewrite the brief. Planning also splits big work: “Propose a sequence of small, independently mergeable steps to get from here to X.”

Step 4: execute inside a tight feedback loop

An agent without a verifier is guessing. With a fast test suite, a typechecker and a linter, it can see its own errors and fix them before you look.

✅ Feedback loop setup

0 / 4 completed

TDD pairs surprisingly well with agents

  1. RedAgent writes a failing test for the behaviour
  2. ReviewYou review the test: it is the spec
  3. GreenAgent makes it pass without changing the test
  4. RefactorAgent cleans up with tests green
Reviewing a 20-line test is much easier than reviewing a 200-line implementation.

One rule I’m strict about: the agent doesn’t get to edit a test to make it pass unless I’ve agreed the test was wrong. Say it in the brief.

Step 5: small commits, and git as the undo button

Agents make many changes quickly. Git is what makes that safe.

✕ Don't

  • –Start with your own uncommitted changes mixed in
  • –Let a long run go without checkpoints
  • –Rescue a bad attempt because it "almost works"
  • –Keep one branch alive for many tasks

✓ Do

  • +Start from a clean working tree
  • +Commit at each green checkpoint (I often commit myself after a quick look)
  • +Reset to the last good commit and rewrite the brief
  • +One task, one branch, one pull request

The code was cheap to generate; your attention isn’t. Being willing to throw work away is a real skill.

Step 6: run agents in parallel, carefully

Two or three agents on independent tasks is a genuine productivity jump. The key is isolation: two agents in the same working directory will step on each other.

mainAgent A · tests for module AAgent B · bug fix in module BAgent C · plan under reviewworktree 1worktree 2worktree 3Youreview gate
One repository, one worktree per agent, and you as the review gate before anything merges.

Isolation options: separate git worktrees (each agent gets its own directory and branch on the same repo; my default), separate clones if your tooling dislikes worktrees, or remote/sandboxed agents if your tool offers them.

Step 7: review agent diffs efficiently

Agent output needs review, full stop. The trick is doing it faster than writing the code yourself.

  1. 1

    Read the summary, trust nothing yet

    "All tests pass" is a claim, not a fact.

  2. 2

    Run the checks

    Tests, typecheck, lint, yourself or via CI.

  3. 3

    Scan the file list

    Any file not obviously related to the task is a red flag. Start there.

  4. 4

    Read tests before implementation

    Do they assert something meaningful? Would they fail if the feature broke?

  5. 5

    Read the implementation

    Hunt for the failure modes below, not style. Formatters handle style.

  6. 6

    Check what's missing

    Error handling, edge cases from the acceptance criteria, docs or types to update.

A diff too big to review comfortably is feedback on task size, not a reason to skim. Reject it and split the task.

Common failure modes and how to catch them

The patterns I see most, in my own work and with teams I help. Flip each card for how to catch and prevent it.

🃏 Agent failure modes

Tap a card to flip it

When to take the wheel back

Delegating doesn’t mean abdicating.

✅ Step in when…

0 / 5 completed

Taking the wheel can be partial: fix the tricky part yourself, commit it, and hand the rest back.

## Goal
I've implemented the new retry logic in src/jobs/retry.ts (see the last
commit). Apply the same pattern to the three other job handlers.

## Constraints
- Match the retry.ts implementation exactly; don't "improve" it.
- One commit per handler.
- If a handler doesn't fit the pattern cleanly, stop and tell me
  instead of adapting it.

## Acceptance criteria
- src/jobs/email.ts, src/jobs/export.ts, src/jobs/sync.ts use withRetry.
- Existing tests for each handler still pass.
- New test per handler for the retry-then-succeed case.

## Relevant files
- src/jobs/retry.ts (reference)
- tests/jobs/retry.test.ts (reference test)

Putting it together

  1. 1

    Size

    So the diff will be reviewable.

  2. 2

    Brief

    Goal, constraints, acceptance criteria, relevant files.

  3. 3

    Plan

    And review the plan before any code.

  4. 4

    Execute

    With tests, types and lint as the verifier.

  5. 5

    Commit

    At green checkpoints; discard freely.

  6. 6

    Review

    File list, tests, then implementation.

  7. 7

    Take the wheel

    When the agent loops, or judgment is needed.

None of this is exotic. It’s how good teams already delegate to people; agents just make skipped steps show up faster.

Try this on your next task

✅ Your first plan-execute-verify run

0 / 9 completed