How to code with AI agents

'Code is cheap now. I throw it away.' above a workflow of brainstorm, spec, plan, build and review, with build struck out in red and a dashed arrow from review back to plan.

I use AI agents every day: not just to write code, but for research, brainstorming, planning, and user testing. I wrote up how I code with AI agents in a longer article.

It covers working spec first, quality gates on every commit, worktrees, parallel agents, and throwing away code that misses.

The short version:

  1. Write the spec first, then build from a plan the agent and I both reviewed.
  2. Run quality gates on every commit so the agent catches its own mistakes.
  3. Give each branch its own worktree and environment.
  4. Run agents in parallel on separate tasks.
  5. Throw away code that misses. It’s cheap to regenerate.

Read the full article on the Human Made blog.