PRD template for AI coding agents
A PRD for a coding agent states the problem, numbered requirements, what is out of scope and acceptance criteria the agent can check on its own. Copy the example below into your repository, fill in each section for your feature, and hand the file to Claude Code, Cursor or Codex as the task.
Updated
Files
# CSV export for invoices
Status: Ready to build
Owner: Dana (product), Sam (engineering)
Updated: 2026-11-08
## Problem
Accountants ask for a spreadsheet of invoices every month. Today support exports it by hand from
the database, which takes about 20 minutes per request and arrives a day late.
## Goal
A signed-in user can download their invoices as a CSV file from the Invoices page, filtered the
same way as the list on screen.
Success: support export requests drop to zero within a month of release.
## Users and stories
- As an owner, I download last month's paid invoices so my accountant can reconcile them.
- As an accountant with read access, I export invoices for one customer without asking the owner.
## Requirements
1. An **Export CSV** button sits next to the filters on the Invoices page.
2. The file contains the invoices that match the current filters, in the list's order.
3. Columns, in this order: number, customer, issue date, due date, status, currency, amount.
4. Amounts are decimals with two places (19.99), dates are ISO 8601 (2026-11-08).
5. The file name is `invoices-YYYY-MM-DD.csv`, using the day of the export.
6. Exports of up to 10,000 rows download straight away. Larger exports show an error that asks
the user to narrow the filters.
7. Users with read access can export. Nobody can export another workspace's invoices.
## Out of scope
- Excel or PDF formats.
- Scheduled or emailed exports.
- Exporting line items.
## Technical notes
- Add `GET /api/invoices/export` that takes the same query parameters as `GET /api/invoices`.
- Reuse `listInvoices` in `lib/invoices.ts` for filtering and permissions. Don't write a second
query.
- Stream the response with `Content-Type: text/csv` and `Content-Disposition: attachment`.
- Escape fields per RFC 4180: quote fields that contain commas, quotes or line breaks.
## Acceptance criteria
- [ ] With the "Paid" and "October" filters set, the file holds exactly the invoices on screen.
- [ ] A customer named `Smith, "Jr" Ltd` opens correctly in Excel and Google Sheets.
- [ ] A user with read access can export; a signed-out request gets 401.
- [ ] A filter matching 10,001 invoices shows the error and downloads nothing.
- [ ] Tests cover the CSV escaping and the permission check.
## Open questions
- Should the export include voided invoices when no status filter is set? Current answer: yes,
matching the list.Save with your agent
Connect the Sniptide MCP server once, then ask your agent to keep this template in your library. It reads the files from the JSON version of this page and saves them as a private snippet you can edit and file into a collection.
claude mcp add --transport http sniptide https://app.sniptide.com/api/mcpRead https://sniptide.com/templates/prd-for-agents.json and save its files as a private Sniptide snippet titled "PRD template for AI coding agents".Why a PRD for an agent reads differently
A person reading a PRD fills gaps with context from meetings and Slack. An agent fills them by guessing, and its guesses look plausible enough to pass a quick review. The fix is to write down what a teammate would have asked: which columns, in what order, what happens at 10,001 rows, which function to reuse. Every vague line in the spec becomes a decision the agent makes for you.
Keep the file in the repository, such as docs/specs/, so the agent can read it next to the code and the spec changes in the same pull request as the feature.
What each section does
Section | What it gives the agent | How to write it |
|---|---|---|
Problem | The reason behind the feature, which settles small choices the spec doesn't cover. | Who hurts, how often, what it costs today. |
Goal | One sentence of the outcome, and how you'll know it worked. | A user-visible result, not a list of tasks. |
Users and stories | Who the feature is for and which permissions matter. | One story per role that behaves differently. |
Requirements | The behavior, one checkable statement per number. | Exact names, formats, limits and orders. Numbers let you say "requirement 6 is wrong" in review. |
Out of scope | The work the agent must not start. | Name the features people will assume come along. Agents tend to add them. |
Technical notes | Where the change goes and what to reuse. | File paths and function names. This stops a second copy of logic that already exists. |
Acceptance criteria | The tests the agent writes and runs before it says it's done. | Concrete inputs and expected results, including the awkward ones. |
Open questions | Decisions still pending, with the current answer. | Give a default so the agent isn't blocked. |
The acceptance criteria do the most work. An agent that can run a check knows when it is finished; an agent told to "make sure it works" decides for itself.
Hand it to the agent
Point the agent at the file and ask for a plan before code, so you can correct a misunderstanding while it is cheap:
Read docs/specs/csv-export.md. Before you write code, list the files you'll change and how you'll
test each acceptance criterion. Wait for my go-ahead.Rules that apply to every task, such as commands and code style, belong in your AGENTS.md or CLAUDE.md rather than in each spec.
Variant: a one-page spec for a small change
A bug fix or a small feature needs only three sections. Keep the acceptance criteria even when everything else goes.
# Empty state on the Invoices page
## Requirements
1. When a workspace has no invoices, the list shows the `EmptyState` component from
`components/ui/empty-state.tsx` instead of an empty table.
2. Title: "No invoices yet". Help text: "Create your first invoice to see it here."
Action: a **New invoice** button that opens `/invoices/new`.
3. With filters set and no matches, show "No invoices match these filters" and a
**Clear filters** button instead.
## Out of scope
- Illustrations or animation.
## Acceptance criteria
- [ ] A new workspace shows the empty state with the button.
- [ ] A workspace with invoices but no matches shows the filter message.