Skip to content

feat: add /speckit.review command β€” staff-level code review#2043

Closed
arunt14 wants to merge 2 commits intogithub:mainfrom
arunt14:feat/review-command
Closed

feat: add /speckit.review command β€” staff-level code review#2043
arunt14 wants to merge 2 commits intogithub:mainfrom
arunt14:feat/review-command

Conversation

@arunt14
Copy link
Copy Markdown
Contributor

@arunt14 arunt14 commented Apr 1, 2026

Description

Problem

Spec-Kit guides teams through spec β†’ plan β†’ tasks β†’ implement, but has no built-in code review step after implementation. Once /speckit.implement completes, there is no structured way to validate that the code is correct, secure, performant, and faithful to the specification. Teams either skip review entirely or rely on ad-hoc processes, creating a quality gap between implementation and shipping.

The community review extension exists but is not part of core, meaning most users don't benefit from it. A core review command ensures every spec-driven project has a quality gate built into the workflow.

Industry context: GStack's /review command demonstrates that embedding a staff-engineer-level review directly in the AI workflow catches issues that informal review misses β€” particularly security vulnerabilities, spec deviations, and performance regressions.

Solution

Adds /speckit.review β€” a new core command that performs a thorough, staff-engineer-level code review through 5 structured passes:

  1. Correctness & Logic β€” spec compliance, boundary conditions, null handling, race conditions, state management
  2. Security β€” injection vulnerabilities, auth checks, hardcoded secrets, input sanitization, CORS/CSP headers
  3. Performance & Scalability β€” N+1 queries, unbounded loops, resource leaks, caching correctness
  4. Spec Compliance & Architecture β€” requirement coverage matrix, API contract validation, scope creep detection
  5. Test Quality β€” coverage gaps, assertion quality, test isolation, untested error paths

Output: Structured review report with severity levels (πŸ”΄ Blocker / 🟑 Warning / 🟒 Suggestion), spec coverage matrix, and verdict (APPROVED / APPROVED WITH CONDITIONS / CHANGES REQUIRED).

Business Value

  • Creates a mandatory quality gate between implementation and shipping β€” the most critical checkpoint in any development workflow
  • Catches security vulnerabilities early with a dedicated security review pass before code reaches production
  • Ensures spec fidelity by cross-referencing every requirement against the actual implementation
  • Reduces review burden on human reviewers by having the AI agent surface high-signal issues first
  • Completes the post-implementation workflow: implement β†’ review β†’ qa β†’ ship

Workflow Position

/speckit.implement β†’ /speckit.review ⭐ β†’ /speckit.qa β†’ /speckit.ship β†’ /speckit.retro

Files Added

File Purpose
templates/commands/review.md Command template with 5 review passes, severity classification, extension hooks (before_review, after_review)
templates/review-template.md Structured review report template with findings table, spec coverage matrix, and metrics

Testing

  • Tested locally with uv run specify --help
  • Ran existing tests with uv sync && uv run pytest β€” 878/972 pass (44 failures are pre-existing, unrelated to this change)
  • Verified YAML frontmatter is valid and parseable
  • Verified command file is auto-discovered by specify init
  • Confirmed no changes to Python source code β€” template-only addition

AI Disclosure

  • AI assistance was used in this PR
  • How: GitHub Copilot CLI (Claude) was used to draft the command template and output template content, following the existing patterns established by implement.md and analyze.md. All content was reviewed and validated against the project's template conventions.

Note: Happy to discuss the scope and approach with maintainers. This is one of five related-but-independent PRs adding lifecycle commands inspired by GStack's role-based workflow.

@arunt14 arunt14 requested a review from mnriem as a code owner April 1, 2026 05:57
Copilot AI review requested due to automatic review settings April 1, 2026 05:57
Add a new core command for thorough, staff-engineer-level code review of
implementation changes with 5 review passes:

1. Correctness & Logic
2. Security
3. Performance & Scalability
4. Spec Compliance & Architecture
5. Test Quality

Generates structured review report with severity levels (Blocker/Warning/Suggestion)
and verdicts (APPROVED / APPROVED WITH CONDITIONS / CHANGES REQUIRED).
Inspired by GStack's /review command.
@arunt14 arunt14 force-pushed the feat/review-command branch from 0470263 to 1724bdb Compare April 1, 2026 05:59
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new /speckit.review command template and an accompanying review report template to introduce a structured, staff-level implementation review step in the spec-driven workflow.

Changes:

  • Added templates/commands/review.md defining a 5-pass review procedure plus extension hook support (before_review / after_review).
  • Added templates/review-template.md to standardize the Markdown output report structure (findings table, coverage matrix, metrics, actions).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.

File Description
templates/commands/review.md Introduces the /speckit.review command workflow and hook integration points.
templates/review-template.md Provides the Markdown report skeleton used by /speckit.review.

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +23
| ID | Severity | File | Line(s) | Category | Finding | Recommendation |
|----|----------|------|---------|----------|---------|----------------|
| R001 | πŸ”΄ Blocker | [file] | [lines] | [category] | [description] | [fix suggestion] |
| R002 | 🟑 Warning | [file] | [lines] | [category] | [description] | [fix suggestion] |
| R003 | 🟒 Suggestion | [file] | [lines] | [category] | [description] | [fix suggestion] |
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tables use a leading double pipe (|| ... |), which renders as an extra empty column in Markdown (and may fail markdownlint). Use a single leading pipe and ensure the header separator row has the same number of columns as the header.

