Best practices / Ship a feature every week

Writing tasks an agent can actually finish

Name the file, the symptom and the check that proves it is fixed, so the agent stops at a real finish line.

Beginner · 5 steps · 5 sources · Updated

The problem

An agent stops when the work looks done. If the task never said what done means, you find out at review time, after it has built something you did not ask for. Alone, nobody else writes the ticket.

The workflow

  1. 01

    Write the task in four parts

    OpenAI's Codex guide lists them: the behavior you want, where the relevant code or repro steps are, the constraints to keep, and how to verify. Anthropic's example: not "fix the login bug" but "users report login fails after the session times out. look at token refresh in src/auth/, write a failing test that reproduces it, then fix it".[1][2]

  2. 02

    Pick work with a pass or fail check

    Agents do best on problems with clear success criteria, where reaching the answer takes tedious trial and error. A failing test, a build's exit code or a script that diffs output against a fixture all work. If the only check is "looks good to me", do that part yourself.[1][3]

  3. 03

    When you are unsure, have the agent interview you first

    Ask it to interview you until it could write the spec, and save the result to SPEC.md. Then start a fresh session that builds from the file. The spec is also what you review the diff against later.[1]

  4. 04

    Say how much you want, and how you want it built

    Claude tends to read a request conservatively and build the smallest thing that satisfies it. If you want empty states, error states and keyboard support, say "be ambitious" and list them. For production code, be specific: a function signature plus its behavior leaves little to guess.[1][5]

  5. 05

    Keep repeat context in one short file

    Put the commands that build and test the project in AGENTS.md or CLAUDE.md so every task starts with them. Only write what the agent cannot find by reading the code. Anthropic suggests keeping CLAUDE.md under 200 lines.[1][4]

Pitfalls

  • Writing "make it better" and then judging the result against a spec that only exists in your head.
  • Adding IMPORTANT or all caps to a rule the agent keeps missing, when it should be a hook or the file should be shorter.

Sources

  1. Best practices for Claude Code, Anthropic
  2. Prompting, OpenAI (Codex docs)A useful Codex prompt names the behavior you want, points to the relevant code or reproduction steps, preserves important constraints, and says how to verify the change.
  3. Designing agentic loops, Simon Willison
  4. AGENTS.md, agents.md
  5. Here’s how I use LLMs to help me write code, Simon Willison