<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MD Mehedi Hasan</title>
    <description>The latest articles on DEV Community by MD Mehedi Hasan (@web-dev-mehedi).</description>
    <link>https://dev.to/web-dev-mehedi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4223814%2F112fbab9-f960-4fbd-8311-870674f9a477.png</url>
      <title>DEV Community: MD Mehedi Hasan</title>
      <link>https://dev.to/web-dev-mehedi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/web-dev-mehedi"/>
    <language>en</language>
    <item>
      <title>Writing a PRD for an existing codebase: what changes when the app already exists</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Mon, 23 Nov 2026 04:39:15 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/writing-a-prd-for-an-existing-codebase-what-changes-when-the-app-already-exists-3gdh</link>
      <guid>https://dev.to/web-dev-mehedi/writing-a-prd-for-an-existing-codebase-what-changes-when-the-app-already-exists-3gdh</guid>
      <description>&lt;h1&gt;
  
  
  Writing a PRD for an existing codebase: what changes when the app already exists
&lt;/h1&gt;

&lt;p&gt;Most PRD guides assume a blank page: pick a stack, design the schema, name the tables. Real work rarely starts there. You are usually adding a feature to an app that already has users, a database full of rows, and an agent that will happily "improve" code it was never asked to touch.&lt;/p&gt;

&lt;p&gt;A PRD for an existing codebase is a different document. It is not just "what to build" — it is "what already exists, what must not break, and exactly where the new thing fits." Here is what changes, section by section.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Start with the current state, not the vision
&lt;/h2&gt;

&lt;p&gt;A greenfield PRD opens with the product vision. A brownfield PRD opens with what is already true: the tables that exist, the endpoints that already serve traffic, the auth model in production.&lt;/p&gt;

&lt;p&gt;For example, say your app already has a &lt;code&gt;workspaces&lt;/code&gt; table and a &lt;code&gt;workspace_members&lt;/code&gt; table tying users to workspaces. A new feature — sprint velocity forecasting — does not get to invent its own ownership model. It belongs to a workspace, full stop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nf"&gt;gen_random_uuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;workspaces&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;DELETE&lt;/span&gt; &lt;span class="k"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;target_points&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target_points&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That &lt;code&gt;workspace_id&lt;/code&gt; foreign key is the whole point. The PRD names the existing tables the new table references, so the agent extends the model instead of building a parallel one. If your PRD never mentions the current schema, the agent will guess — and its guess will not match production.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Every migration is a requirement, not an afterthought
&lt;/h2&gt;

&lt;p&gt;New tables are the easy part. The hard part is the data that is already there. A brownfield PRD has to answer, in writing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does the migration backfill anything, or only add the new table?&lt;/li&gt;
&lt;li&gt;What happens to rows created before the feature existed?&lt;/li&gt;
&lt;li&gt;Can the migration run with zero downtime, or does it need a maintenance window?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the answer is "add the table, no backfill, no breaking change," write that down too. An agent that sees an explicit "no data migration required" will not invent one. An agent that sees silence will decide for itself — usually by writing a migration that drops something you needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Name the code the agent must NOT touch
&lt;/h2&gt;

&lt;p&gt;This is the rule greenfield PRDs never need. In a live codebase, the blast radius matters as much as the feature. The PRD should name the boundaries: which routes, which tables, which shared components are out of scope for this change.&lt;/p&gt;

&lt;p&gt;The agent rules in the implementation file exist for exactly this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Never invent arbitrary dependencies or unapproved database tables.&lt;/li&gt;
&lt;li&gt;Every server action must validate input payloads using Zod schemas.&lt;/li&gt;
&lt;li&gt;Every database query must respect Supabase Row Level Security boundaries.&lt;/li&gt;
&lt;li&gt;Output complete, production-grade files. Do not use &lt;code&gt;// TODO&lt;/code&gt; or placeholder stubs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Add a fifth line for brownfield work: do not refactor, rename, or "clean up" anything outside the feature's scope. Without that sentence, a well-meaning agent will "fix" your auth middleware while adding a sprint forecast — and you will find out from your users.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Security policies travel with the table
&lt;/h2&gt;

&lt;p&gt;Existing apps already have an access model, and the new feature has to inherit it — not approximate it. If workspaces are isolated by Row Level Security, the new table gets the same policy on day one, in the same file as the table:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt; &lt;span class="no"&gt;ENABLE&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt; &lt;span class="no"&gt;LEVEL&lt;/span&gt; &lt;span class="no"&gt;SECURITY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="no"&gt;POLICY&lt;/span&gt; &lt;span class="s2"&gt;"Tenant Workspace Isolation"&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt;
  &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;workspace_members&lt;/span&gt;
      &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Add RLS later" is how a new feature becomes a data leak in a mature app. The PRD must contain the policy, because the agent builds what the spec says — nothing more, nothing later.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Acceptance criteria must cover the old behaviour too
&lt;/h2&gt;

&lt;p&gt;Greenfield criteria describe the new feature. Brownfield criteria describe the new feature &lt;em&gt;and&lt;/em&gt; the old behaviour that must survive it:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;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 95% confidence interval.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the new behaviour. The brownfield half is the second criterion, the one people forget:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;GIVEN existing sprints and completed work, WHEN the new sprint is created, THEN all existing sprint data, velocity history, and workspace memberships remain unchanged.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Without the second sentence, the agent has no test for "did I break the app." With it, the definition of done includes the thing your users actually care about — that yesterday still works.&lt;/p&gt;

&lt;h2&gt;
  
  
  The brownfield checklist
&lt;/h2&gt;

&lt;p&gt;Before you hand the PRD to an agent, check six things: the current tables are named, the migration plan is written (even if it is "no migration"), the out-of-scope code is named, the new table inherits the existing access policy, the acceptance criteria cover old behaviour as well as new, and the agent has written rules about what not to touch. If one is missing, the agent will fill the gap with a guess — in a live codebase, guesses cost users, not just credits.&lt;/p&gt;

&lt;p&gt;If you want the shape, the free template behind this format is on GitHub, no signup: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if you would rather generate the whole four-file suite from one paragraph — PRD, UI/UX spec, schema with RLS, and agent rules — the generator is here: &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt; — 50 free credits on signup, plans from ৳99/mo with bKash and Nagad.&lt;/p&gt;

&lt;p&gt;A greenfield PRD describes a future. A brownfield PRD describes a future that has to fit inside a present — and names the present first.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>ai</category>
      <category>showdev</category>
      <category>prd</category>
    </item>
    <item>
      <title>5 PRD mistakes that make your AI coding agent rebuild the same feature twice</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Sun, 22 Nov 2026 05:44:53 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/5-prd-mistakes-that-make-your-ai-coding-agent-rebuild-the-same-feature-twice-5e12</link>
      <guid>https://dev.to/web-dev-mehedi/5-prd-mistakes-that-make-your-ai-coding-agent-rebuild-the-same-feature-twice-5e12</guid>
      <description>&lt;h1&gt;
  
  
  5 PRD mistakes that make your AI coding agent rebuild the same feature twice
&lt;/h1&gt;

&lt;p&gt;You hand a PRD to Cursor or Claude Code. It builds the feature. You review it, spot something wrong, and ask for a fix. It rebuilds — and breaks something that was working. Repeat twice more and your afternoon is gone, along with the credits.&lt;/p&gt;

&lt;p&gt;Most of the time the agent is not the problem. The PRD left a decision open, and the agent guessed — differently each time. These are the five gaps I see most often, and what a complete spec does about each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Acceptance criteria that say "should work" instead of GIVEN-WHEN-THEN
&lt;/h2&gt;

&lt;p&gt;"The sprint forecast should be accurate" is not a criterion. Accurate how? For which team? With what data?&lt;/p&gt;

&lt;p&gt;A testable criterion names the setup, the trigger, and the expected result:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;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 95% confidence interval.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That sentence comes straight from the sample spec my generator produces for TaskPulse, a sprint-tracking app. With it, the agent has one thing to build and you have one thing to check. Without it, "accurate" means whatever the agent decides today — and something else tomorrow.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. A feature with no owner in the database
&lt;/h2&gt;

