Principles Align With Docs Write the PRD Vertical Issues TDD Review Ready & Done All Guides

AI Driven Development Workflow Guide

A practical workflow for using AI inside an engineering feedback system, not instead of one.

AI driven development workflow infographic showing align, PRD, vertical slicing, TDD, fresh review, and system improvement.

Based on Matt Pocock's "Full Walkthrough: Workflow for AI Coding," his follow-up on /grill-with-docs, and related public materials.

Core Idea

AI driven development works best when you stop treating the model as an infinite-context programmer and start treating it as a fast junior engineer inside a tight engineering system.

The workflow
  1. Keep the model in a small, high-quality context.
  2. Align on the design before implementation.
  3. Maintain shared project language while aligning.
  4. Externalize memory into docs, issues, tests, and code.
  5. Slice work vertically so every task produces feedback.
  6. Let agents implement only after the work is clear.
  7. Review in a fresh context.
  8. Improve the codebase so the next agent has an easier job.

The Operating Principles

1. Stay in the Smart Zone

Large context windows do not mean unlimited coding quality. As the context fills, models tend to lose precision, miss constraints, and make worse decisions.

Working pattern:

Rule of thumb If the agent is rereading too much, arguing with old assumptions, or fixing bugs it just created, the task is probably too large or the context is too stale.

2. Treat the Model as Forgetful

Assume the agent will forget anything not written down. This is not a defect to fight with more chat history; it is a design constraint.

Working pattern:

Good project memory includes:

3. Alignment Beats Specs-to-Code

The talk argues against handing a large spec to an agent and treating the generated code as an implementation detail. The code still matters. You need to understand it, shape it, and review it.

Working pattern:

Phase 1: Align With Docs

Use an alignment session before writing code. The agent's job is to ask one focused question at a time until both of you share the same design concept.

The update from Matt's newer /grill-with-docs workflow is this: for coding work in an existing project, alignment should not live only in chat. It should also refine the project's shared language and capture non-obvious decisions while the conversation is still fresh.

Choose the Right Alignment Mode

Use /grill-me when:

Use /grill-with-docs when:

In short: /grill-me extracts clarity from your head. /grill-with-docs extracts clarity and makes it stick in the project.

Prompt Template

For a new or lightweight task:

Interview me relentlessly about this feature until we reach a shared understanding.
Walk down each branch of the design tree and resolve dependencies between decisions one by one.
Ask one question at a time.
For each question, provide your recommended answer and why.
If the answer can be discovered from the codebase, inspect the code instead of asking me.

Feature:
[describe the feature or problem]

For an existing codebase:

Interview me relentlessly about this feature until we reach a shared understanding.
Use the existing codebase, CONTEXT.md, and docs/adr as grounding.
Challenge fuzzy or inconsistent terminology against the project language.
Ask one question at a time.
For each question, provide your recommended answer and why.
If the answer can be discovered from the codebase or docs, inspect them instead of asking me.

While we align:
- Update CONTEXT.md when we define or refine project language.
- Propose an ADR only for decisions that are hard to reverse, surprising, or involve a real tradeoff.
- Keep implementation out of scope until alignment is complete.

Feature:
[describe the feature or problem]

What the Agent Should Clarify

Human Role

Your job is not to answer everything perfectly. Your job is to make product and architecture decisions the agent cannot safely infer.

End this phase when:

Lightweight CONTEXT.md Template

# Context

## Bounded Context
[What part of the system this language applies to.]

## Shared Terms
- Term: Meaning. Where it appears in code.

## Important Workflows
- [Workflow name]: [short explanation]

## Naming Conventions
- [How concepts should be named in files, variables, UI, and docs.]

## Common Misunderstandings
- [Term or behavior agents often get wrong.]

ADR Trigger

Create an ADR only when a decision:

Phase 2: Write the PRD as a Destination Document

After the alignment session, turn the conversation into a PRD. The PRD is not a magic input that generates correct code. It is a durable destination document so future fresh sessions know what "done" means.

If you used /grill-with-docs, the PRD should reference the updated project language instead of redefining everything. CONTEXT.md explains the nouns; the PRD explains the destination for this feature.

PRD Template

# PRD: [Feature Name]

## Problem
[What user or business problem are we solving?]

## Goals
- [Goal 1]
- [Goal 2]

## Non-Goals
- [Explicitly excluded behavior]

## User Stories
- As a [user], I want [capability], so that [outcome].

## Product Decisions
- [Decision and rationale]

## Technical Decisions
- [Module ownership]
- [Data model changes]
- [API or interface changes]
- [Migration strategy]

## UX States
- Empty:
- Loading:
- Success:
- Error:
- Permission denied:

## Test Strategy
- Unit:
- Integration:
- E2E/manual:

