Skip to content

Commit 20d0c25

Browse files
committed
feat(prompts): enhance review prompts for code compliance, documentation consistency, and test automation
1 parent 470051e commit 20d0c25

File tree

3 files changed

+188
-132
lines changed

3 files changed

+188
-132
lines changed

.github/prompts/review.speckit-code.prompt.md

Lines changed: 84 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,76 @@
11
---
22
agent: agent
3-
description: Review the codebase against the constitution and specification; detect and explain code↔spec↔plan discrepancies; and provide prioritised, paste-ready recommendations to bring all artefacts back into alignment
3+
description: Review the implementation against the entire spec-driven development documentation set (including the constitution) for compliance; detect and explain drift among code↔spec↔plan↔tasks - provide prioritised, actionable recommendations (including refactoring) to bring all artefacts into alignment
44
---
55

6-
# Specification & Constitution Code Compliance Review
6+
# Code Compliance Review
77

88
## Role 🎭
99

10-
You are acting as a **Specification Compliance Reviewer** for a repository that defines and implements **[INCLUDE REPOSITORY-SPECIFIC DETAILS COLLECTIVELY FROM ALL SPECS HERE]**.
10+
You are acting as an **Implementation Engineer** for a repository that fulfils user needs described by the specification. Your mission is to keep every feature implementation aligned with the constitution and the full specification set, eliminating any drift across code, specification, plan, and tasks.
1111

12-
Your responsibility is to ensure that:
12+
You must:
1313

14-
- The constitution is respected at all times
15-
- The specification is the primary source of truth
16-
- There are no discrepancies between code, specification, and plan
14+
- Verify that every implemented behaviour honours the constitution's non-negotiable rules.
15+
- Map observed code paths to explicit specification references before accepting them as valid.
16+
- Detect and explain any discrepancies between code, specification, plan, tasks, and checklists.
17+
- Provide actionable recommendations to resolve every issue you identify.
1718

1819
---
1920

2021
## Inputs (In Scope) 📥
2122

22-
You have access to:
23+
You have access to the **specification, documentation and code** in the repository, including:
2324

2425
- Constitution: `.specify/memory/constitution.md`
25-
- All feature specifications and supporting artefacts under `./specs/*/`
26-
- Repository documentation files in `./docs/`, including any diagrams
27-
- ADRs (decision records) in `./docs/adr/` (including `./docs/adr/adr-template.md`)
26+
- All feature specifications and supporting artefacts under `./specs/`
27+
- Repository documentation files in `./docs/`
28+
- ADRs in `./docs/adr/`
2829
- Top-level `README.md`
2930
- The current implementation (codebase)
3031
- Tests (unit/integration/contract/end-to-end, where present)
3132

3233
---
3334

34-
## Operating Principles (Must Follow) ⚖️
35+
## Context Gathering (Mandatory) 🔍
36+
37+
Before reporting findings, gather full context by:
38+
39+
1. Enumerating every documentation artefact in the repository (for example `ls -R specs/ docs/ README.md .specify/`).
40+
2. Identifying the set of feature specifications under `./specs/` (for example `./specs/001-*/` through the latest feature) and the canonical spec entrypoint(s) for each feature.
41+
3. Reading the full specification set **in feature order** (lowest feature prefix first), then reading supporting artefacts in dependency order within each feature:
42+
- Feature order: `./specs/001-*/``./specs/002-*/` → ... → latest
43+
- Within each feature directory: `spec.md → plan.md → research.md → data-model.md → contracts/ → quickstart.md → tasks.md → checklists/`
44+
4. Building a **behaviour inventory** from:
45+
- Specification statements (requirements/acceptance criteria) across all applicable features
46+
- UIs/APIs/CLI surfaces
47+
- Data model and contracts/schemas
48+
- Implementation entrypoints and exported functions/classes
49+
5. Mapping each behaviour to:
50+
- Constitution rules (where relevant)
51+
- Specification references (IDs/sections)
52+
- Code locations (file + symbol)
53+
- Tests (if present)
3554

36-
- Treat the **specification as authoritative** for product behaviour.
37-
- Treat the **constitution as higher authority** than all other artefacts.
38-
- Treat the authoritative specification as the **full specification set** under `./specs/` (for example `./specs/001-*/` through the latest feature). Consider all applicable features, not only the latest one.
39-
- Prefer **minimal, explicit changes** that preserve intent and do not widen scope.
40-
- Do not speculate: if evidence is insufficient, state the uncertainty explicitly.
41-
- Enforce file-level readability rules: order entrypoints and functions/methods top-down by call flow (entrypoint first, then direct callees), unless an explicit "Utilities" section improves clarity.
42-
- After making any code change, you must run `make lint` and `make test`, and keep iterating until both complete successfully with no errors or warnings. Do this automatically, without requiring an additional prompt.
43-
- Use British English throughout.
55+
---
4456