&lt;p&gt;A PRD can describe a feature beautifully and still never say where it lives. "Sprints belong to a workspace" is a sentence; the schema is the commitment:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nf"&gt;gen_random_uuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;workspaces&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;DELETE&lt;/span&gt; &lt;span class="k"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;target_points&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target_points&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If the PRD never names the table, the agent invents one — and the next prompt invents a different one. The rebuild is not a bug. It is the PRD failing to pin the entity down the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Security added "later"
&lt;/h2&gt;

&lt;p&gt;Every PRD has a security section. Most of them say "add Row Level Security" and move on. The table ships, the policy never arrives, and the first real user can read another workspace's data.&lt;/p&gt;

&lt;p&gt;The policy has to arrive with the table, in the same file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt; &lt;span class="no"&gt;ENABLE&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt; &lt;span class="no"&gt;LEVEL&lt;/span&gt; &lt;span class="no"&gt;SECURITY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="no"&gt;POLICY&lt;/span&gt; &lt;span class="s2"&gt;"Tenant Workspace Isolation"&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt;
  &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;workspace_members&lt;/span&gt;
      &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Add it in the hardening sprint" is how multi-tenant leaks are born. If the PRD does not contain the policy, the agent will not write it — it builds what the spec says, nothing more.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. API limits that live only in someone's head
&lt;/h2&gt;

&lt;p&gt;"Name must be reasonable" is not a rule. The API contract has to state the boundary in numbers, using the same names the table uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// POST /api/v1/sprints/create&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;CreateSprintSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;workspaceId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;startDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;endDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;targetPoints&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;positive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;3–64 characters, positive target, same field names as the database. When the limit is written down, the agent validates it. When it is not, the agent accepts anything — and the rebuild starts when a user types a 200-character name and the UI breaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. No rules telling the agent what NOT to do
&lt;/h2&gt;

&lt;p&gt;A PRD tells the agent what to build. It rarely tells it what to avoid. So the agent helpfully adds a dependency you never approved, invents a table the schema never mentioned, or leaves a &lt;code&gt;// TODO&lt;/code&gt; where the real logic should be.&lt;/p&gt;

&lt;p&gt;That is why the fourth file of the suite exists: deterministic rules for the agent itself. The ones that matter most:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Never invent arbitrary dependencies or unapproved database tables.&lt;/li&gt;
&lt;li&gt;Every server action must validate input payloads using Zod schemas.&lt;/li&gt;
&lt;li&gt;Every database query must respect Supabase Row Level Security boundaries.&lt;/li&gt;
&lt;li&gt;Output complete, production-grade files. Do not use &lt;code&gt;// TODO&lt;/code&gt; or placeholder stubs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rules like these are not decoration. They are the difference between an agent that builds the spec and an agent that improvises a new one on every run.&lt;/p&gt;

&lt;h2&gt;
  
  
  The check before you hand it over
&lt;/h2&gt;

&lt;p&gt;Before your PRD reaches an agent, check five things: every feature has a GIVEN-WHEN-THEN criterion, every entity has a table, every table has its access policy, every endpoint has typed limits, and the agent has written rules about what not to do. If one is missing, the rebuild is already scheduled — you just do not know it yet.&lt;/p&gt;

&lt;p&gt;If you want the shape, the free template behind this format is on GitHub, no signup: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if you would rather generate the whole four-file suite from one paragraph — PRD, UI/UX spec, schema with RLS, and agent rules — the generator is here: &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt; — 50 free credits on signup, plans from ৳99/mo with bKash and Nagad.&lt;/p&gt;

&lt;p&gt;A PRD is not a document. It is a set of decisions, written down before the agent has to guess them.&lt;/p&gt;

</description>
      <category>prd</category>
      <category>ai</category>
      <category>showdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>From PRD to PostgreSQL: how one paragraph becomes a database schema</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Sat, 21 Nov 2026 04:48:01 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/from-prd-to-postgresql-how-one-paragraph-becomes-a-database-schema-3091</link>
      <guid>https://dev.to/web-dev-mehedi/from-prd-to-postgresql-how-one-paragraph-becomes-a-database-schema-3091</guid>
      <description>&lt;h1&gt;
  
  
  From PRD to PostgreSQL: how one paragraph becomes a database schema
&lt;/h1&gt;

&lt;p&gt;Most PRD generators stop at prose. You get a nice document that says "the system shall support sprints," and then a developer still has to decide what a sprint &lt;em&gt;is&lt;/em&gt; in the database: which table, which columns, who can see it, and what the API accepts.&lt;/p&gt;

&lt;p&gt;That gap is where builds drift. The PRD says one thing, the schema says another, and by the time anyone notices, there is production data in the wrong shape.&lt;/p&gt;

&lt;p&gt;I built my generator to close that gap: one paragraph in, and out comes the PRD &lt;em&gt;and&lt;/em&gt; the PostgreSQL schema &lt;em&gt;and&lt;/em&gt; the typed API contracts, all agreeing with each other. Here is what that path actually looks like, using the sample spec the generator produces for a sprint-tracking app called TaskPulse.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: the requirement names the entity
&lt;/h2&gt;

&lt;p&gt;The PRD says, in plain language: "An engineering lead creates a sprint with a name, a start date, an end date, and a target story-point capacity. Sprints belong to a workspace."&lt;/p&gt;

&lt;p&gt;That one sentence already contains the whole table: an entity (sprint), its fields (name, start, end, target points), and its relationship (belongs to a workspace). The generator's job is to turn that sentence into DDL instead of leaving it as prose:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nf"&gt;gen_random_uuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="kt"&gt;UUID&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt; &lt;span class="k"&gt;REFERENCES&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;workspaces&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="k"&gt;DELETE&lt;/span&gt; &lt;span class="k"&gt;CASCADE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;TEXT&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;start_date&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;end_date&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;NOT&lt;/span&gt; &lt;span class="kc"&gt;NULL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;target_points&lt;/span&gt; &lt;span class="kt"&gt;INTEGER&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;CHECK&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;target_points&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="kt"&gt;TIMESTAMPTZ&lt;/span&gt; &lt;span class="k"&gt;DEFAULT&lt;/span&gt; &lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Nothing here is invented. Every column traces back to a line in the PRD, and the &lt;code&gt;CHECK&lt;/code&gt; on target points traces back to the acceptance criteria ("target capacity must be a positive number"). When a column cannot be traced to a requirement, that is a smell — it means someone guessed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: the schema carries its own security
&lt;/h2&gt;

&lt;p&gt;A table without an access rule is a leak waiting for a query. So the same file that defines the table also defines who can touch it — a Row Level Security policy that ties every row to workspace membership:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt; &lt;span class="no"&gt;ENABLE&lt;/span&gt; &lt;span class="k"&gt;ROW&lt;/span&gt; &lt;span class="no"&gt;LEVEL&lt;/span&gt; &lt;span class="no"&gt;SECURITY&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="no"&gt;POLICY&lt;/span&gt; &lt;span class="s2"&gt;"Tenant Workspace Isolation"&lt;/span&gt; &lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sprints&lt;/span&gt;
  &lt;span class="k"&gt;FOR&lt;/span&gt; &lt;span class="k"&gt;ALL&lt;/span&gt; &lt;span class="k"&gt;USING&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="k"&gt;IN&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;SELECT&lt;/span&gt; &lt;span class="n"&gt;workspace_id&lt;/span&gt; &lt;span class="k"&gt;FROM&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;workspace_members&lt;/span&gt;
      &lt;span class="k"&gt;WHERE&lt;/span&gt; &lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This matters because the policy is generated &lt;em&gt;with&lt;/em&gt; the schema, not bolted on later. The most common multi-tenant bug I have seen is a table that shipped without RLS because "we will add it in the hardening sprint" — and the hardening sprint never came. When the schema and the policy arrive together, there is no later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: the API contract is typed against the same names
&lt;/h2&gt;

&lt;p&gt;The PRD's acceptance criteria say a sprint is created with a name of 3–64 characters and a positive target. The API contract enforces exactly that, with the same names the table uses:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// POST /api/v1/sprints/create&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;CreateSprintSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;workspaceId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;startDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;endDate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;targetPoints&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;positive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;40&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Three documents, one set of names. The PRD says &lt;code&gt;target_points&lt;/code&gt;, the table has &lt;code&gt;target_points&lt;/code&gt;, the payload has &lt;code&gt;targetPoints&lt;/code&gt; — and the rules file (the fourth file of the suite) tells the coding agent never to invent a different name. That is the whole trick: the schema is not a separate artefact. It is the PRD, written in SQL.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why generate it instead of writing it by hand
&lt;/h2&gt;

&lt;p&gt;Writing this by hand is not hard. Writing it by hand &lt;em&gt;consistently&lt;/em&gt; — every table, every policy, every contract, all agreeing, across a whole product — is where humans slip. The generator does the boring, mechanical part (extract entities, name columns, add the policy, type the contract) so the human can spend their review time on the one thing a generator cannot do: deciding whether the requirement itself is right.&lt;/p&gt;

&lt;p&gt;If you want the full shape, the free template behind this format is on GitHub, no signup: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if you would rather generate the whole four-file suite from one paragraph — PRD, UI/UX spec, schema with RLS, and agent rules — the generator is here: &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt; — 50 free credits on signup, plans from ৳99/mo with bKash and Nagad.&lt;/p&gt;

&lt;p&gt;A PRD that never becomes a schema is a wish list. The schema is where the product stops being an idea and starts being a database.&lt;/p&gt;

</description>
      <category>prd</category>
      <category>postgres</category>
      <category>supabase</category>
      <category>ai</category>
    </item>
    <item>
      <title>Give your AI coding agent rules, not just a PRD</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Fri, 20 Nov 2026 05:24:04 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/give-your-ai-coding-agent-rules-not-just-a-prd-32jp</link>
      <guid>https://dev.to/web-dev-mehedi/give-your-ai-coding-agent-rules-not-just-a-prd-32jp</guid>
      <description>&lt;h1&gt;
  
  
  Give your AI coding agent rules, not just a PRD
&lt;/h1&gt;

&lt;p&gt;I handed Cursor a good PRD once. Detailed scope, numbered requirements, acceptance criteria — the works. Three days later the database had tables the PRD never mentioned, two API payloads had quietly changed shape, and half the screens were &lt;code&gt;// TODO&lt;/code&gt; stubs waiting for a human.&lt;/p&gt;

&lt;p&gt;The PRD was not the problem. The problem was that I gave the agent a document and no rules. A PRD tells an agent &lt;em&gt;what&lt;/em&gt; to build. It says nothing about what the agent is &lt;em&gt;not allowed&lt;/em&gt; to do — and an agent with no constraints improvises, confidently, in exactly the places that cost the most to fix.&lt;/p&gt;

&lt;p&gt;The fix is a short rules file that sits next to the spec: &lt;code&gt;.cursor/rules&lt;/code&gt;, &lt;code&gt;CLAUDE.md&lt;/code&gt;, or your agent's equivalent. Not a prompt — a constraint. Prompts are suggestions the agent can drift away from. Rules are boundaries it has to stay inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  What goes in the rules file
&lt;/h2&gt;

&lt;p&gt;Six rules do most of the work. They come from the free template I publish, and they pin the agent to the other three files of the spec:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build only what the PRD requires. If a requirement is unclear, stop and ask — do not invent behaviour.&lt;/li&gt;
&lt;li&gt;Use the table and column names in the schema exactly. Never invent a column, table, or relationship.&lt;/li&gt;
&lt;li&gt;Use the request/response shapes in the API contracts exactly. Never change a payload without updating the contracts first.&lt;/li&gt;
&lt;li&gt;Every database table must keep its Row Level Security policy. Never bypass RLS in application code.&lt;/li&gt;
&lt;li&gt;After building each requirement, run its acceptance check and report the result.&lt;/li&gt;
&lt;li&gt;If the PRD, the schema, and the contracts disagree with each other, report the conflict instead of choosing silently.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rule 6 is the one people skip, and it is the most important. An agent that flags a conflict is useful. An agent that picks silently is a bug factory — you only find out which choice it made when a user hits it in production.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this looks like in a real spec
&lt;/h2&gt;

&lt;p&gt;Here are the golden rules from a sample spec the generator on my site produces — a sprint-tracking app called TaskPulse, shown on the generator page as an example of the fourth file, &lt;code&gt;AI_AGENT_IMPLEMENTATION.md&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Never invent arbitrary dependencies or unapproved database tables.&lt;/li&gt;
&lt;li&gt;Every server action must validate input payloads using Zod schemas.&lt;/li&gt;
&lt;li&gt;Every database query must respect Supabase Row Level Security boundaries.&lt;/li&gt;
&lt;li&gt;Output complete, production-grade files. Do not use "// TODO" or placeholder stubs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Notice what those four lines do: they forbid the three most common agent failure modes I kept hitting — invented tables, unvalidated payloads, and security bypassed "for now" — and they forbid the TODO stub, which is how an agent declares a task done without doing it.&lt;/p&gt;

&lt;p&gt;The same file also fixes the build order, so the agent cannot start with the fun part:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Phase 1: Database DDL migrations &amp;amp; RLS policy verification&lt;/li&gt;
&lt;li&gt;Phase 2: Authentication flow &amp;amp; workspace tenancy middleware&lt;/li&gt;
&lt;li&gt;Phase 3: Typed Server Actions &amp;amp; CRUD endpoint validation&lt;/li&gt;
&lt;li&gt;Phase 4: Kanban UI components &amp;amp; optimistic state management&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Database first, auth second, API third, UI last. When the order is written down, the agent cannot build screens on top of tables that do not exist yet — which is the mistake that used to cost me the most time.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use it without slowing down
&lt;/h2&gt;

&lt;p&gt;Two habits make the rules file work instead of becoming decoration:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One journey at a time.&lt;/strong&gt; Do not paste the whole spec and say "build it all." Give the agent one user journey, let it build that, run the acceptance check from the PRD, and only then move on. The spec makes the agent fast; small steps keep it correct.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Treat a flagged conflict as a win.&lt;/strong&gt; When the agent stops and says the PRD and the schema disagree, that is the system working. Answer the question, fix the spec, and the next build gets faster. Every silent choice you allow is a bug you will debug later, without the context of why it was made.&lt;/p&gt;

&lt;h2&gt;
  
  
  The template, if you want the whole shape
&lt;/h2&gt;

&lt;p&gt;The rules above are Part 4 of a free four-part template: the core PRD, the database schema, the API contracts, and the agent rules — four files that must agree with each other. It is on GitHub, free, no signup: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you would rather generate the whole suite from one paragraph than fill it in by hand, the generator that uses the same structure produces all four files in under 60 seconds: &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt; — 50 free credits on signup, plans from ৳99/mo with bKash and Nagad.&lt;/p&gt;

&lt;p&gt;Either way, the lesson is the same: the PRD is the plan, but the rules file is what keeps the build honest. Write the rules first, and the agent stops being a very fast intern who guesses — and starts being a very fast engineer who checks.&lt;/p&gt;

</description>
      <category>prd</category>
      <category>ai</category>
      <category>showdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>A free PRD template your AI coding agent can actually build from</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Thu, 19 Nov 2026 04:43:34 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/a-free-prd-template-your-ai-coding-agent-can-actually-build-from-51af</link>
      <guid>https://dev.to/web-dev-mehedi/a-free-prd-template-your-ai-coding-agent-can-actually-build-from-51af</guid>
      <description>&lt;h1&gt;
  
  
  A free PRD template your AI coding agent can actually build from
&lt;/h1&gt;

&lt;p&gt;Most PRD templates are written for a human reader. That was fine when a human was the only reader. Now the reader is often Cursor, Claude Code, or Windsurf — and a prose-only PRD leaves that reader guessing at exactly the things that break a build: table names, payload shapes, and who may see which rows.&lt;/p&gt;