## Open Questions
- [Only unresolved items that should block or constrain implementation]

Review the PRD for risk, not prose. The valuable review already happened during grilling. Now check that the artifact captured the important decisions.

Phase 3: Break the PRD Into Vertical Slice Issues

Agents often default to horizontal work: database first, API second, UI third. That delays feedback. Prefer vertical slices: each issue cuts through the necessary layers and leaves a visible, testable result.

Bad Horizontal Issues

Better Vertical Issues

Issue Template

# Issue: [Vertical Slice Name]

## Outcome
[One visible or verifiable behavior this issue must deliver.]

## User Value
[Why this slice matters.]

## Scope
- [Specific changes included]

## Out of Scope
- [What the agent must not do]

## Expected Files or Modules
- [Likely files/modules, if known]

## Dependencies
- Blocks: [issues this enables]
- Blocked by: [issues required first]

## Test Requirements
- Write or update failing tests first.
- Run: [test command]
- Run: [typecheck/lint/build command]

## Acceptance Criteria
- [ ] [Observable behavior]
- [ ] [Tests pass]
- [ ] [No unrelated refactors]
- [ ] [Docs updated if needed]

Good issues are independently grabbable. If two issues do not share a dependency, separate agents should be able to work on them in parallel.

Phase 4: Implement With TDD

Once issues are clear, implementation can become more autonomous. Keep the agent inside a red-green-refactor loop.

Implementation Prompt Template

Implement this issue using red-green-refactor.

Rules:
- First inspect the relevant code and tests.
- Write a failing test for the desired behavior.
- Run the test and confirm it fails for the expected reason.
- Implement the smallest change that makes the test pass.
- Refactor only after the test passes.
- Run the full required verification commands.
- Do not make unrelated changes.
- Summarize the files changed, tests run, and remaining risks.

Issue:
[paste issue]

Why TDD Matters More With Agents

Tests are not ceremony here. They are the agent's steering system. Without executable feedback, the agent is guessing.

Minimum feedback loop:

Phase 5: Review in a Fresh Context

Do not let the same long-running implementation context be the only reviewer. The implementer is already carrying its own assumptions.

Working pattern:

Review Prompt Template

Review this change as a senior engineer.

Prioritize:
- Behavioral bugs.
- Missed acceptance criteria.
- Missing or weak tests.
- Security or data integrity risks.
- Unrelated changes.
- Architecture drift.

Inputs:
- Issue: [paste]
- Relevant PRD section: [paste]
- Diff: [paste or point to branch]
- Test output: [paste]

Return findings first, ordered by severity, with file and line references where possible.

Phase 6: Use a Kanban/DAG for Agent Work

The useful planning artifact is not just a list. It is a dependency graph.

Suggested Columns

Rules

Phase 7: Architecture Is the Quality Ceiling

Agents perform better in codebases with deep modules: small interfaces hiding meaningful internal complexity. They perform worse in shallow, tangled systems where every change crosses many tiny files and ambiguous dependencies.

Working pattern:

Architecture Review Questions

A Practical Daily Workflow

For a New Feature

  1. Start a fresh context.
  2. Choose /grill-me for greenfield work or /grill-with-docs for existing code.
  3. Align one question at a time.
  4. Update CONTEXT.md and ADRs during alignment when needed.
  5. Write/update PRD.
  6. Convert PRD into vertical issues.
  7. Mark dependencies.
  8. Let agents implement ready issues with TDD.
  9. Review each change in a fresh context.
  10. Merge small slices.
  11. Capture architecture improvement opportunities.

For a Bug

  1. Ask the agent to reproduce and explain the bug.
  2. Write a failing regression test.
  3. Fix the smallest owning module.
  4. Run focused and broad verification.
  5. Fresh-context review.
  6. Add an ADR or docs update only if the root cause was conceptual.

For a Refactor

  1. Ask the agent to map current behavior and module boundaries.
  2. Identify the smallest deepening opportunity.
  3. Lock behavior with tests.
  4. Refactor behind the same interface.
  5. Run broad verification.
  6. Review for behavior changes and unnecessary churn.

Definition of Ready

An issue is ready for an agent when:

Definition of Done

A slice is done when:

Anti-Patterns to Avoid

Minimal Version You Can Use Today

You do not need a full agent orchestration stack to adopt the pattern.

Start with this:

  1. Before coding, ask the agent to align with you one question at a time.
  2. For existing codebases, keep a short CONTEXT.md and update it when new project language appears.
  3. Save feature-specific decisions in a short PRD.
  4. Split the PRD into vertical issues.
  5. For each issue, require a failing test before implementation.
  6. Clear context before review.
  7. Keep only small, reviewed changes.
Core shift AI writes code inside an engineering feedback system, not instead of one.

Sources