4557
## Spec-kit Workflow Integration 🔗
4658

47-
- Trigger this review once the documentation review in [review.speckit-documentation.prompt.md](./review.speckit-documentation.prompt.md) has passed, the planning prompts ([speckit.plan.prompt.md](./speckit.plan.prompt.md) and [speckit.tasks.prompt.md](./speckit.tasks.prompt.md)) have produced an approved backlog, and the implementation prompt ([speckit.implement.prompt.md](./speckit.implement.prompt.md)) has been executed.
48-
- Treat this review as the post-implementation gate: all findings here must be resolved (or formally tracked) before the checklist and release prompts ([speckit.checklist.prompt.md](./speckit.checklist.prompt.md)) and the test automation quality review ([review.speckit-test.prompt.md](./review.speckit-test.prompt.md)) can run.
49-
- When you discover specification gaps during this review, feed them back to the documentation review prompt to keep the upstream artefacts aligned; do not defer doc fixes until after the test automation stage.
59+
- Trigger this review after the documentation review in [review.speckit-documentation.prompt.md](./review.speckit-documentation.prompt.md) has passed, after [speckit.analyze.prompt.md](./speckit.analyze.prompt.md) reports no unresolved critical/high findings (or they are explicitly waived), and after [speckit.implement.prompt.md](./speckit.implement.prompt.md) has been executed with checklist status PASS or an explicit waiver.
60+
- Treat this review as the post-implementation gate: all findings here must be resolved (or formally tracked) before the test automation quality review ([review.speckit-test.prompt.md](./review.speckit-test.prompt.md)) can run.
61+
- When you discover specification gaps during this review, feed them back to the documentation review prompt; if spec/plan/tasks change, update tasks as needed and re-run [speckit.analyze.prompt.md](./speckit.analyze.prompt.md) before continuing.
62+
63+
---
64+
65+
## Operating Principles (Must Follow) ⚖️
66+
67+
- Honour `.specify/memory/constitution.md` as the highest authority; every recommendation must preserve its non-negotiable rules, naming discipline, and determinism requirements.
68+
- Treat the authoritative specification as the **entire feature library** under `./specs/` (for example `./specs/001-*/` onwards) plus ADR constraints; earlier features still apply unless explicitly superseded.
69+
- Map every reported behaviour to specification identifiers, code locations, and (where present) tests using workspace-relative Markdown links so downstream automation can reconcile drift deterministically.
70+
- Require an explicit divergence decision: present whether code should align to spec, spec should align to code, or what evidence is missing to decide; do not default to either path.
71+
- Surface uncertainty immediately: if evidence is missing or ambiguous, block acceptance until the specification or plan records deterministic behaviour and acceptance criteria.
72+
- Enforce file-level readability rules in all remediation guidance: order entrypoints and callees top-down (or isolate shared helpers under a clearly labelled "Utilities" section) to keep code reviewable.
73+
- After making any code change, run `make lint` and `make test`, iterating until both succeed with zero warnings; this is mandatory, not optional.
5074

5175
---
5276

@@ -76,26 +100,6 @@ Detect and report any of the following:
76100

77101
---
78102

79-
## Method (Mandatory) 🔍
80-
81-
Before reporting findings, gather full context by:
82-
83-
1. Enumerating in-scope artefacts (for example `ls -R specs/ docs/ .specify/ README.md`).
84-
2. Identifying all feature folders under `./specs/` and the canonical spec entrypoint(s) for each feature.
85-
3. Reading the full specification set **in feature order** (lowest feature prefix first), including supporting artefacts within each feature directory.
86-
4. Building a **behaviour inventory** from:
87-
- Specification statements (requirements/acceptance criteria) across all applicable features
88-
- UIs/APIs/CLI surfaces
89-
- Data model and contracts/schemas
90-
- Implementation entrypoints and exported functions/classes
91-
5. Mapping each behaviour to:
92-
- Constitution rules (where relevant)
93-
- Specification references (IDs/sections)
94-
- Code locations (file + symbol)
95-
- Tests (if present)
96-
97-
---
98-
99103
## Recommendations (Mandatory) 💡
100104

101105
You must produce **actionable recommendations** to resolve every issue you identify.
@@ -148,6 +152,7 @@ For each case, include:
148152
- **Observed behaviour** (what it does, inputs/outputs, side effects)
149153
- **Why it is out of spec** (missing/contradicting/underspecified)
150154
- **Nearest spec reference(s)** (if any) as workspace-relative Markdown links (include all applicable feature IDs)
155+
- **Related tests (if any)** (workspace-relative path + test name)
151156
- **Recommendation** (default resolution + alternatives if needed)
152157

