Task Decomposition

Split a large request into ordered, independently verifiable steps so each prompt is small enough to get right.

TL;DR

  1. Break a big task into small, ordered steps, each with a clear, checkable result.
  2. Small prompts fail less and are far easier to verify than one giant request.
  3. Verify each step before the next so errors do not compound down the chain.

Why Decompose

    Smaller = More Reliable

    A focused prompt has fewer ways to go wrong than a sprawling one.

    One function + its test
    >>> "build the whole feature"
    Localizes Errors

    When a small step fails, you know exactly where the problem is.

    Step 3 failed -> look at step 3,
    not all of it.
    Stops Compounding

    Verifying each step prevents later work from inheriting a bug.

    Verify step N before step N+1.

How To Split

    By Deliverable

    Each step should produce something runnable or readable you can judge.

    1 schema -> 2 validator -> 3 route
    -> 4 test -> 5 wire-up
    By Dependency

    Order steps so each has what it needs from the ones before.

    Types first, then the code that
    uses the types.
    Isolate Risk

    Pull the uncertain part into its own step so you can probe it early.

    Prototype the tricky parser first,
    alone, before integrating.

Drive The Sequence

    Name The Current Step

    Tell the model exactly which step it is on so it stays scoped.

    "Step 2 only: the validator.
    Do not touch the route yet."
    Carry Forward

    Feed the verified output of one step as the input to the next.

    "Here is the approved schema.
    Now write its validator."
    Keep A Checklist

    Track done vs pending so nothing is skipped or repeated.

    [x] schema  [x] validator
    [ ] route   [ ] test

When Not To

    Trivial Tasks

    A one-function utility does not need a multi-step plan.

    "Write a slugify function" -> one shot.
    Tight Coupling

    If pieces only make sense together, group them into one coherent step.

    A type and its single user
    can share a step.
    Over-Splitting

    Steps too small add overhead without adding verifiability.

    Do not split one function into
    five prompts.

Tips

  1. Make each subtask produce something you can run or read, not an abstract half-step.
  2. Keep a running checklist and tell the model which step is current so it stays scoped.

Warnings

  1. One mega-prompt for a whole feature usually returns code that is wrong in a way that is hard to locate.
  2. If you let errors ride to the next step, every later step builds on the mistake.

In Practice

FAQ