Copilot uses AI. Check for mistakes.
Comment on lines +31 to +35
| Requirement | Status | Implementation Notes |
|-------------|--------|---------------------|
| FR-001: [requirement] | βœ… Implemented | [notes] |
| FR-002: [requirement] | ⚠️ Partial | [what's missing] |
| FR-003: [requirement] | ❌ Missing | [recommendation] |
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This spec coverage matrix table has the same || leading-pipe issue as the findings table, which breaks table rendering. Replace || with | for the header, separator, and data rows.

Copilot uses AI. Check for mistakes.
Comment on lines +43 to +45
| Area | Tests Exist? | Coverage | Gaps |
|------|-------------|----------|------|
| [Module/Feature] | βœ…/❌ | [%] | [untested paths] |
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test coverage assessment table header starts with ||, which adds an unintended blank column in Markdown table rendering. Use a single leading | consistently.

Copilot uses AI. Check for mistakes.
Comment on lines +51 to +56
| Metric | Value |
|--------|-------|
| Files reviewed | [count] |
| πŸ”΄ Blockers | [count] |
| 🟑 Warnings | [count] |
| 🟒 Suggestions | [count] |
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The metrics summary table has an extra leading pipe (|| Metric | Value |), which will misalign the table (extra empty column). Use the standard single leading pipe format to keep columns consistent.

Copilot uses AI. Check for mistakes.
- 🟒 **Suggestion**: Code clarity improvement, refactoring opportunity, documentation gap, minor style inconsistency. **Nice to fix but non-blocking.**

10. **Generate Review Report**:
Create the review report at `FEATURE_DIR/reviews/review-{timestamp}.md` using the review report template. The report must include:
Copy link

Copilot AI Apr 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 10 references "the review report template" but doesn’t name the concrete template file (unlike other commands that reference templates/*-template.md). Point explicitly to templates/review-template.md and ensure FEATURE_DIR/reviews/ is created if missing. Also specify a filesystem-safe timestamp format (e.g., YYYYMMDD-HHMMSS) to avoid characters like : that break on Windows.

Suggested change
Create the review report at `FEATURE_DIR/reviews/review-{timestamp}.md` using the review report template. The report must include:
Create the review report in a new file at `FEATURE_DIR/reviews/review-{YYYYMMDD-HHMMSS}.md` using the `templates/review-template.md` review report template. Ensure the `FEATURE_DIR/reviews/` directory exists (create it if necessary). The report must include:

Copilot uses AI. Check for mistakes.
@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented Apr 1, 2026

Please deliver this as an extension. See https://github.com/github/spec-kit/tree/main/extensions

- Reference templates/review-template.md explicitly in step 10
- Ensure FEATURE_DIR/reviews/ directory exists before writing
- Use filesystem-safe timestamp format (YYYYMMDD-HHMMSS)
- Note: tables already use correct single-pipe format (no double-pipe issue)
@arunt14
Copy link
Copy Markdown
Contributor Author

arunt14 commented Apr 1, 2026

Thanks for the review! Addressed in the latest push:

1-4. Double-pipe table issue: Investigated and confirmed the tables in review-template.md already use correct single-pipe format β€” no || leading pipes exist in the actual file content. This may have been a rendering artifact in the diff view.
5. Step 10 template reference: Now explicitly references templates/review-template.md, ensures FEATURE_DIR/reviews/ directory is created if missing, and uses a filesystem-safe timestamp format (YYYYMMDD-HHMMSS) to avoid issues with : on Windows.

@mnriem
Copy link
Copy Markdown
Collaborator

mnriem commented Apr 1, 2026

Please review https://github.com/github/spec-kit/blob/main/extensions/EXTENSION-PUBLISHING-GUIDE.md for publishing a community hosted extension

@arunt14
Copy link
Copy Markdown
Contributor Author

arunt14 commented Apr 1, 2026

Thanks @mnriem! I've reviewed the Extension Publishing Guide. Will restructure this as a community extension following the extension.yml manifest pattern and resubmit as an extension contribution to catalog.community.json.

@arunt14
Copy link
Copy Markdown
Contributor Author

arunt14 commented Apr 1, 2026

Re: the double-pipe (||) table comments - I've re-inspected the raw file content of review-template.md line by line and confirmed there are no double leading pipes anywhere. All tables consistently use single | format. This appears to have been a rendering artifact in the diff view. Happy to take another look if you can point to a specific line that still shows the issue.

@arunt14
Copy link
Copy Markdown
Contributor Author

arunt14 commented Apr 1, 2026

Closing in favor of PR #2049 β€” restructured as a community extension per maintainer feedback. Extension repo and v1.0.0 release are available.

@arunt14 arunt14 closed this Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants