Vibe Code Textbook

Part II, chapters 8–16

Workflows

Repeatable ways of working with an agent: specs, tests-first, review loops, context files, and the habits that keep a session on track.

Part II is about working with an agent rather than configuring one: the habits that decide whether a session ends in a change you can merge. Each of its nine chapters turns one habit into something concrete (a template, a checklist or a gate) and ships a small script that applies it; where a script was run, the chapter shows its real output.

Read the first five in order, because together they follow one session from start to finish. Spec first gives a six-section task template and a linter that refuses a weak spec. Tests first explains why a test that never failed proves nothing and how to make the harness enforce red before green. Reviewing agent diffs orders ten damage patterns into a checklist with a scanner. Git worktrees gives each session its own checkout and branch. When to stop sets budgets and names the loop signatures that come before a failed run.

The later chapters widen the frame: prompt patterns such as plan mode and saved prompts across three harnesses, monorepo strategies for what loads and what runs, code review bots compared on triggers, blocking and cost, and the newest, agent transcripts as documentation, a workflow for exporting a session record, redacting it and linking it to its commit.

The parts these habits configure are explained in Harnesses, and Tutorials applies them to whole tasks.

  1. 8

    Spec first: how do you write a task a coding agent will finish?

    A six-section spec template for coding agents, a worked CLI example, the published cost of underspecified prompts, and a linter to run before handing over.

  2. 9

    Tests first with an agent: why must the test fail before it passes?

    The red-green loop for agents: why a test that never failed proves nothing, hook-based gates, the lucky-pass numbers, and a script that enforces the order.

  3. 10

    Reviewing coding-agent diffs: what does the checklist catch first?

    Ten patterns behind most damage in agent diffs, why a second model makes a good first reviewer, and a scanner that flags them with line references.

  4. 11

    Git worktrees for coding agents: one checkout per session, why?

    A worktree and branch per agent task, commits after every green, deny rules for destructive git, and a helper script exercised on a real repository.

  5. 12

    When should you stop a coding agent? Budgets, loops, and the signs

    The budget flags harnesses ship, the loop signatures that predict a failed run, what the research says about early stopping, and a transcript analyser.

  6. 13

    Prompt patterns for coding agents: plan mode, skills, saved prompts

    Four prompt patterns from the Claude Code, Codex, and Gemini CLI docs, with exact commands and file formats, plus a script that writes one saved prompt three ways.

  7. 14

    Monorepo strategies for coding agents: what loads and what runs

    How Claude Code, Codex and Gemini CLI find instruction files in a monorepo, how Nx, Turborepo and pnpm scope what runs, and a script that resolves both.

  8. 15

    AI code review bots compared: triggers, rules files, blocking, cost

    How Copilot code review, Claude Code Review and Gemini Code Assist on GitHub are triggered, what they read, whether they can block a merge, and what a review costs.

  9. 16

    Agent transcripts as documentation: export, redact, link the commit

    A coding-agent session log explains a diff better than the diff, but it expires, leaks secrets and changes format. A workflow and script to keep a record.