Loading WURK...
RomanMotion
RomanMotion
Product ad & launch videos · 3D product visuals · app & AI builder. Concept to final cut in days. Open for projects.

Write a spec your coding agent can finish and verify

Use a copy-paste spec to bound the change, define checks, and show exactly what done looks like.

Published on October 30, 20267 min read

You have a coding agent ready to build a feature, but your request is still a vague sentence. Leave the behavior and boundaries open, and you may get confident code that solves the wrong problem. This template helps you define the job, check the result, and hand over a feature you can explain.

Write down the goal, non-goals, file boundaries, an example input and output, the checks to run, and what you will see when the work is complete. Keep lasting project rules in a notes file so each task starts with the same ground rules.

Turn a vague request into a contract

“Add a contact form” leaves room for guesses: where the form belongs, what fields it needs, where submissions go, what errors should look like, and whether a success message is enough. The agent may choose defaults that compile but do not match your product or the client’s request.

A useful spec narrows the task before code changes begin. State the outcome, then list what is excluded. Name the stack to keep, the files that may change, and the files that must stay untouched. Give an example input and the expected result, including a failure case if it matters.

Then define checks the agent must run. “Make sure it works” is hard to verify. “Run the project’s test command, submit a valid form, and confirm a blank message returns a field error” gives both of you something observable.

End with “done means” in terms of what you will see: a screen, a response, a saved record, an error state, or a test result. If a needed decision is missing, tell the agent to ask rather than silently choosing a behavior.

Put repeatable rules in the repository

A project notes file saves you from repeating setup commands and house rules in every request. The AGENTS.md format is a place for project instructions such as build and test commands, code conventions, and guidance for coding agents.

Keep it short enough to stay useful. Include the commands that work in the repository, how tests should be run, where changes belong, and any areas the agent must not edit. Don’t paste a generic command list that the project does not use.

For example, your file might say: “Run pnpm test before reporting completion. Keep form validation on the server. Do not change deployment settings without asking.” Replace those examples with the commands and rules for your project.

A notes file does not replace the task spec. It carries rules that apply repeatedly; the spec defines the particular change. Tell the agent where to find the notes and ask it to report a gap if it cannot find a required command or understand a file boundary.

Review the notes as the project changes. An old test command can send the agent down the wrong path just as easily as a vague task can.

Copy and adapt this spec

Paste this into a task, replacing each bracketed field. Keep the goal to one sentence and make the acceptance checks testable.

Goal:
[One sentence describing the user-visible result.]

Non-goals:
- [Related work that is out of scope.]
- [Anything the agent must not add or change.]

Constraints:
- Stack: [existing stack; do not change it unless approved]
- Files you may edit: [paths or directories]
- Files you must not edit: [paths or directories]
- Dependencies: [none, or explain what is allowed]
- Follow the project notes in [AGENTS.md or other file].

Inputs and outputs:
- Example input: [a realistic request or user action]
- Expected output: [exact response, screen, or saved result]
- Invalid input and expected behavior: [if relevant]

Acceptance checks:
- [Command the agent must run and the expected result.]
- [User flow to try and what success looks like.]
- [Edge case to try and expected behavior.]

Done means:
- [What I will see when I review the feature.]
- [What verification the agent must report, including any
  check it could not run.]

If a requirement is ambiguous or a check cannot be run,
stop and report the question or limitation. Do not guess.

Avoid checks that ask the agent to judge its own quality, such as “make the form clean.” Say what can be observed: the form shows an error beside an invalid field, and a valid submission produces the specified result.

Example: a contact form with server-side validation

This illustrative spec assumes the app already has a place to save contact submissions. Replace the paths and storage requirement with those of your project before using it.

Goal:
Add a contact form that saves a visitor’s name, email, and message.

Non-goals:
- No account creation, file uploads, or marketing opt-in.
- Do not add a new email provider or dependency.

Constraints:
- Stack: use the existing app stack.
- Files you may edit: the contact page, its server handler,
  the existing submission store, and related tests.
- Files you must not edit: deployment settings and unrelated pages.
- Validate all fields on the server, even if the browser also checks them.
- Use the existing submission store; if it does not exist, stop and ask.
- Follow the project notes in AGENTS.md.

Inputs and outputs:
- Example input: name “Mina”, email “[email protected]”,
  message “Please send me the project details.”
- Expected output: the server saves the submission and the page
  shows “Message received.”
- Invalid input: blank message or malformed email.
- Expected behavior: return field-specific errors and do not save
  the submission.

Acceptance checks:
- Run the existing test command from AGENTS.md and report its result.
- Submit the example input; confirm the saved record and success message.
- Submit a blank message and a malformed email; confirm each is
  rejected by server-side validation with a useful field error.
- Simulate a save failure; confirm the page does not show success.

Done means:
- The form has visible labels, success feedback, and field errors.
- Valid submissions are saved; invalid submissions are rejected.
- The agent reports changed files, test results, and unrun checks.

The example makes the boundary explicit: browser-side messages may help the visitor, but they do not replace server-side validation. It also specifies what “received” means. If submissions must be emailed instead of saved, write that requirement and its failure behavior into the spec rather than relying on the agent to guess.

Split features into work you can verify

A large request often bundles several outcomes: a form, storage, notifications, an admin view, and deployment changes. If one spec covers all of them, it can be harder to tell which part failed and what still needs review.

Break the work at user-visible or technical boundaries. One spec can add the form and server validation against an existing store. A later spec can cover notifications, including what happens when delivery fails. Another can define an admin view. Each piece should have its own allowed files and acceptance checks.

Keep dependencies between steps explicit. Don’t ask for an admin inbox until the storage behavior is defined. If the first piece exposes an unanswered decision, write it down before starting the next. Check each completed piece against its spec before building on top of it.

If you want a workspace to run specs like this, you can try the ZCode agent harness free with our invite link; its Goals feature is built around planning, execution and verification, which is exactly what a good spec feeds. The GLM Coding Plan is one subscription for agent coding tools, including ZCode (overview), and you can get a referral discount on GLM coding plans with our referral link: Z.ai's campaign terms give invited users a referral discount on their first GLM Coding subscription. Both Z.ai links here are our invite links.

Check the spec before handing it over

Before you send the task, scan for the parts that leave room for guessing:

  • Is the goal a clear, user-visible outcome?
  • Are non-goals and file boundaries specific?
  • Is there an example input and expected output?
  • Are failure cases described where they matter?
  • Does each acceptance check say what to run or observe?
  • Does “done” describe what you will see and what verification will be reported?

If an answer is missing, tighten the spec first. A coding agent can carry out the work, but you still decide whether the checks match the feature and whether the result is ready to show a client. Find more practical build breakdowns on our blog.

For the briefing side, read prompting patterns that save hours.

If this saved you time, a small tip on this post helps keep these guides coming.

Conversation

Join the conversation

Share your thoughts with the author and other readers.

Comments0

Checking your account…

Latest comments

0
No comments yet. Be the first to share your thoughts.