Series: Pega MCP Authoring in Practice
This article is part of a five-part series on using Pega MCP Authoring to build production-grade Pega applications.
- Accelerating Pega Developer Productivity with MCP Authoring: an overview of MCP Authoring and how it can improve day-to-day developer productivity.
- From Blueprint to Production: My Experience Rebuilding a Pega Application with MCP Authoring: a case study covering manual wiring, unsupported rule types, and workarounds.
- Extending Pega MCP Authoring: My Observations, Tips, and Lessons Learned: observations and lessons from hands-on use.
- Spec-Based Development with Pega MCP Authoring (this article)
Spec-Based Development with Pega MCP Authoring: Specifications, Technical Context, and Why They Matter
When a tool can generate a Pega rule in minutes, writing the rule is no longer the expensive part. The expensive part is deciding what should be built and proving that what was built is correct.
That shift is why spec-based development matters. It applies a discipline that high-stakes engineering has long relied on to a tool that makes code cheap to produce. This article explains what spec-based development is, why it matters for Pega MCP Authoring, how technical context fits in, and what separates a strong specification from a weak one.
What Is Spec-Based Development?
In spec-based development, a written specification is the primary artifact. The implementation is derived from the specification and checked against it. The specification is versioned, reviewed, and updated as understanding changes, the same way code is.
A specification answers the questions a generator cannot answer for you:
- What outcome is required, and for whom?
- How will we know it is done?
- What must not change?
Spec-driven approaches have drawn wide attention across the industry for AI-assisted development, for one reason: intent should be written down before it is turned into an implementation.
Why Spec-Based Development Matters
1. It makes generated output verifiable.
Acceptance criteria are the test. A reviewer checks the output against stated behavior, not against whether the result looks reasonable. “Each entry shows who changed the field and when” is either met or not. “The history is useful” is neither.
2. It keeps decisions with the people who own the requirement.
Without a specification, intent gets buried in prompts and generated code, where reviewers cannot find it. With one, the business decision is visible, reviewable, and owned by the people accountable for it.
3. It makes results reproducible.
A chat session disappears. A specification stays. Another developer, or the same developer months later, can regenerate, review, or extend the work from the same artifact.
4. It creates traceability.
In regulated industries, including financial services, the question after every change is: which requirement did this implement, and what evidence shows it works? A chain from story to acceptance criteria to rule to test answers that directly. Audit history and generated tests are most useful when they trace back to a stated requirement.
5. It compounds over time.
Each reviewed specification teaches the team something. Standards in CONSTITUTION.md grow from real decisions, and each new story starts from a richer baseline than the last.
Where Technical Context Fits
A specification describes the outcome. It rarely describes the application the outcome will land in. Technical context fills that gap.
Three sources give MCP Authoring what it needs. Each has a different owner and changes at a different rate:
| Source | Owner | Changes | Answers |
|---|---|---|---|
| Specification | Business analysts and product owners | Per feature | What outcome is required, and how it is verified |
Standards (CONSTITUTION.md) |
Architects and tech leads | Rarely | How the team builds: naming, data classes, approved utilities, guardrails |
| Existing application | The team that owns it | Continuously | What already exists and must be reused or protected |
When only the specification is provided, the output can be correct in general terms but generic in its details. It may not match the data model, may duplicate existing capability, or may touch behavior nobody mentioned.
Technical context is most useful when it takes one of three forms:
- A constraint: “Use the approved data class for this information.”
- A reference: “Reuse the existing history pattern if one exists.”
- A recorded decision: “We deliberately deviate from the standard here, because…”
It is least useful when it restates a procedure the standards already define.
Example Specification:
STORY ID: AUDIT-042
TITLE: Product Data Type Field level Change History on the Landing Page
As an Audit Specialist,
I want to see every change made to a product's fields,
So that I can answer audit questions about who changed what and when.
ACCEPTANCE CRITERIA:
1. Given a user with the audit role, when they open a product's Landing page,
then the history lists entries newest first.
2. Given a save that changes three fields, when the history is viewed,
then one entry shows all three fields with previous and new values.
3. Given any user viewing the history, then no edit or delete control is shown.
4. Given a user without the audit role, when they open the history,
then access is denied and the denial is recorded.
5. Given a save that changes no tracked field, then no history entry is created.
OUT OF SCOPE:
- Email notifications (separate story)
- Editing or correcting history entries (not permitted by audit requirements)
PROTECTED BEHAVIOR:
- The existing product save logic must not change
BUSINESS CONTEXT:
- Required for regulatory and audit investigations
- History retained for at least seven years
TECHNICAL CONTEXT (only where not defined elsewhere):
- Data class: per the CONSTITUTION.md data class catalog (History-ABC-Remediation-Data-ProductHistory)
- Existing ProductLine history implementation: reuse as the pattern
What makes it strong
- Each criterion is a test. The Given/When/Then format turns every line into a scenario a tester can run.
- The outcome and exclusions are explicit. Email alerts and editing are named as out of scope.
- Standards are referenced, not restated. The data class and naming come from
CONSTITUTION.md, so the story stays short and does not drift. - The existing application is named as a source. The story points to the existing pattern, so the team does not end up with two implementations.
- Protected behavior is stated. The save logic is named as unchanged, so regression risk is visible before work starts.
What the generator does with it: It applies the documented pattern, reuses existing history where possible, builds only the read-only view, and produces output that each criterion can confirm or reject.
A quick test for any specification: Give the story to two developers without letting them talk. If they would build materially different things, the story is not specific enough. The point where they disagree is exactly what needs to be written down.
Iterations and Rework
Two terms make the difference measurable:
- Iteration: one full cycle of generating output, reviewing it, and sending a revised request.
- Rework: a change to generated output that would have been unnecessary if the input had been clear. Typical examples are an out-of-scope feature, a duplicated pattern, a misplaced data class, or a change to protected logic.
Count iterations per story, not per prompt. A story that needed four prompts to reach one accepted result is one story with three iterations.
Illustrative pattern for the audit example (not measured data): a bad specification is expected to need more iterations and produce more rework, such as added editing capability, a new table in place of the standard pattern, or changed save logic. A good specification is expected to need fewer iterations, with review focused on the five criteria. Replace these expectations with your team’s counts before publishing.
Measurement log
| Story | Specification version | Iteration | Reviewer change requested | Rework category | Final state reached (Y/N) |
|---|---|---|---|---|---|
| STRY_1 | 1 | Scope / pattern / protected / ambiguity / defect | |||
| STRY_2 | 3 |
Run one bad and one good version of two or three stories of similar size. Keep the request, the review notes, and the final output together, and compare averages across stories rather than single results.
Do and Don’t
Do
- Write acceptance criteria as observable behavior, ideally in Given/When/Then form.
- Keep one outcome per story. A story that changes three things is three stories.
- Keep standards in one versioned document and reference it from every story.
- Inspect the existing application before creating anything new, and reuse or extend a pattern when one fits.
- Record deliberate deviations from a standard in the story, with the reason.
- Review the specification before generation starts, the same way teams review a design before writing code.
- Keep context current. Retire context that no longer matches the application.
- Measure results so the process is judged on evidence.
Don’t
- Don’t write step-by-step implementation unless the implementation itself is the requirement.
- Don’t copy standards into every story. Copies drift apart, and the drift becomes confusion.
- Don’t use vague criteria such as “works correctly,” “handles errors,” or “is secure.”
- Don’t put credentials, tokens, or sign-in links in specifications, prompts, or chat. Authentication belongs inside the environment’s sign-in flow.
- Don’t treat a new rule as the default. Check first whether the capability already exists.
- Don’t freeze the specification once building starts. When understanding changes, update the specification, then the implementation.
- Don’t use context to cover a missing standard. If the same context appears in several stories, it belongs in
CONSTITUTION.md.
Balance and Proportion
Apply spec-based development in proportion to the change:
- A small, well-understood fix may need only a clear acceptance criterion.
- A new capability or a change to protected behavior needs a full specification with protected behavior and traceability.
- Over-specification also has a cost. A specification that restates the standards or dictates each step becomes a second copy of the code that drifts out of date.
How to Adopt It
- Use one story template with a clear outcome, Given/When/Then acceptance criteria, out-of-scope items, protected behavior, and business context.
- Create one shared
CONSTITUTION.mdso standards are written once. - Review specifications before generation, and treat a weak specification as a defect.
- Record exceptions and decisions in the story where they apply.
- Measure the outcome by tracking iterations and rework across five to ten stories, once with a specification alone and once with specification plus context.
Frequently Asked Questions
Is spec-based development the same as waterfall?
No. Specifications are living documents. They are reviewed before generation, updated when understanding changes, and kept proportional to the size of the change.
Does spec-based development slow teams down?
Writing a good specification takes time. That time is recovered when fewer outputs are rejected, fewer changes are rebuilt, and reviewers can verify results against stated criteria.
Do I need technical context for every story?
No. Add it only when neither the specification, the standards, nor the existing application answers an important question, or when behavior must be protected.
Where should standards live?
In one shared, version-controlled CONSTITUTION.md. Stories should reference it rather than repeat it.
Conclusion
The significance of spec-based development is not that it makes generation faster. It makes generated output accountable.
The specification states what is intended and how it will be verified. The standards state how the team builds. The existing application shows what already exists. Technical context fills only the gaps those three leave open, and it does so as constraints, references, and recorded decisions.
Teams that follow this discipline get output they can explain, reproduce, and defend. As generating code becomes easier, the teams that benefit most will be the ones that have made intent explicit, verifiable, and shared.