How to Write a PRD Before Prompting AI
Most security holes in AI-built apps come from rules nobody wrote down. A one-page PRD states users, scope, permissions and testable acceptance criteria before the first prompt.
5 min read / Updated / Last checked
- Format
- Template · Beginner
- Who it is for
- Non-technical founders
- You leave with
- Write a one-page PRD that specifies users, scope, data, permissions and acceptance criteria that an AI agent and a reviewer can both check.
The problem
When researchers audited 200 deployed vibe-coded apps for a study revised on arXiv in September 2026, they traced 55.5% of the 1,186 confirmed vulnerabilities to a single failure mode the authors call hidden security rules: requirements that safe code needs but the user's request never stated, such as hashing passwords, validating input or enforcing checks on the server [1]. These rules do not change what the screen shows, so their absence goes unnoticed until someone abuses it.
The same study replayed known vulnerabilities under different prompts. Adding "ready for production" to a short request cut the rate at which the agent reintroduced the vulnerability from 25.7% to 11.0%. Rewriting the request as a detailed, technical prompt raised the rate to 45.7%. The authors suggest the agent followed the detailed instructions more literally and used less of its own security judgment [1]. More words did not help. The right decisions did.
"Build an AI marketplace" is a direction. A coding agent still has to guess the roles, the data, who may do what and what "done" means. Every guess becomes a defect or a change request later. A short PRD (product requirements document) is where those guesses are replaced by decisions before any code exists.
How it works
A PRD for AI-assisted building has three layers. Each one answers a different question for the agent and for the person reviewing its work.
Product layer: what and why. The user, the problem, the one job this version completes, the event that proves value, what is in scope and what is explicitly out. GitHub's Spec Kit puts this first: the spec covers user journeys and what success looks like, and leaves the stack and architecture to a separate planning step. The post describes coding agents as "exceptional at pattern completion, but not at mind reading" [2].
Rules layer: the hidden rules, written down. A permissions matrix of role by object by allowed action. The data you store and which fields are sensitive. Every external system, and what happens when it fails or a call repeats. This is the layer the study found missing most often.
Acceptance layer: sentences a test can check. Each requirement becomes a statement with a trigger and an observable response. EARS (Easy Approach to Requirements Syntax), developed at Rolls-Royce and first published in 2009, gives five basic patterns, including "When <trigger>, the <system> shall <response>" for events and "If <trigger>, then the <system> shall <response>" for unwanted behavior [3]. The Kiro IDE writes the requirements in its specs in this notation so each one is structured and testable [4].
The PRD then drives the build in phases. Spec Kit runs specify, plan, tasks and implement, with the developer checking each phase before the next [2]. Claude Code's documentation recommends the same shape: get the spec into a file, start a fresh session to build from it, then review the diff against that file [5].
From PRD to a reviewed slice
Fig. 01- PRDusers, rules, acceptance
- Planschema, stack, risks
- Taskssmall, testable steps
- Build sliceone job, end to end
- Reviewdiff checked against PRD
By the numbers
- of 1,186 confirmed vulnerabilities came from security rules the request never stated [1]
- 55.5%
- vulnerability reintroduction with "ready for production" added, down from 25.7% [1]
- 11.0%
- reintroduction with a detailed technical prompt, the worst condition tested [1]
- 45.7%
- of developers named AI output that is "almost right, but not quite" as a top frustration [6]
- 66%
| Vague | Testable (EARS) | Pattern |
|---|---|---|
| "Admins manage users" | When an admin deactivates a user, the system shall end that user's sessions within 60 seconds. | Event-driven |
| "It's secure" | If a member requests a record from another workspace, then the system shall return 404 and log the attempt. | Unwanted behavior |
| "It's fast" | While 50 users are active, the system shall return the task list in under 800 ms. | State-driven |
| "AI summaries" | Where AI summaries are enabled, the system shall show the source request next to each generated task. | Optional feature |
| "Changes are tracked" | The system shall record who changed each task and when. | Ubiquitous |
The study's numbers say detail is not the lever. Its most detailed prompt was its worst condition. What lowered the rate was a requirement the agent could act on, and the largest category of defects came from requirements nobody stated at all. A PRD fixes both: it states the rules, and it keeps the technical choices out of the founder's part of the document.
Developers report the same gap from the other side. In Stack Overflow's 2025 survey, 66% named output that is "almost right, but not quite" as a frustration, and 45.2% said debugging AI-generated code takes more time [6]. "Almost right" is what an agent produces when it fills unstated rules with plausible guesses.
Implementation
Copy the template into the repository as docs/PRD.md and fill it before the first prompt. The worked example below is illustrative: an assistant that turns plain-language feature requests into engineering tasks.
# PRD: Request-to-Tasks Assistant, v1
Decision maker: founder (final say on scope). Updated: 2026-11-12
## 1. Product
- User: non-technical founder with a backlog of feature requests
- Problem: requests arrive as prose, engineers re-ask the same questions
- One job (v1): turn one request into a reviewed task list
- Success event: founder exports a task list to the tracker
- In scope: paste request, generate tasks, edit, flag open questions, export CSV
- Out of scope: merging code, estimates as commitments, repository access
## 2. Rules
| Role | Requests | Task lists | Workspace settings |
|---|---|---|---|
| Owner | create, read, delete | create, read, edit, export | edit |
| Member | create, read own | read, edit | none |
| Viewer | read | read | none |
- Data stored: request text, task lists, user emails. Request text may name clients: sensitive.
- Every permission check runs on the server. The browser holds no API keys.
- LLM call: 30 s timeout, one retry, then show "Try again". Never save a partial list.
- Export is idempotent: one export ID never creates two files.
## 3. Acceptance criteria
- When an owner submits "add password reset", the system shall create tasks for
request, token, expiry, email, UI and tests, and flag open questions.
- If a request is ambiguous, then the system shall ask one clarifying question first.
- If a member opens a request from another workspace, then the system shall return 404.
- If the LLM call fails twice, then the system shall keep the request and offer a retry.
## 4. Operations
- Monthly LLM budget cap, alert at 80%
- Daily backups, one restore tested before launch
- Repository, hosting and API keys owned by company accountsThen hand the agent the PRD with a prompt that asks for questions before code.
Read docs/PRD.md. Do not write code yet.
Return, in this order:
1. Every assumption you would have to make that the PRD does not settle.
2. A data schema that covers the roles and objects in section 2.
3. One test per acceptance criterion in section 3, including the 404 case.
4. The smallest vertical slice that delivers the one job end to end.
Point out anything in the PRD that is wrong or contradictory.
Wait for answers to item 1 before building.The assumptions list is the most valuable output. Each item is a hidden rule surfacing before it becomes code. Write the answers into the PRD, not into the chat, so the next session and the next developer see them. Build one vertical slice end to end before asking for the second.
Test it
Review the PRD before it reaches the agent. Each line has an expected result.
- Permissions matrix. Every role and object cell has an entry. Expected: no blanks. Write "none" where an action is not allowed.
- Acceptance criteria. Each one names a trigger and an observable response. Expected: a developer could write the test without asking a question.
- Failure rules. Every external system in the PRD has a timeout, retry or fallback rule. Expected: payments, email and the LLM call all covered.
- Sensitive data. Fields that identify people or clients are named. Expected: at least one line, or an explicit "none".
- Out of scope. At least three tempting features listed. Expected: the agent's plan does not include any of them.
- Assumption check. Run the kickoff prompt twice in fresh sessions. Expected: short lists that mostly overlap. A long or divergent list means the PRD still leaves decisions to the model.
- Diff review. After the first slice, ask a reviewer, human or agent, to check the diff against section 3 and report gaps that affect correctness, as Claude Code's documentation suggests [5]. Expected: every criterion maps to a test.
Decision
Write the PRD before the first prompt on any codebase you intend to keep. One page is enough if it settles roles, data, failures and acceptance criteria.
- Spend the founder's time on sections 1 to 3. Leave stack and architecture to the planning step, where engineers and agents propose and you approve.
- Keep the PRD in the repository and update it when a decision changes. A decision made in chat is lost at the next session.
- If you cannot state the user, the one job and the success event, stop building and validate the problem first.
- For the business-side scope a developer quotes against, see AI MVP Scope Pack: A One-Page Founder Template.
Sources
- [1]Understanding the (In)Security of Vibe-Coded Applications (opens in a new tab)arXiv (Deng, Fan, Meng), September 2026
- [2]Spec-driven development with AI: Get started with a new open source toolkit (opens in a new tab)GitHub Blog, September 2025
- [3]EARS: The Easy Approach to Requirements Syntax (opens in a new tab)Alistair Mavin, November 2026
- [4]Feature Specs (opens in a new tab)Kiro Docs, November 2026
- [5]Best practices for Claude Code (opens in a new tab)Anthropic, November 2026
- [6]2025 Developer Survey: AI (opens in a new tab)Stack Overflow, July 2025
Technical guidance, not legal or security certification.
Related resources
Need a technical review of an AI-built MVP?
Discuss your build