SlicerCode conceptsIntermediate9 min read

PRD Validation for Code

A Product Requirements Document says what a feature must do; the code says what it actually does. PRD validation is the discipline of proving those two agree — requirement by requirement, grounded in real behavior rather than a hopeful read of the diff. This course covers what PRD validation means for code, the four dimensions worth scoring, why runtime values make the check trustworthy, and how to turn the result into a readable, scored report that closes the spec-to-code gap.

What Is PRD Validation for Code?

A Product Requirements Document (PRD) states what a feature must do — the inputs it accepts, the rules it enforces, the outputs and side effects it produces, and the edge cases it has to handle. PRD validation is the practice of proving that the code you actually shipped satisfies that specification: not merely that it compiles or that a demo worked, but that each requirement maps to real, observable behavior in the implementation.

For most of software history, requirements validation has been manual and lossy. An engineer reads the ticket, writes code, and a reviewer eyeballs the diff against a paragraph of prose. Nothing systematically connects requirement #3 to the function that implements it, and nothing flags that requirement #5 was quietly dropped. PRD validation closes that loop by treating the spec as a checklist you can score the implementation against.

This guide covers what PRD validation means for code, the four dimensions worth measuring — code, executed flow, remaining changes, and tests — why grounding the check in real runtime values matters, and how to turn a verdict into a scored, readable report instead of a gut feeling.

Key takeaway — PRD validation proves each requirement maps to observable behavior in the implementation — not just that the code compiles or a demo works.

The Spec-to-Code Gap (and Why It Widens)

Specs and code drift apart the moment they're written. A PRD is authored up front, in prose, against an imagined design. The implementation is built incrementally, under time pressure, against the messy reality of the existing codebase. Requirements get reinterpreted, deferred, or forgotten; the code grows behavior the PRD never mentioned. The gap between what was asked for and what was built is where bugs, missed acceptance criteria, and 'wait, that's not what I meant' live.

The gap is hard to see because the two artifacts speak different languages. The PRD says 'transfers over the daily limit must be rejected with a clear error.' The code says if (amount.compareTo(dailyRemaining) > 0) throw new LimitExceededException(...) buried three calls deep in a service. Confirming those describe the same rule requires a human to hold both in their head and trace the path — which does not scale past a handful of requirements.

Traditional safety nets do not fully cover it. Tests check the behavior someone thought to test; code review checks the diff, not the whole spec; type systems check shape, not intent. None of them answer the question a PRD actually asks: of everything this feature was supposed to do, how much is genuinely done? Requirements validation exists to answer exactly that.

The Four Dimensions of PRD Validation

A single match/no-match verdict is too blunt to act on. Useful PRD validation scores an implementation across several independent dimensions, because a requirement can be present in the code yet never exercised, or fully tested yet not actually wired into the running flow. SlicerCode's PRD validation evaluates four:

Splitting the score this way makes the result actionable. 'Code present but flow doesn't reach it' points at wiring or a feature flag; 'flow reaches it but no test covers it' points at a coverage gap; 'not in code at all' is unstarted work. A flat percentage hides all of that — four dimensions turn a verdict into a to-do list you can burn down.

  • Code — do the functions, branches and data structures the requirement calls for actually exist in the source, and do they encode the stated rules?
  • Executed flow — when the feature runs, does control and data actually reach that code along the real call path, or is it dead or unreachable in practice?
  • Changes still to make — what does the PRD require that is not yet implemented, so the report doubles as a punch-list of remaining work?
  • Tests — is the requirement covered by tests, and do those tests assert on the behavior the PRD describes rather than something incidental?
Key takeaway — Score the spec across code, executed flow, remaining changes, and tests — one flat percentage hides whether a requirement is wired up, reachable, and tested.

Grounding Validation in Real Runtime Values