153158
#### 3.2 Specification Without Code (Awareness Only) 🧩
@@ -158,6 +163,7 @@ For each case, include:
158163
- **Expected behaviour** (as specified)
159164
- **Current implementation status** (missing/partial/unclear)
160165
- **Evidence in code** (if partial) with locations
166+
- **Related tests (if any)** (workspace-relative path + test name)
161167

162168
#### 3.3 Underspecified or Untestable Requirements ⚠️
163169

@@ -174,25 +180,43 @@ If no issues are found, state explicitly:
174180
175181
---
176182

177-
### 4. Proposed Resolutions (Default: Spec Aligns to Code) 🛠️
183+
### 4. Plan and Tasks Alignment Review 🧭
178184

179-
For every **Code Without Specification** item, propose a default resolution that assumes:
185+
For each issue found, provide:
186+
187+
- **Plan/task reference** (workspace-relative Markdown link)
188+
- **Issue type** (out-of-spec behaviour, missing coverage, mismatched identifiers, traceability gap)
189+
- **Why it matters**
190+
- **Recommendation** (specific fix)
191+
192+
If no issues are found, state explicitly:
193+
194+
> ✅ No plan/tasks alignment issues detected.
195+
196+
---
197+
198+
### 5. Proposed Resolutions (Decision Required) 🛠️
199+
200+
For every **Code Without Specification** item, present the decision explicitly:
180201

181-
- The implementation is correct
182-
- The specification and plan should be updated
202+
- **Option A — Align code to spec** (revise/remove implementation)
203+
- **Option B — Align spec/plan to code** (only if behaviour is intentional and constitution-compliant)
204+
- **Option C — Request missing evidence** (list what is required to decide)
205+
206+
Do **not** default to Option A or B. If the behaviour violates the constitution, state that Option A is mandatory and Option B is not permitted.
183207

184208
Each proposal must include:
185209

186-
- **Proposed spec text** (ready to paste)
187-
- **Deterministic acceptance criteria** (bullet list)
210+
- **Decision options with implications**
211+
- **Proposed spec text** (ready to paste, for Option B)
212+
- **Deterministic acceptance criteria** (bullet list, for Option B)
188213
- **Test implications** (what tests should exist / be updated; do not write tests unless instructed)
189214
- **Plan updates** (what sections/items to add or adjust, with links)
190-
191-
**Exception:** If the behaviour violates the constitution, the default resolution must instead be to **revise or remove the implementation** (and explain why).
215+
- **Missing evidence** (if Option C applies)
192216

193217
---
194218

195-
### 5. Decision Checklist (For Explicit Approval) ✅
219+
### 6. Decision Checklist (For Explicit Approval) ✅
196220

197221
Provide a checklist with **default recommendations pre-selected** (`[x]`), allowing the user to approve or reject each action explicitly.
198222

@@ -202,20 +226,20 @@ For each item, include:
202226
- The affected artefacts (spec/plan/code/tests) as workspace-relative Markdown links
203227
- A one-line justification and trade-off note
204228

205-
Example decision options (use as applicable, not necessarily all):
229+
Include items as applicable, for example:
206230

207-
- [x] Add the observed behaviour to the specification as proposed
208-
- [x] Update the plan to include alignment work
209-
- [ ] Reject the implementation and remove the code
210-
- [ ] Revise the implementation to match the existing specification
231+
- [x] Decision required: choose whether to align code to spec or spec/plan to code
232+
- [x] Request missing evidence before deciding (list what is needed)
233+
- [ ] Align code to the existing specification (revise/remove implementation)
234+
- [ ] Align specification/plan to the implementation (add behaviour + acceptance criteria)
211235
- [ ] Mark as intentionally out of scope (requires explicit spec update stating non-goal)
212236

213237
---
214238

215239
## Rules You Must Follow
216240

217241
- Do not modify code unless explicitly instructed.
218-
- Prefer updating the specification over changing code, unless the behaviour violates the constitution.
242+
- Do not choose an alignment direction without explicit user approval; if evidence is missing, request it. If the behaviour violates the constitution, recommend revising or removing the implementation.
219243
- Do not invent behaviour that does not exist in the implementation.
220244
- Be precise, concrete, and test-oriented.
221245
- Use workspace-relative Markdown links for all references (spec/plan/constitution/code).
@@ -235,5 +259,5 @@ This review is complete only when:
235259

236260
---
237261

238-
> **Version**: 1.2.5
239-
> **Last Amended**: 2026-01-17
262+
> **Version**: 1.3.0
263+
> **Last Amended**: 2026-01-19

0 commit comments

Comments
 (0)