A prompt requirements document (PRD in the AI coding context) is a structured specification designed for AI coding agents (Cursor, Claude Code, Windsurf, and GitHub Copilot) rather than for human engineers. It contains the same information as a traditional PRD but formatted for machine consumption: explicit entity names, API contracts, state machines, and constraint lists that an AI agent can apply consistently across a coding session. This document is the bridge between a product idea and a coherent AI-generated implementation.
Why traditional PRDs don't work as AI coding context
A traditional PRD is written for human engineers. It uses narrative prose, explains context and rationale, and relies on the reader's domain knowledge to fill gaps. A human engineer reading "add a password reset flow" knows to use secure tokens, short expiry windows, and a "link already used" error state, they've built auth before.
An AI coding agent reading "add a password reset flow" makes decisions based on statistical patterns in its training data. It will produce code that looks reasonable but may not match your specific data model, authentication library choices, or error handling conventions. It doesn't know your User entity has a passwordHash field, not a password_hash field. It doesn't know you're using Resend for email, not SendGrid. It doesn't know your token table is called PasswordResetToken, not reset_tokens.
The prompt requirements document solves this by making the implicit explicit. Instead of "add a password reset flow," it says: "Add a password reset flow using the User.email field for lookup, creating a PasswordResetToken record with tokenHash, expiresAt (15 minutes), and usedAt fields. Send the reset email via Resend using the existing sendTransactionalEmail() helper in lib/email.ts. Return the same response for valid and invalid emails (prevents enumeration). Invalidate the token on first use."
The prompt requirements document format
Section 1: Feature context (2 to 3 sentences)
State what the feature does and why it exists. Keep this short, the AI coding agent needs context, not a business case.
This feature adds a password reset flow to allow users who have forgotten their password to regain access without contacting support. It is triggered from the login screen and delivered via email. Security requirements: token expiry (15 min), single-use, no account enumeration.
Section 2: Data model changes
Use your exact field names. This is the most important section, field name consistency prevents half the bugs in AI-generated code.
New table:
PasswordResetTokenFields:
id(cuid),tokenHash(string, SHA-256 of the raw token),userId(FK → User.id, cascade delete),expiresAt(DateTime),usedAt(DateTime, nullable),createdAt(DateTime, default now)Index:
tokenHash(unique),userIdNote: Store the hash, not the raw token. The raw token is sent in the email URL only.
Section 3: API contracts
Define each endpoint with exact paths, methods, request bodies, and response shapes. AI agents follow these contracts precisely.
POST /api/auth/forgot-passwordBody:
{"email": "string"}Response (always 200, regardless of whether email exists):
{"message": "If this email is registered, you'll receive a reset link."}Side effect: If email exists in User table, create PasswordResetToken record, send email via
sendTransactionalEmail()with the raw token in the URL (https://scriptonia.dev/reset-password?token={rawToken}).