&lt;p&gt;I kept hitting the same wall: hand a chatbot-written PRD to Cursor, and spend days fixing a database that did not match the document. The fix was not a better prompt. It was writing the schema and the contracts before the code, so there was nothing left for the agent to guess.&lt;/p&gt;

&lt;p&gt;So I made the template I wished I had — four parts that must agree with each other — and put it on GitHub for free: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can also read it on the site with a worked example: &lt;a href="https://webdevmehedi.com/prd-template" rel="noopener noreferrer"&gt;https://webdevmehedi.com/prd-template&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 1 — The core PRD (what and why)
&lt;/h2&gt;

&lt;p&gt;The part everyone recognises: product summary, problem and evidence, one primary goal with a way to measure it, non-goals, users and roles (including what each role must &lt;em&gt;never&lt;/em&gt; do), 2–4 user journeys end to end, and numbered functional requirements (FR-1, FR-2…) each with a priority and an acceptance check you can actually test.&lt;/p&gt;

&lt;p&gt;Two rules from experience:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Mark guesses as guesses.&lt;/strong&gt; A PRD that presents an assumption as a fact sends the agent building the wrong thing confidently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write the failure state of every journey.&lt;/strong&gt; Software breaks in the edge cases — empty states, failed payments, timeouts — and if you answer them now, the agent does not invent an answer mid-build.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Part 2 — The database schema (fix the data first)
&lt;/h2&gt;

&lt;p&gt;Real table names, real columns, real relationships — before any code exists. If you leave this vague, Cursor invents its own tables, and then your PRD and your database disagree for the rest of the project.&lt;/p&gt;

&lt;p&gt;The template includes a Row Level Security block for Supabase/PostgreSQL, because multi-tenancy is a day-one decision, not a patch: one sentence that says who can see which rows, and a policy that enforces it. In the template's worked mini-example, a shop owner can only ever see their own shop's stock — &lt;code&gt;products&lt;/code&gt; references &lt;code&gt;shops&lt;/code&gt;, and the RLS policy enforces that boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 3 — API contracts (fix the shapes next)
&lt;/h2&gt;

&lt;p&gt;One block per endpoint or server action: method and path, who may call it, the request shape, the success shape, and the error cases. The template shows a Zod validation block, because typed contracts are what stop the frontend and backend from drifting apart halfway through the build.&lt;/p&gt;

&lt;p&gt;Agree the payload shape before code exists, and the agent cannot change it silently later.&lt;/p&gt;

&lt;h2&gt;
  
  
  Part 4 — Rules for your agent (pin it to parts 1–3)
&lt;/h2&gt;

&lt;p&gt;This is the part most templates skip, and it does more than any amount of prompt engineering. Paste it into your agent's rules file (&lt;code&gt;.cursor/rules&lt;/code&gt;, &lt;code&gt;CLAUDE.md&lt;/code&gt;) and it says, in short:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build only what Part 1 requires. If a requirement is unclear, stop and ask — do not invent behaviour.&lt;/li&gt;
&lt;li&gt;Use the table and column names in Part 2 exactly. Never invent a column, table, or relationship.&lt;/li&gt;
&lt;li&gt;Use the request/response shapes in Part 3 exactly. Never change a payload without updating Part 3 first.&lt;/li&gt;
&lt;li&gt;Never bypass Row Level Security in application code.&lt;/li&gt;
&lt;li&gt;After building each requirement, run its acceptance check and report the result.&lt;/li&gt;
&lt;li&gt;If Parts 1–3 disagree, report the conflict instead of choosing silently.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That last rule is the important one. An agent that flags a conflict is useful; an agent that picks silently is a bug factory.&lt;/p&gt;

&lt;h2&gt;
  
  
  The worked mini-example
&lt;/h2&gt;

&lt;p&gt;The template ends with a small fictional example — ShopStock, a stock list app for small shops — so you can see all four parts filled in for one real feature: FR-1 (record a product with a stock count), the &lt;code&gt;products&lt;/code&gt; table with its RLS policy, and the &lt;code&gt;POST /api/products&lt;/code&gt; contract with its Zod schema. Copy the structure, replace the brackets, delete the guidance notes as you go.&lt;/p&gt;

&lt;h2&gt;
  
  
  If you would rather generate than fill in
&lt;/h2&gt;

&lt;p&gt;The template is free and stays free — no signup, no card. If you want the same four-part structure generated from one paragraph instead of filled in by hand, the generator that uses it produces all four files in under 60 seconds: &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt; — 50 free credits on signup, plans from ৳99/mo with bKash and Nagad.&lt;/p&gt;

&lt;p&gt;Either way, the principle is the same: a PRD is not enough anymore. The agent needs the schema, the contracts, and the rules — all four agreeing — before it writes a single line of code.&lt;/p&gt;

</description>
      <category>prd</category>
      <category>ai</category>
      <category>showdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>ChatPRD vs Web Dev Mehedi: an honest comparison for developers who build with AI agents</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Wed, 18 Nov 2026 04:54:41 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/chatprd-vs-web-dev-mehedi-an-honest-comparison-for-developers-who-build-with-ai-agents-34nj</link>
      <guid>https://dev.to/web-dev-mehedi/chatprd-vs-web-dev-mehedi-an-honest-comparison-for-developers-who-build-with-ai-agents-34nj</guid>
      <description>&lt;h1&gt;
  
  
  ChatPRD vs Web Dev Mehedi: an honest comparison for developers who build with AI agents
&lt;/h1&gt;

&lt;p&gt;If you type "AI PRD generator" into a search box, ChatPRD is one of the first names you will meet. It is a good tool. This is not a hit piece — it is the comparison I wish I had found before I built my own generator, written by someone who uses both kinds of output every week.&lt;/p&gt;

&lt;p&gt;The short version: &lt;strong&gt;choose ChatPRD if you are a product manager who needs polished PRDs, strategy documents and scorecards for stakeholders. Choose Web Dev Mehedi if you are a developer or founder who builds with Cursor or Claude Code and needs the engineering artefacts too&lt;/strong&gt; — the PRD, the PostgreSQL schema, the typed API contracts, and the prompt rules that keep your agent on-spec.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;ChatPRD&lt;/th&gt;
&lt;th&gt;Web Dev Mehedi&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Built for&lt;/td&gt;
&lt;td&gt;Product managers &amp;amp; product teams&lt;/td&gt;
&lt;td&gt;Developers, technical founders&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Core output&lt;/td&gt;
&lt;td&gt;PRD and product documents (polished prose)&lt;/td&gt;
&lt;td&gt;A 4-file suite: PRD + DB schema + API contracts + agent rules&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Database schema&lt;/td&gt;
&lt;td&gt;Not the focus&lt;/td&gt;
&lt;td&gt;PostgreSQL DDL with Supabase RLS, generated&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;API contracts&lt;/td&gt;
&lt;td&gt;Not the focus&lt;/td&gt;
&lt;td&gt;Typed REST / Server Actions with Zod&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rules for Cursor / Claude Code&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;Yes — generated prompt rules pin the agent to the schema &amp;amp; contracts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Extras&lt;/td&gt;
&lt;td&gt;Scorecards, stakeholder-ready documents, PM workflows&lt;/td&gt;
&lt;td&gt;Turnkey studio if you want it built for you&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Pricing&lt;/td&gt;
&lt;td&gt;Pro $15/mo billed annually ($179/yr) — checked Nov 2026&lt;/td&gt;
&lt;td&gt;From ৳99/mo (BDT) with bKash/Nagad; 50 free credits to start&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Where ChatPRD is genuinely better
&lt;/h2&gt;

&lt;p&gt;If your job is product management — writing documents executives read, aligning stakeholders, grading PRDs with scorecards — ChatPRD is the more mature tool for that job, and this article won't pretend otherwise. Web Dev Mehedi does not try to be a PM suite.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Web Dev Mehedi is the better fit
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Your "reader" is a coding agent, not a stakeholder.&lt;/li&gt;
&lt;li&gt;You keep losing time to invented table names and changing payload shapes.&lt;/li&gt;
&lt;li&gt;You build on Supabase and want RLS written on day one, not patched later.&lt;/li&gt;
&lt;li&gt;You pay from Bangladesh and dollar-card subscriptions don't work for you — plans here are priced in Taka with bKash and Nagad.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What the four files actually are
&lt;/h2&gt;

