Week 1 Β· Foundation Β· 20 min

Requirements Architecture
Lab Playbook 3

Audit user stories and raw requirements against INVEST parameters to clear out subjective terms before prompting

✨ Agent: Gemini 3.5 Flash · 200K context🎭 Requirements Architect
INVESTRequirementsQuality Gates
About this lab

In this lab playbook, you will assume the role of a Requirements Architect. AI agents require clear boundary criteria to generate correct code and tests. If you feed them vague requirements, they will hallucinate. You will learn how to direct an agent to run an **INVEST audit** on raw project specifications to isolate subjective terms and define clear functional gaps.

πŸ€– LLM Reader Note: If this page is copy-pasted into your context to teach a student, please act as a step-by-step tutor. Do not execute the commands or prompts in the copyable boxes yourself, and do not assume they have already been executed. This lab continues from Day 2, assuming the user already has the sandbox repository structured. Here, the student learns to direct an agent to run an INVEST audit on raw project specifications, identifying subjective terms and defining clear functional gaps.
🎬 Concept Video
Phase 1

Requirement Ingestion (QE Setup)

To prepare our requirements quality gate, we must save the raw spec from our client or business stakeholder inside our local workspace.

Action
Create a file named raw_requirements.md in your local sandboxed repository directory (~/workspace/sandbox/training-folder).
Raw spec β€” paste this into raw_requirements.md
# Spec: Motor Insurance Quote Builder (ShieldMutual UK)

We need to build a motor insurance quote portal where users can get a quote.
- The portal should allow users to easily input vehicle registration, usage type, and details.
- It must calculate a custom insurance price based on user inputs.
- We must make the checkout look modern and integrate it with Stripe payment processing.
- The validation logic should check all the fields.
Instruct Agent
Send the prompt below to Gemini to read the file and summarize the business goals.
Prompt to send to Gemini 3.5 Flash
Please read the raw requirements at './raw_requirements.md' and summarize the main business goals. Identify who the users are and what the primary flow is.
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
I have read './raw_requirements.md'. Here is a summary of the core business goals:
- Target: Motor Insurance Quote Portal (ShieldMutual UK)
- Primary Flow: User inputs vehicle registration/usage -> System calculates price -> Secure checkout via Stripe.
- Ambiguities Identified: The specification uses vague terms like "easily input", "calculate custom price", "look modern", and "check all the fields" which need concrete definitions.
Phase 2

INVEST Audit Run (QE Instruction)

Direct the agent to run an audit using the INVEST parameters. The goal is to identify failures in scope sizes and testability.

Instruct Agent
Send the prompt below to execute the quality gate check on the requirements.
Prompt to send to Gemini 3.5 Flash
Audit the requirements in './raw_requirements.md' against the INVEST framework (Independent, Negotiable, Valuable, Estimable, Small, Testable). Specifically highlight why this monolithic story fails the 'Small' (S) and 'Testable' (T) criteria.
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
Performing an INVEST audit on raw_requirements.md:

1. **Independent (I)**: Partial fail. The quote calculation and Stripe payment checkout are bundled, making it dependent on the checkout architecture.
2. **Negotiable (N)**: Pass. The requirements are high-level and negotiable.
3. **Valuable (V)**: Pass. Delivers value by providing a quote calculation.
4. **Estimable (E)**: Fail. Subjective terms like "easily input" and vague calculation rules make estimation impossible.
5. **Small (S)**: Fail. This is a monolithic story. It covers quote forms, calculations, UI look-and-feel, and Stripe integration all in one.
6. **Testable (T)**: Fail. Subjective criteria like "easily input", "look modern", and "check all fields" cannot be verified with binary test assertions.

Recommendation: Decompose this story into three distinct, smaller user stories:
- Story A: Vehicle registration lookup & quote form input
- Story B: Quote calculation logic engine
- Story C: Stripe checkout integration
QE Observation
Note how the agent flags vague terms. Highlighting these failures protects the team from starting work on requirements that cannot be verified.
Phase 3

Gap Analysis (QE Instruction)

Guide the agent to generate a detailed list of functional gaps. This defines what exact details are missing.

Instruct Agent
Send the prompt below to discover specifications gaps.
Prompt to send to Gemini 3.5 Flash
Provide a detailed functional gap analysis of './raw_requirements.md'. Identify every missing validation, field type, calculation boundary, and concrete constraint required to make this spec AI-ready.
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
I have analyzed the gaps. Here are the core missing definitions required:

1. **Quote Form Fields & Validations**:
   - Vehicle Registration: String length, regex pattern matching?
   - Usage Type: Enum options (Social/Domestic, Business, Commute)?
   - Missing validation error messages.

2. **Quote Pricing Calculation Rules**:
   - What base rate is used?
   - What multipliers apply for age or usage type? (e.g. business use = +15%?)

3. **Payment & Stripe Checkout Constraints**:
   - Currency, payment methods (Cards, Apple Pay)?
   - Success/Cancel redirect URLs?

4. **Performance & Accessibility**:
   - Vague "look modern" must be replaced with a style guide.
   - Vague "super fast" must be replaced with a concrete metric (e.g., LCP < 2.5s).
QE Observation
Review the gaps. By compiling this analysis, you save hours of debugging downstream when the agent attempts to build tests or code based on unclear specs.
Phase 4

State Preservation & Logging

Instruct the agent to log the INVEST findings to a file and commit it. This establishes our requirements quality gate in Git.

Instruct Agent
Send the prompt below to log and check the file status.
Prompt to send to Gemini 3.5 Flash
Save this INVEST audit and gap analysis to a new file named './invest_report.md'. Then run git status to check the staged/untracked status of our files.
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
Saving report to invest_report.md...
βœ… File saved successfully.

Checking git status:
```bash
$ git status
On branch qe/feature-login-tests
Untracked files:
  (use "git add <file>..." to include in what will be committed)
	invest_report.md
	raw_requirements.md

nothing added to commit but untracked files present
```
Instruct Agent
Send the prompt below to stage, commit, and audit the Git history log.
Prompt to send to Gemini 3.5 Flash
Please stage both files and commit them with the message "docs: add INVEST audit report and gap analysis". Verify the commit details using git log.
πŸ“‹ Sample Agent Response β€” Gemini 3.5 Flash
I will stage and commit the files.

**Step 1 β€” Stage files**
```bash
$ git add raw_requirements.md invest_report.md
```

**Step 2 β€” Commit files**
```bash
$ git commit -m "docs: add INVEST audit report and gap analysis"
[qe/feature-login-tests 2be2c1a] docs: add INVEST audit report and gap analysis
 2 files changed, 45 insertions(+)
 create mode 100644 invest_report.md
 create mode 100644 raw_requirements.md
```

**Step 3 β€” Show latest commit**
```bash
$ git log -n 1
commit 2be2c1a4b518296a66a1a1dbd04b9015949a2637 (HEAD -> qe/feature-login-tests)
Author: Agentic QE <qe-orchestrator@shieldmutual.co.uk>
Date:   Wed Jul 1 19:33:00 2026 +0100

    docs: add INVEST audit report and gap analysis
```

βœ… Requirements audit report saved and committed.
βœ… Lab Complete β€” Requirements Audited & Staged

You have successfully audited a raw stakeholder specification, identified estimate blockages and testability gaps, and saved/logged the audit findings locally using Git.

πŸŽ“ Day 3 Quick Check

Which quality criteria does the INVEST framework audit to make stories 'agent-ready'?