PromptAI agents and skillsOutput shown

Brief a coding agent so it does the right thing

Goal, context, limits and a way to check. The five parts most failed tasks are missing.

What you get

You should get an agent that starts with a short plan and, if needed, one clarifying question instead of guessing. The brief gives it a goal, context, limits and a clear finish line, which are the parts most failed tasks are missing. The 'done when' line is the most important: without it the agent decides for itself when to stop. The 'how to verify' line lets it check its own work.

Example output (illustration of the shape of a result, not a recorded test)

Agent reply: 'Plan: 1) read utils/date.py, 2) fix the timezone bug, 3) add a test for UTC midnight, 4) run pytest. One question: should dates be stored in UTC?'

How to use it

  1. Scroll to the end of this page and copy the prompt.
  2. Replace each [bracket] with the real task, files and checks.
  3. Paste it into your agent. Read its first reply before it changes anything.

Fill in these fields

Change only the parts in [brackets]. The rest of the wording keeps the answer on task.

FieldWhat to enter
[one sentence goal]Your own details.
[the specific change]Your own details.
[files or behaviour that must not change]Your own details.
[observable checks]Your own details. Example: these tests pass, this page shows X
[the exact commands to run]Your own details.

Change it for your case

  • For a bug fix, set 'Done when' to a test that currently fails and must pass.
  • For a refactor, add 'behaviour must not change; existing tests must still pass'.
  • For a risky task, add 'ask before deleting or renaming any file'.

Tips

  • 'Done when' is the most useful line. Without it the agent decides when to stop.

The prompt

Copy it, then fill in the [brackets]. We have not tested this prompt; we call a prompt tested only when a test result is shown.

Task: [one sentence goal].
Context: [where the code lives, what already exists, links to the files].
Do: [the specific change].
Do not: [files or behaviour that must not change].
Done when: [observable checks, e.g. these tests pass, this page shows X].
How to verify: [the exact commands to run].
If something is unclear, ask one question before you start.