Static analysis alone can tell you a requirement's code exists; it cannot reliably tell you what that code does with real inputs. Polymorphism, dependency injection, configuration, and framework magic all sit between the source you read and the behavior that ships. A requirement like 'apply a 2% fee' can be present in a FeeCalculator interface with three implementations — and only runtime data reveals which one runs and whether the number it produces is actually 2%.

Grounding PRD validation in runtime values means checking requirements against the arguments, object state, and return values your code genuinely produced on a real run — not against what the source appears to do. If the PRD says the daily limit is $10,000 and the observed rejection fires at $9,500, that is a discrepancy a static read would miss entirely. Runtime grounding turns 'the code looks right' into 'the code produced the right value.'

This is where dynamic tracing and PRD validation reinforce each other. A trace captures the concrete inputs and outputs along a flow; validation compares those observed values to the numbers, states, and error conditions the PRD specifies. SlicerCode captures these values by attaching the debugger, redacts secrets and PII before anything leaves the editor, and re-computes the PRD's arithmetic from what actually ran.

Key takeaway — Static analysis proves the code exists; runtime values prove it produces the right numbers — validation grounded in real captures catches discrepancies a source read can't.

Scored, Readable Validation Reports

A validation is only as useful as what you can do with its output. The goal is not a raw model dump or a wall of markdown — it is a scored, readable report: an overall match percentage, a per-requirement breakdown of what's covered, and an explicit list of what's missing. That format lets a reviewer skim the verdict in seconds and drill into any requirement that did not pass.

Scoring should be legible and stable. A match percentage per dimension — code, flow, changes, tests — plus a covered/missing split gives you a number to track over time. You can watch a feature climb from 40% to 100% as work lands, and a pull request that drops the score becomes a visible regression rather than a silent one. The report is a communication artifact as much as a check: it is what you paste into a review or hand to a PM to say 'here is exactly what's done.'

In SlicerCode, validation runs in a live progress modal and returns a clean rendered report next to the flow — match %, covered, and missing — not raw text. Because the same report can seed test generation, a missing requirement can go straight from 'flagged' to 'tested' without re-describing it. See change review against a spec for the diff-level version of the same idea.

PRD Validation vs. Code Review and Tests

PRD validation does not replace tests or code review — it sits above them and asks a different question. Tests verify specific behaviors you enumerated; a green suite says 'the things I tested work,' not 'the feature is complete.' Code review evaluates a diff for quality and correctness, but a reviewer rarely re-reads the entire PRD and checks it line by line. Both are necessary; neither measures spec coverage directly.

Think of it as a hierarchy of questions. Types ask 'do the shapes line up?' Tests ask 'does this behavior hold?' Review asks 'is this change good?' PRD validation asks 'does the whole implementation satisfy the whole spec?' Because it spans code, flow, and tests, it can catch a requirement that every unit test passes around — implemented, reachable, but never asserted against the acceptance criteria that actually matter.

The dimensions also compose with each other. A requirement that scores high on code but low on tests is a prompt to generate tests; one that is low on flow is a wiring bug; one that is low on code is unstarted work. Pairing validation with AI test generation means the same requirement that fails the 'tests' dimension can be turned into a runnable, verified test in the same tool.

Key takeaway — Tests measure the behaviors you enumerated; PRD validation measures whether the whole implementation satisfies the whole spec — a green suite can still hide a missing requirement.

Writing Requirements That Validate Cleanly

Not every PRD validates cleanly, and the fix is often in the spec, not the tool. Requirements phrased as vague intentions — 'the flow should be fast' or 'handle errors gracefully' — have nothing concrete to check against. Requirements phrased as observable conditions — 'p95 latency under 200ms', 'a 429 with a Retry-After header on rate limit', 'reject transfers over the $10,000 daily limit' — map directly onto values a validator can confirm.

Write requirements as testable assertions: an input, a rule, and an expected output or side effect. Number them so the report can reference them one-to-one. Prefer concrete values — limits, status codes, thresholds — over adjectives, because concrete values are exactly what runtime grounding can verify. A PRD written this way doubles as an acceptance-criteria checklist and a test plan.