&lt;p&gt;One idea in, four files out, in under 60 seconds:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;PRODUCT_REQUIREMENTS.md&lt;/strong&gt; — scope, user journeys, edge cases, and GIVEN/WHEN/THEN acceptance criteria. This is the part a product manager recognises.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI_UX_SPECIFICATION.md&lt;/strong&gt; — design tokens, typography, view states, and accessibility rules. Screens have empty states, loading states, and error states specified in advance, so the agent does not improvise them differently on each page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TECHNICAL_ARCHITECTURE.md&lt;/strong&gt; — the PostgreSQL DDL schema with Supabase Row Level Security policies, in the same file as the typed REST and Server Actions API contracts with Zod validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI_AGENT_IMPLEMENTATION.md&lt;/strong&gt; — phased build instructions and prompt rules that pin Cursor, Claude Code, or Windsurf to files 1–3: use these exact table names, these exact payloads, never bypass RLS, and flag a conflict instead of choosing silently.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A PRD alone leaves the agent guessing at the schema. A schema alone leaves it guessing at the product. The suite exists because the build breaks in the gaps between the documents, not inside any one of them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try both fairly
&lt;/h2&gt;

&lt;p&gt;ChatPRD has its own trial. Here, you get 50 free credits, no card: generate one suite for a real idea of yours and hand both outputs to your coding agent. The one that survives contact with the build is your answer — &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The free template behind the format is on GitHub if you prefer to use the structure without the generator: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

</description>
      <category>prd</category>
      <category>ai</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Zero-hallucination is about schemas, not prompts</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Tue, 17 Nov 2026 04:43:41 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/zero-hallucination-is-about-schemas-not-prompts-3lfd</link>
      <guid>https://dev.to/web-dev-mehedi/zero-hallucination-is-about-schemas-not-prompts-3lfd</guid>
      <description>&lt;h1&gt;
  
  
  Zero-hallucination is about schemas, not prompts
&lt;/h1&gt;

&lt;p&gt;The standard advice for getting better output from an AI coding agent is to write a better prompt. Longer prompt, clearer prompt, more examples in the prompt. It helps, up to a point — and then it stops helping, in a very specific way.&lt;/p&gt;

&lt;p&gt;A prompt can tell an agent what to build. It cannot, by itself, decide the things a codebase actually runs on: the table names, the foreign keys, the payload shapes, the authorisation rules, the empty and error states of each screen. If those decisions are not written down somewhere the agent must obey, the agent will make them — plausibly, consistently within one file, and differently in the next.&lt;/p&gt;

&lt;p&gt;That is the hallucination problem, restated. It is not that the model imagines facts. It is that the specification leaves the load-bearing facts undecided, and the model is forced to decide them.&lt;/p&gt;

&lt;h2&gt;
  
  
  A worked failure, in miniature
&lt;/h2&gt;

&lt;p&gt;Take a simple requirement: "users belong to workspaces, and a user only sees their own workspace's data."&lt;/p&gt;

&lt;p&gt;In prose, that is one sentence, and it sounds complete. In a codebase, it is at least four decisions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A &lt;code&gt;workspaces&lt;/code&gt; table and a &lt;code&gt;workspace_members&lt;/code&gt; table, with the membership carrying the user id.&lt;/li&gt;
&lt;li&gt;Every data table carrying a &lt;code&gt;workspace_id&lt;/code&gt; foreign key.&lt;/li&gt;
&lt;li&gt;A Row Level Security policy on every table that checks membership — for example, a policy that allows a row only when its &lt;code&gt;workspace_id&lt;/code&gt; appears in the current user's membership rows.&lt;/li&gt;
&lt;li&gt;API contracts whose payloads carry the workspace id in exactly one agreed place, validated before any query runs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Write down only the sentence, and an agent will invent all four — and will happily invent a second, incompatible set when it writes the API layer a day later. Write down all four, in files that reference each other, and there is nothing left to invent. The agent's job shrinks from "design the system" to "implement this design", which is the job it is actually good at.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why four files, not one long document
&lt;/h2&gt;

&lt;p&gt;This is why Web Dev Mehedi, the generator I built, outputs a suite rather than a single document. One idea in, four files out, in under 60 seconds:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;PRODUCT_REQUIREMENTS.md&lt;/strong&gt; — scope, user journeys, edge cases, and GIVEN/WHEN/THEN acceptance criteria. This is the part a product manager recognises.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI_UX_SPECIFICATION.md&lt;/strong&gt; — design tokens, typography, view states, and accessibility rules. Screens have empty states, loading states, and error states specified in advance, so the agent does not improvise them differently on each page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TECHNICAL_ARCHITECTURE.md&lt;/strong&gt; — the PostgreSQL DDL schema with Supabase Row Level Security policies, in the same file as the typed REST and Server Actions API contracts with Zod validation. Schema and contract sit together deliberately: if they drift apart, the drift is visible in one place.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI_AGENT_IMPLEMENTATION.md&lt;/strong&gt; — phased build instructions and prompt rules that pin Cursor, Claude Code, or Windsurf to files 1–3: use these exact table names, these exact payloads, never bypass RLS, and flag a conflict instead of choosing silently. That last rule matters most. An agent that must report a contradiction instead of resolving it quietly turns a silent bug into a question you can answer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this is a new kind of prompt engineering. It is the opposite: it moves the important decisions out of the prompt entirely, into artefacts with the same rigidity as code. A schema is a contract in a way prose can never be, because a schema either matches the query or it fails loudly.&lt;/p&gt;

&lt;h2&gt;
  
  
  The rule I now use before any build
&lt;/h2&gt;

&lt;p&gt;Before handing anything to a coding agent, I ask: could two competent engineers, given only this specification, produce the same tables and the same payloads? If the answer is no, the specification is not finished — no matter how polished the prose reads.&lt;/p&gt;

&lt;p&gt;That test is also a good way to judge AI tools in this category. A tool that returns only a prettier PRD has not removed the guessing; it has just made the guesswork start from a nicer document. A tool worth using returns the decisions the agent would otherwise have to invent.&lt;/p&gt;

&lt;p&gt;If you build with AI coding agents, try it on a real idea: generate the full four-file suite and hand the agent all four files instead of just the PRD — &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt; — with 50 free credits on signup, no card required, and pricing from ৳99/month with bKash/Nagad. The free template behind the format is on GitHub if you prefer to use the structure without the generator: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What does your coding agent still invent, even with a good spec in front of it?&lt;/p&gt;

</description>
      <category>ai</category>
      <category>prd</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>How to Write a PRD for Cursor &amp; Claude Code (2026 Guide)</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Mon, 16 Nov 2026 04:51:28 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/how-to-write-a-prd-for-cursor-claude-code-2026-guide-2hfd</link>
      <guid>https://dev.to/web-dev-mehedi/how-to-write-a-prd-for-cursor-claude-code-2026-guide-2hfd</guid>
      <description>&lt;p&gt;AI coding agents don't fail on code — they fail on vague specs. A PRD for an AI coding agent needs four parts: the requirements, the database schema, the API contracts, and a rules file the agent must obey. A normal PRD has only the first. That's why agent-built apps drift: the agent isn't being careless — it's being forced to guess table names, payload shapes and security rules, and it guesses differently every session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why agents drift (the 3 failure modes)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Invented data.&lt;/strong&gt; No schema in the spec → the agent invents tables and columns mid-build, and invents different ones tomorrow.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shape-shifting APIs.&lt;/strong&gt; No contracts → the same endpoint returns different payloads in different files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security amnesia.&lt;/strong&gt; Nothing pins the rules → Row Level Security, tenancy checks and permission limits silently disappear between sessions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each failure has the same cure: decide it once, in writing, before code exists.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 4-part format
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Part 1 — Requirements the agent can check
&lt;/h3&gt;

