A product requirement document (PRD) for a new feature is often taught as if it starts from scratch. In reality, most software development happens on existing codebases. This means the PRD must reflect the current state of the app — not just what could be built.
Start with the current state
Greenfield PRDs begin with a product vision. Brownfield PRDs begin with what already exists.
For example, if an app already has a workspaces table and a workspace_members table linking users to workspaces, a new feature like sprint velocity forecasting cannot invent its own ownership model.
It must belong to a workspace. The PRD must name existing tables so the agent knows to extend the model, not build a parallel one.
One developer noted that if the PRD omits the schema, the agent will guess. Guesses don’t match production. This leads to broken features and user confusion.
Understanding the current state is not optional — it is foundational. Without a clear picture of the existing architecture, any new feature risks introducing inconsistencies or conflicts. For instance, if the app already uses a relational schema with foreign key constraints, a new table must be designed to respect those relationships. A feature that introduces a new entity without referencing an existing one may result in data isolation or orphaned records. This is especially critical in multi-tenant systems where data integrity across tenants is paramount.
Migrations are not optional
Adding a new table is simple. Handling existing data is harder.
A brownfield PRD must answer: Does the migration backfill data? What happens to rows created before the feature existed? Can it run with zero downtime?
One engineer emphasized that explicitly stating ‘no data migration required’ prevents the agent from inventing one. Silence leads to assumptions. The agent may write a migration that deletes existing data — something that breaks the app.
For instance, if a feature adds a new field to an existing table, such as a sprint duration field, the PRD must specify whether that field should be populated with default values or whether existing records should be preserved. If the migration is silent, the agent might assume that all data should be updated, leading to unintended changes. In production environments, such changes can result in data loss or incorrect analytics. A well-documented migration plan ensures that the transition is predictable and reversible, minimizing risk to users.
Moreover, downtime considerations are critical. If the app serves real-time users, a migration that requires a maintenance window must be clearly outlined. This allows operations teams to schedule updates during low-traffic periods, reducing the impact on users. A PRD that fails to address downtime may result in service interruptions, which can damage user trust and lead to negative feedback.

Define boundaries: what not to touch
In live codebases, the blast radius matters. The PRD must name which routes, tables, and components are outside the feature’s scope.
Rules must include:
- Never invent arbitrary dependencies or unapproved database tables.
- Every server action must validate input using Zod schemas.
- Every database query must respect Row Level Security (RLS) boundaries.
- Output complete, production-grade files. No // TODO or stubs.
- Do not refactor, rename, or ‘clean up’ anything outside the feature’s scope.
One team reported that without this, the agent modified auth middleware or other core systems — breaking functionality users depend on.
For example, a feature that adds a sprint forecasting module might be tempted to refactor the authentication flow to improve performance. However, such a change could break existing user sessions or permissions. By explicitly defining boundaries, the PRD ensures that the agent only implements within the defined scope. This prevents unintended side effects and maintains the stability of the entire system.
Security policies must travel with the table
Existing apps have access controls. New features must inherit them, not just approximate them.
If workspaces are isolated by RLS, the new table must get the same policy on day one.
Example policy:
ALTER TABLE public.sprints ENABLE ROW LEVEL SECURITY;
CREATE POLICY “Tenant Workspace Isolation” ON public.sprints FOR ALL USING (
workspace_id IN (
SELECT workspace_id FROM public.workspace_members
WHERE user_id = auth.uid()
)
);
One developer observed that writing ‘add RLS later’ turns a new feature into a data leak. The agent builds only what is specified — no more, no later.
Access policies are not optional add-ons. They are integral to the security model of the application. When a new table is introduced, it must inherit the same access rules as other tables to maintain consistency. This ensures that users only see data they are authorized to access, preventing unauthorized access and potential breaches.
Acceptance criteria must cover old behaviour
Greenfield criteria describe new features. Brownfield criteria describe both new and old behaviour.
For sprint velocity forecasting:

- New: Given a team with at least 3 completed sprints, when the lead creates a new sprint, then calculate and display the recommended story-point capacity with a -than a 95% confidence interval.
- Old: Given existing sprints and completed work, when a new sprint is created, then all existing sprint data, velocity history, and workspace memberships remain unchanged.
One engineer pointed out that without the second criterion, the agent has no test to ensure the app doesn’t break. Users expect yesterday’s functionality to remain intact.
Acceptance criteria are not just about what the feature does — they are about what it must not break. In a live system, even minor changes can disrupt workflows. By including both new and old behaviours, the PRD ensures that the implementation is thoroughly tested and validated against the current state of the app.
Checklist before handing off to an agent
Before sharing a PRD with an AI agent, verify six key points:
- Current tables are named.
- Migration plan is written — even if it’s ‘no migration’.
- Out-of-scope code is named.
- Access policy is included for the new table.
- Acceptance criteria cover both new and old behaviour.
- Rules exist about what not to touch.
One team found that if any of these were missing, the agent would fill gaps with guesses. In live systems, such guesses cost users — not just credits.
The original source, Writing a PRD for an Existing Codebase, provides a clear framework for this process.
For a free template, see github.com/web-dev-mehedi/ai-prd-template. A generator for full PRD suites is available at webdevmehedi.com/ai-prd-generator.
Unlike greenfield PRDs, which describe a future, brownfield PRDs describe a future that must fit within a present. The present — the live app — must be named first.
For developers working on live systems, this approach ensures stability, clarity, and user trust.
Related: Zero-Server Tools That Never Send Your Data
Related: AI Agent Isolation with Firecracker MicroVMs
Related: SchoolFlow: A Complete School Management System with Zero Commission
Sources & further reading
Featured image: original publisher image. Via original publisher. Image source