This overlaps heavily with good prompt engineering and context engineering: a precise, well-scoped spec gives both a human reviewer and an AI validator an unambiguous target. The clearer the requirement, the sharper the covered/missing verdict — and the less the result depends on anyone's interpretation.

How SlicerCode Runs PRD Validation

SlicerCode validates a PRD against a specific flow, not the whole repo at once — which keeps the check focused and the score meaningful. You open a flow in the analyzer (an endpoint or job whose call, data and object graph SlicerCode already built on load), attach a PRD as PDF, Word or Markdown — or just type the requirements inline — and hit Validate.

Under the hood it combines the three analyses this course has referenced: the static flow graph for what the code is, a runtime capture for what it actually did, and your existing tests for what is covered. It scores those against each requirement across the four dimensions, re-computing the PRD's calculations from observed values, and streams progress in a live modal so a long validation is not a black box.

The output is the scored, rendered report described above — match %, covered, missing — opened right next to the flow, with the option to generate tests straight from the PRD and flow. Full setup and settings are in the docs; the feature overview lives on the features page. It runs in VS Code today, with IntelliJ and a CLI on the roadmap.

Key takeaway — SlicerCode validates a PRD against one flow — combining its static graph, a runtime capture, and your tests — and returns a rendered, scored report you can act on.

Closing the Spec-to-Code Gap Continuously

Validated once, a spec drifts again the next sprint. The real payoff comes from making PRD validation a recurring checkpoint rather than a one-time audit — run it when a feature is 'done' to confirm it, run it in review to catch a regression in spec coverage, and run it before a release to produce a defensible record of what shipped versus what was promised.

Because SlicerCode's validation is grounded in real runtime values and rendered as a trackable score, it becomes a metric a team can move: features climb toward 100% as work lands, and a drop is a signal, not a surprise. That is the whole point of requirements validation — turning 'I think it's done' into 'here is the evidence, requirement by requirement.'

To try it on your own codebase, install the VS Code extension, open a flow, and validate it against its spec. Pair it with dynamic runtime tracing for the sharpest results, since the values it captures are what make the score trustworthy.

Key takeaway — Run PRD validation at 'done', in review, and before release so spec coverage becomes a metric you can move — not a one-time audit.

Frequently asked questions

What is PRD validation in software development?

PRD validation is the practice of proving that a shipped implementation satisfies its Product Requirements Document — checking that each stated requirement maps to real, observable behavior in the code, not just that the code compiles or a demo works.

How do you validate code against a PRD?

You compare each requirement to the implementation across several dimensions — whether the code exists, whether a real run reaches it, what's still missing, and whether tests cover it — ideally grounding the check in captured runtime values so you confirm the code produces the right outputs, not just that it looks right.

What are the four dimensions of PRD validation?

Code (does the required logic exist in the source), executed flow (does a real run actually reach it), changes still to make (what the PRD requires that isn't implemented yet), and tests (whether the requirement is covered and asserted). Splitting the score this way turns a verdict into an actionable to-do list.

Is PRD validation the same as testing?

No. Tests verify specific behaviors you chose to test; PRD validation asks whether the whole implementation satisfies the whole spec. A suite can be fully green while a requirement is quietly missing — validation measures spec coverage, tests measure the behaviors you enumerated.

Can PRD validation use runtime data?

Yes, and it's much stronger when it does. Grounding validation in captured arguments, object state, and return values confirms the code produced the value the PRD specifies — catching discrepancies, like a limit firing at the wrong threshold, that a static read of the source would miss.

What does a PRD validation score mean?

It's a match percentage — overall and per dimension — plus a covered/missing breakdown of the requirements. Tracked over time, it lets a feature climb toward 100% as work lands and makes any drop in spec coverage a visible regression you can catch in review.

See it in your codebase

SlicerCode brings the agent, flow graphs, runtime capture, PRD validation and test generation into VS Code.