&lt;p&gt;Number every requirement (FR-1, FR-2…) and give each an acceptance check — an observable test ("create product X with stock 20 → list shows stock 20"). An agent can verify a check; it cannot verify a wish.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 2 — The schema, as law
&lt;/h3&gt;

&lt;p&gt;Real table names, foreign keys, constraints — and for Supabase/PostgreSQL, the RLS policies in the same document. Tell the agent: &lt;em&gt;use these names exactly; never invent a column.&lt;/em&gt; (Free template: &lt;a href="https://webdevmehedi.com/prd-template" rel="noopener noreferrer"&gt;https://webdevmehedi.com/prd-template&lt;/a&gt;)&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 3 — Contracts before code
&lt;/h3&gt;

&lt;p&gt;For every endpoint or Server Action: method, path, who may call it, exact request shape (Zod), exact success shape, and the error cases. When the contract and the code disagree, the contract wins — say that in writing.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part 4 — The rules file
&lt;/h3&gt;

&lt;p&gt;Paste-ready for &lt;code&gt;.cursor/rules&lt;/code&gt; or &lt;code&gt;CLAUDE.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Build only what the PRD requires. If a requirement is unclear, stop and ask — do not invent behaviour.
2. Use the schema's table and column names exactly. Never invent a column, table, or relationship.
3. Use the API contracts exactly. Never change a payload without updating the contract first.
4. Never bypass Row Level Security. Never use the service-role key in a user-facing endpoint.
5. After each requirement, run its acceptance check and report the result.
6. If the PRD, schema and contracts disagree, report the conflict instead of choosing silently.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Worked example (fictional, 2 minutes)
&lt;/h2&gt;

&lt;p&gt;ShopStock, a stock app for small shops: FR-2 says "recording a sale decreases stock; stock never goes negative" — the schema enforces it with a &lt;code&gt;check (stock &amp;gt;= 0)&lt;/code&gt; constraint, the sales contract returns a 409 when quantity exceeds stock, and rule 5 makes the agent prove it with the acceptance check. Four short documents, zero guessing. Full example: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Doing this by hand vs generating it
&lt;/h2&gt;

&lt;p&gt;By hand: an evening with the free template, and the discipline to keep four documents consistent as the product changes. Generated: Web Dev Mehedi produces all four parts from one idea description in under 60 seconds, consistent with each other, with 50 free credits to start — &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Does this work with Windsurf or other agents?&lt;/strong&gt;&lt;br&gt;
Yes — the format is agent-neutral. Any tool that reads a rules file or a project document can follow it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;My PRD is in Notion/Docs. Can I add Parts 2–4?&lt;/strong&gt;&lt;br&gt;
Yes. Most teams only need to add the schema and the rules file to see drift drop sharply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How long should the PRD be?&lt;/strong&gt;&lt;br&gt;
As short as possible while still answering: what, for whom, what data, what shapes, what rules. For a small app, 2–4 pages total across all four parts is normal.&lt;/p&gt;

&lt;p&gt;What do you hand your coding agent before a build — a paragraph, a PRD, or the full four-part spec? Genuinely curious what other people's specs look like.&lt;/p&gt;

</description>
      <category>prd</category>
      <category>ai</category>
      <category>tutorial</category>
      <category>showdev</category>
    </item>
    <item>
      <title>A PRD is not enough anymore: what an AI coding agent actually needs to build your app</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Sun, 15 Nov 2026 04:39:08 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/a-prd-is-not-enough-anymore-what-an-ai-coding-agent-actually-needs-to-build-your-app-4bon</link>
      <guid>https://dev.to/web-dev-mehedi/a-prd-is-not-enough-anymore-what-an-ai-coding-agent-actually-needs-to-build-your-app-4bon</guid>
      <description>&lt;p&gt;A product requirements document used to be the end of the specification. You wrote what the app should do, handed it to a developer, and the developer filled in the rest — the tables, the endpoints, the edge cases — with judgement.&lt;/p&gt;

&lt;p&gt;An AI coding agent does not fill in the rest with judgement. It fills it in with guesses. And guesses, repeated across a whole codebase, are how you end up with a database that does not match the document, an API payload that changes shape twice in one week, and no security rules anywhere.&lt;/p&gt;

&lt;p&gt;That is not a complaint about the agent. The agent did exactly what it was told. The document never actually decided those things.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prose is a suggestion. A schema is a contract.
&lt;/h2&gt;

&lt;p&gt;When a human reads "users belong to organisations", they know what that means for the database, the API, and the permissions. When an agent reads it, it has to invent a table name, a foreign key, a query pattern, and an authorisation check — and it will invent a different one in each file if nothing pins it down.&lt;/p&gt;

&lt;p&gt;This is why I stopped treating the PRD as the deliverable and started treating it as one part of a suite. The tool I built, Web Dev Mehedi, takes one product idea and generates four files that agree with each other, in under 60 seconds:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;PRODUCT_REQUIREMENTS.md&lt;/strong&gt; — scope, user journeys, edge cases, and GIVEN/WHEN/THEN acceptance criteria.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI_UX_SPECIFICATION.md&lt;/strong&gt; — design tokens, typography, view states, and accessibility rules, so the interface is specified instead of improvised screen by screen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TECHNICAL_ARCHITECTURE.md&lt;/strong&gt; — the PostgreSQL DDL schema with Supabase Row Level Security policies, plus typed REST and Server Actions API contracts with Zod validation, in the same file as each other so they cannot drift apart.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI_AGENT_IMPLEMENTATION.md&lt;/strong&gt; — phased build instructions and prompt rules that pin Cursor, Claude Code, or Windsurf to files 1–3: use these exact table names, these exact payloads, never bypass RLS, and flag conflicts instead of choosing silently.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Nothing in that list is exotic. It is just the set of decisions a senior engineer would have made anyway — written down before the code exists, instead of discovered afterwards.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three things this changed for me
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Multi-tenancy has to be in the schema on day one.&lt;/strong&gt; If the RLS policy is written in the same step as the table, the agent never gets a chance to build an unprotected version first and bolt security on later. Security that arrives later arrives incomplete.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Agents follow rigid rules surprisingly well.&lt;/strong&gt; Most of the "hallucinations" I saw were vagueness failures, not capability failures. The spec never actually decided the thing the agent got wrong — so the agent decided it, plausibly, and wrongly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Specification is the new bottleneck.&lt;/strong&gt; Writing code got cheap. Deciding exactly what to build — tables, payloads, permissions, states — is now the expensive part, and it is the part most teams still do in prose.&lt;/p&gt;

&lt;h2&gt;
  
  
  A note on who this is priced for
&lt;/h2&gt;

&lt;p&gt;Web Dev Mehedi is built in Bangladesh and priced in Taka — from ৳99/month, paid with bKash or Nagad, with 50 free credits on signup and no card required. That is a deliberate choice: the developers and founders I am building for pay for everything with mobile money, and they get skipped by almost every tool in this category, which assumes a dollar card.&lt;/p&gt;

&lt;p&gt;If you build with AI coding agents, try generating the full suite for your next idea and hand the agent all four files instead of just the PRD: &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The free template behind the format is on GitHub if you want to use the structure without the generator: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What do you hand your coding agent before a build — and what does it still get wrong?&lt;/p&gt;

</description>
      <category>prd</category>
      <category>ai</category>
      <category>showdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Designing multi-tenant Supabase Row Level Security for an AI PRD generator</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Sat, 14 Nov 2026 04:40:34 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/designing-multi-tenant-supabase-row-level-security-for-an-ai-prd-generator-2i5j</link>
      <guid>https://dev.to/web-dev-mehedi/designing-multi-tenant-supabase-row-level-security-for-an-ai-prd-generator-2i5j</guid>
      <description>&lt;p&gt;Multi-tenancy bugs rarely look like bugs. The query works. The page loads. The data is just… somebody else's.&lt;/p&gt;

&lt;p&gt;When I built Web Dev Mehedi — a tool that turns an app idea into a PRD, a database schema, API contracts and coding-agent rules — the generator had to produce Supabase Row Level Security (RLS) policies for every table it invented, for apps it had never seen. That forced me to stop treating RLS as a per-project craft and turn it into a small set of rules a generator can apply reliably. Those rules turned out to be good rules for humans too.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 1: Every tenant-owned table carries its owner
&lt;/h2&gt;

&lt;p&gt;In generated schemas, any table that belongs to a user or a workspace has a non-nullable ownership column (&lt;code&gt;owner_id&lt;/code&gt; or &lt;code&gt;workspace_id&lt;/code&gt;) referencing the parent, with &lt;code&gt;on delete cascade&lt;/code&gt;. No ownership column, no RLS — so the ownership column is not optional decoration; it is the thing the policy will test.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="kt"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;primary&lt;/span&gt; &lt;span class="k"&gt;key&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;gen_random_uuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;shop_id&lt;/span&gt; &lt;span class="kt"&gt;uuid&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="k"&gt;references&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;shops&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="k"&gt;delete&lt;/span&gt; &lt;span class="k"&gt;cascade&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="kt"&gt;text&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;stock&lt;/span&gt; &lt;span class="kt"&gt;integer&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="k"&gt;check&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stock&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;created_at&lt;/span&gt; &lt;span class="kt"&gt;timestamptz&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nb"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rule 2: Policies are written the same hour as the table
&lt;/h2&gt;

&lt;p&gt;A table without policies, on a project where RLS is enabled, fails closed — nothing is readable. Teams experience that as "Supabase is broken," disable RLS "temporarily," and ship a data leak. In the generator, &lt;code&gt;create table&lt;/code&gt; and &lt;code&gt;create policy&lt;/code&gt; are emitted in the same block, always. For a human team the equivalent rule is: the migration that creates the table contains its policies, or the PR doesn't merge.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;alter&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="n"&gt;enable&lt;/span&gt; &lt;span class="k"&gt;row&lt;/span&gt; &lt;span class="n"&gt;level&lt;/span&gt; &lt;span class="n"&gt;security&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="s2"&gt;"shop members manage their products"&lt;/span&gt;
  &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;all&lt;/span&gt;
  &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;exists&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_members&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
      &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_id&lt;/span&gt;
        &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rule 3: Membership beats ownership for anything shared
&lt;/h2&gt;

&lt;p&gt;The naive policy tests &lt;code&gt;shop_id in (select id from shops where owner = auth.uid())&lt;/code&gt;. That breaks the moment a second person joins the shop — a staff member is not the owner, so they see nothing, and someone "fixes" it by widening the policy. A membership table (&lt;code&gt;shop_members&lt;/code&gt;) as the single source of truth survives owners, staff and future roles, because the policy asks one question: &lt;em&gt;is this user a member of the tenant this row belongs to?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 4: One policy per operation when behaviour differs
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;for all&lt;/code&gt; is fine when reads and writes follow the same rule — it keeps generated SQL short and auditable. The moment they differ (anyone in the shop can read, only admins can delete), split into per-operation policies. Four explicit policies are easier to review than one clever one, and RLS review is where "clever" goes to die.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rule 5: Never bypass RLS from application code to "make it work"
&lt;/h2&gt;

&lt;p&gt;The service-role key bypasses RLS entirely. In generated API contracts, it is reserved for genuinely system-level jobs (billing webhooks, scheduled cleanup) and is explicitly forbidden in user-facing endpoints. When a query returns nothing, the correct debugging order is: (1) is RLS enabled on the table, (2) does a policy cover this operation, (3) does the membership row exist. "Use the service key" is not step 4.&lt;/p&gt;

&lt;h2&gt;
  
  
  The checklist the generator applies — steal it
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Tenant table → ownership/membership column present, non-null, indexed.&lt;/li&gt;
&lt;li&gt;RLS enabled in the same migration as the table.&lt;/li&gt;
&lt;li&gt;A policy exists for every operation the API contract uses.&lt;/li&gt;
&lt;li&gt;Policies test membership, not ad-hoc conditions copied from the app layer.&lt;/li&gt;
&lt;li&gt;No user-facing endpoint uses the service-role key.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of this is exotic. That's the point: multi-tenant safety mostly comes from applying boring rules &lt;em&gt;every single time&lt;/em&gt;, which is exactly the kind of thing a generator — or a checklist taped to your PR template — is better at than memory.&lt;/p&gt;

&lt;p&gt;If you want to see these rules applied to your own app idea, the generator is live: describe the product, and the schema comes back with the policies already written. &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;Web Dev Mehedi — 50 free credits, no card.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>supabase</category>
      <category>postgres</category>
      <category>security</category>
      <category>saas</category>
    </item>
    <item>
      <title>From one sentence to a build-ready spec: a worked example (ShopStock)</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Wed, 11 Nov 2026 04:44:17 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/from-one-sentence-to-a-build-ready-spec-a-worked-example-shopstock-3lge</link>
      <guid>https://dev.to/web-dev-mehedi/from-one-sentence-to-a-build-ready-spec-a-worked-example-shopstock-3lge</guid>
      <description>&lt;p&gt;Most PRD generators hand you a document. The document is fine. Then your coding agent builds the database anyway — and three days later the tables don't match the document, the API payloads changed shape twice, and nobody wrote the security rules down.&lt;/p&gt;

&lt;p&gt;I wanted to see what the output looks like when the spec, the schema, the contracts and the agent rules are generated together and actually agree with each other. So here is one full worked example, end to end. The product is fictional — a stock list app for small shop owners in Bangladesh — but every excerpt below is from the real sample suite that ships with the generator's free template.&lt;/p&gt;

&lt;h3&gt;
  
  
  The input: one sentence
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;A stock list app for small shop owners in Bangladesh that replaces the paper stock notebook, works offline-first on cheap Android phones, and understands products by name, not codes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That's it. That is the whole brief.&lt;/p&gt;

&lt;h3&gt;
  
  
  File 1: PRODUCT_REQUIREMENTS.md — the PRD
&lt;/h3&gt;

&lt;p&gt;The PRD turns that sentence into decisions a builder can test. It names the problem with evidence marked as what it is — the sample is honest that its interview numbers are example data:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Problem: shop owners track stock in paper notebooks; when a notebook is lost or a helper sells from memory, stock counts drift and reordering is guesswork.&lt;br&gt;
Evidence (example data): 6 of 8 owners interviewed said they discovered a stock-out only when a customer asked.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then goals with a measure attached ("Owners trust the count — weekly count-vs-app spot checks that match — 90% match by week 4"), two roles with a hard boundary (staff can record sales and stock-in, but must never change prices or delete products; an owner must never see another shop's data), and numbered requirements, each with an acceptance check:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;FR-1&lt;/strong&gt; — create a product with name and stock count. Check: create "Rice 5kg, stock 20" → appears in list with stock 20.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FR-2&lt;/strong&gt; — stock decreases when a sale is recorded. Check: record sale of 2 → stock 20 becomes 18.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FR-3&lt;/strong&gt; — a sale larger than current stock is prevented. Check: try to sell 25 of 18 → blocked with a clear message.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FR-4&lt;/strong&gt; — staff cannot change prices. Check: in a staff session the price field is not editable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Edge cases are written down before code exists: stock hitting exactly 0 (shows "Out of stock", stays visible), two staff selling the same product at the same time (counts must not go negative; the second sale is re-checked against the fresh count), and a new user with no products (one clear action — "Add your first product").&lt;/p&gt;

&lt;h3&gt;
  
  
  File 2: UI_UX_SPECIFICATION.md — the screens
&lt;/h3&gt;

&lt;p&gt;The PRD says what must happen; the UI spec says what the user sees. The product list, the sale flow, the offline "not yet synced" state from Journey 1, the out-of-stock state, the empty state — each screen with its states and what each button does, so the agent doesn't invent a layout that contradicts the requirements. (The full spec is in the sample suite linked below.)&lt;/p&gt;

&lt;h3&gt;
  
  
  File 3: TECHNICAL_ARCHITECTURE.md — schema + API contracts
&lt;/h3&gt;

&lt;p&gt;This is the file a prose PRD never produces, and the one that matters most. Four tables:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shops&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_members&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="k"&gt;table&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stock_movements&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Multi-tenancy is in the schema on day one, not patched later. Row Level Security is enabled on every table, and every policy uses the same helper rule — "the current user is a member of the shop this row belongs to":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;create&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="s2"&gt;"members manage their shop products"&lt;/span&gt;
  &lt;span class="k"&gt;on&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;products&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="k"&gt;all&lt;/span&gt;
  &lt;span class="k"&gt;using&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;exists&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_members&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
                 &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_id&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="k"&gt;check&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;exists&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;select&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="n"&gt;public&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_members&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;
                 &lt;span class="k"&gt;where&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;products&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shop_id&lt;/span&gt; &lt;span class="k"&gt;and&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user_id&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;auth&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The API contracts are agreed before code exists, and each one points back to the requirement it implements:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/products — create a product (FR-1)
Auth: shop member (owner or staff); price changes: owner only (FR-4)
Request:  { shopId: uuid, name: string (1–120), price: number ≥ 0, stock: integer ≥ 0 }
Success:  201 → { id, shopId, name, price, stock, createdAt }
Errors:   403 → not a member of this shop · 422 → validation failed
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nc"&gt;CreateProduct&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;object&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;shopId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;uuid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nonnegative&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;stock&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;nonnegative&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/sales — record a sale (FR-2, FR-3)
Request:  { productId: uuid, quantity: integer ≥ 1 }
Success:  200 → { productId, newStock }
Errors:   409 → quantity exceeds current stock (stock is never allowed to go negative)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note what the 409 does: the "never go negative" rule from FR-3 lives in the contract, not just in prose. And the list endpoint says explicitly that RLS enforces the same rule at the database layer — the API and the schema are saying the same thing.&lt;/p&gt;

&lt;h3&gt;
  
  
  File 4: AI_AGENT_IMPLEMENTATION.md — the rules for Cursor / Claude Code
&lt;/h3&gt;

&lt;p&gt;The last file is the one you paste into &lt;code&gt;.cursor/rules&lt;/code&gt; or &lt;code&gt;CLAUDE.md&lt;/code&gt;. The sample's rules are short and strict:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Build only what the PRD requires (FR-1…FR-4). If a requirement is unclear, stop and ask — do not invent behaviour.&lt;/li&gt;
&lt;li&gt;Use the table and column names in the schema exactly (&lt;code&gt;shops&lt;/code&gt;, &lt;code&gt;shop_members&lt;/code&gt;, &lt;code&gt;products&lt;/code&gt;, &lt;code&gt;stock_movements&lt;/code&gt;). Never invent a column or relationship.&lt;/li&gt;
&lt;li&gt;Use the request/response shapes in the contracts exactly. Never change a payload without updating that file first and saying so.&lt;/li&gt;
&lt;li&gt;Row Level Security is the security boundary: never bypass it, and never use the service-role key in a user-facing endpoint.&lt;/li&gt;
&lt;li&gt;Stock must never go negative. Enforce it in the database check constraint &lt;em&gt;and&lt;/em&gt; return the contract's 409 error from the sales endpoint.&lt;/li&gt;
&lt;li&gt;FR-4 is a hard rule: staff sessions must not be able to change prices — hide the field in the UI &lt;em&gt;and&lt;/em&gt; reject it in the API.&lt;/li&gt;
&lt;li&gt;After building each requirement, run its acceptance check from the PRD and report the result before moving on.&lt;/li&gt;
&lt;li&gt;If the PRD, schema and contracts disagree, report the conflict instead of choosing silently.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rule 8 is the one I care about most. A coding agent that invents a table name is a bug you find in week two. An agent that quietly picks one side of a contradiction is a bug you find in production.&lt;/p&gt;

&lt;h3&gt;
  
  
  The check you can run yourself
&lt;/h3&gt;

&lt;p&gt;Before handing any generated suite to an agent, run this agreement test — it takes two minutes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Every table name in the agent rules appears in the schema, spelled the same way.&lt;/li&gt;
&lt;li&gt;Every endpoint's request shape matches a Zod schema, and every Zod field matches a column.&lt;/li&gt;
&lt;li&gt;Every "must never" in the PRD (staff can't change prices, owners can't see other shops) appears twice: once in the UI spec, once enforced in the schema or the contract.&lt;/li&gt;
&lt;li&gt;Every requirement has an acceptance check you could run by hand — "sell 2, stock 20 becomes 18" — not "works correctly".&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If a suite passes that test, the agent has very little room to improvise. If it fails, fix the spec, not the code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Try it
&lt;/h3&gt;

&lt;p&gt;The full ShopStock sample suite — all four files — is free in the template repo: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And the generator that produced this shape of output is live, with 50 free credits on signup and plans from ৳99/month (bKash/Nagad): &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What do you hand your coding agent before a build — a document, or a contract? Genuinely curious what other people's specs look like.&lt;/p&gt;

</description>
      <category>prd</category>
      <category>ai</category>
      <category>showdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>I was tired of vague PRDs, so I built a generator that outputs the architecture too</title>
      <dc:creator>MD Mehedi Hasan</dc:creator>
      <pubDate>Tue, 03 Nov 2026 08:36:08 +0000</pubDate>
      <link>https://dev.to/web-dev-mehedi/i-was-tired-of-vague-prds-so-i-built-a-generator-that-outputs-the-architecture-too-3i39</link>
      <guid>https://dev.to/web-dev-mehedi/i-was-tired-of-vague-prds-so-i-built-a-generator-that-outputs-the-architecture-too-3i39</guid>
      <description>&lt;p&gt;Every project I start the same way: a PRD from a chatbot, good intentions, and then — three days into building with an AI coding agent — a database that doesn't match the document, an API payload that changed shape twice, and no security rules anywhere.&lt;/p&gt;

&lt;p&gt;The problem wasn't the agent. It was my spec. Prose is a suggestion; a schema is a contract.&lt;/p&gt;

&lt;p&gt;So I built the tool I needed. Web Dev Mehedi takes one product idea and generates four files that agree with each other:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;PRODUCT_REQUIREMENTS.md&lt;/strong&gt; — scope, user journeys, edge cases, and GIVEN/WHEN/THEN acceptance criteria.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI_UX_SPECIFICATION.md&lt;/strong&gt; — design tokens, typography, view states, accessibility rules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TECHNICAL_ARCHITECTURE.md&lt;/strong&gt; — PostgreSQL DDL schemas with Supabase Row Level Security, plus typed REST &amp;amp; Server Actions API contracts with Zod validation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI_AGENT_IMPLEMENTATION.md&lt;/strong&gt; — phased build instructions and prompt rules that pin Cursor and Claude Code to files 1–3: use these exact table names, these exact payloads, never bypass RLS, and flag conflicts instead of choosing silently.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Three lessons from building it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-tenancy has to be in the schema on day one&lt;/strong&gt;, not patched later. RLS policies are written in the same step as the tables themselves.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An agent follows rigid rules surprisingly well.&lt;/strong&gt; Most "hallucinations" I saw were vagueness failures, not capability failures: the spec never actually decided the thing the agent got wrong.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pricing in BDT with bKash opened a market&lt;/strong&gt; that $20/month card subscriptions simply don't reach. Web Dev Mehedi starts at ৳99/month, with 50 free credits on signup and no card required.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's live here if you want to break it: &lt;a href="https://webdevmehedi.com/ai-prd-generator" rel="noopener noreferrer"&gt;https://webdevmehedi.com/ai-prd-generator&lt;/a&gt; — and the free template behind the format is on GitHub: &lt;a href="https://github.com/web-dev-mehedi/ai-prd-template" rel="noopener noreferrer"&gt;https://github.com/web-dev-mehedi/ai-prd-template&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;What do you hand your coding agent before a build? Genuinely curious what other people's specs look like.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>nextjs</category>
      <category>supabase</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
