agentleFS
teltringhamteltringham/sdd-plugin/skills/sdd-review/SKILL.md

sdd-review

Skill0 starsChanged 8 months agoMITView on GitHub

Reviews implemented code against spec acceptance criteria, checks traceability, and flags backpropagation candidates. Invokes the sdd-evaluator agent for adversarial review. Use after /sdd-implement completes, before shipping, or when reviewing a PR.

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. felipefontoura/pi-sdd-kit★ 34same name
    2. sivaprasadreddy/sdd-skills★ 32same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository13 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. About 0 are common, 9 are distinctive, and 15 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈9

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 15

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use --auto when invoking from Mission Runner, CI, or any non-interactive context.

    line 23
  2. Very specific:

    If PR number: get diff via gh pr diff

    line 29
  3. Very specific:

    If commit range: git diff {range}

    line 31
  4. Very specific:

    If story ID: find commits with matching Spec-Ref trailer

    line 32
  5. Very specific:

    If omitted: git diff since last commit with Attempt: trailer

    line 33
  6. Very specific:

    Read prd.json to find which stories are covered by the changes

    line 37
  7. Distinctive:

    Read the relevant spec files (only the requirements referenced by those stories)

    line 38
  8. Very specific:

    Read the constitution (${CLAUDE_PLUGIN_ROOT}/constitution.md)

    line 39
  9. Very specific:

    Read accepted ADRs whose affects_specs intersects this scope (use sdd_query_adrs MCP tool when available.

    line 40
  10. Distinctive:

    Before invoking the evaluator, run a premortem prompt over the diff: "It is 30 days from now.

    line 44
  11. Distinctive:

    Test that exercises it (file:line)

    line 63
  12. Distinctive:

    Do any of the premortem failure modes apply to this diff?

    line 71
  13. Very specific:

    Do all commits have Spec-Ref: trailers?

    line 74
  14. Very specific:

    If an ADR is contradicted, REQUEST_CHANGES with a recommendation: either supersede the ADR or revise the implementation.

    line 81
  15. Distinctive:

    No injection vulnerabilities (SQL, command, XSS)

    line 84
  16. Distinctive:

    No hardcoded secrets or credentials

    line 85
  17. Distinctive:

    If so, flag as backpropagation candidates

    line 90
  18. Very specific:

    If the evaluator's verdict is APPROVE, optionally invoke the sdd-skeptic agent for an independent second opinion.

    line 101
  19. Very specific:

    Interactive mode (default): if reviewing a PR, ask: "Post this review as a PR comment?" If approved, post via gh pr comment.

    line 145
  20. Very specific:

    Autonomous mode (--auto): do NOT prompt. Write the §6 structured markdown to stdout for log capture, then write a JSON sidecar to:

    line 147
  21. Distinctive:

    Create parent directories as needed.

    line 153
  22. Very specific:

    If verdict is request_changes or needs_work, the Mission Runner can route into /sdd-iterate (using backprop_candidates[].suggested_command) …

    line 215
  23. Distinctive:

    Read-only analysis (no code modifications beyond the autonomous-mode sidecar)

    line 223
  24. Very specific:

    Every spec requirement carries a {user-story, AC, test, code-line} quad — missing pieces block APPROVE.

    line 225

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

SDD Review

Spec-compliance code review with traceability verification.

Arguments

$ARGUMENTS — optional: a PR number, branch name, commit range, or story ID. If omitted, reviews all changes since the last Ralph run.

--auto — optional flag. Skips the §7 "Post this review as a PR comment?" interactive prompt and instead emits a structured JSON sidecar that the Mission Runner can consume. Default: omitted (human-driven). See "Modes" below.

Modes

This skill runs in two modes that share §1–§6 (scope detection, spec context, premortem, evaluator invocation, optional skeptic, structured markdown output) and diverge at §7:

  • Interactive (default) — at §7, ask the operator "Post this review as a PR comment?"; if yes, post via gh pr comment. The structured markdown from §6 is the primary output.
  • Autonomous (--auto) — at §7, skip the prompt entirely. Write the §6 structured markdown to stdout AND a machine-readable JSON sidecar to <repoRoot>/.sdd/review-runs/STORY-{N}/review-{ts}.json where STORY-{N} is the story ID inferred from the scope (or unscoped if no story ID is identifiable) and {ts} is a UTC ISO-8601 timestamp safe for filenames (YYYYMMDDTHHMMSSZ). Mission Runner reads this sidecar to drive next-step routing without parsing markdown. No PR comment is posted in autonomous mode.

Use --auto when invoking from Mission Runner, CI, or any non-interactive context. Default behavior is unchanged for human-driven /sdd-review.

Process

1. Determine review scope

  • If PR number: get diff via gh pr diff
  • If branch: git diff main...{branch}
  • If commit range: git diff {range}
  • If story ID: find commits with matching Spec-Ref trailer
  • If omitted: git diff since last commit with Attempt: trailer

2. Load spec context

  • Read prd.json to find which stories are covered by the changes
  • Read the relevant spec files (only the requirements referenced by those stories)
  • Read the constitution (${CLAUDE_PLUGIN_ROOT}/constitution.md)
  • Read accepted ADRs whose affects_specs intersects this scope (use sdd_query_adrs MCP tool when available; fall back to scanning context/decisions/)

3. Premortem (prospective hindsight)

Before invoking the evaluator, run a premortem prompt over the diff: "It is 30 days from now. This change has caused an incident in production. What was the failure mode? Walk through the most plausible cause."

Klein/Mitchell-Kamen research shows prospective hindsight identifies failure causes ~30% better than baseline. Capture the top 3 plausible failures; the evaluator will explicitly check the diff against each.

4. Invoke sdd-evaluator agent

Delegate to sdd-evaluator with:

  • The diff
  • The spec acceptance criteria (Given/When/Then)
  • The story acceptance criteria from prd.json
  • Accepted ADRs whose affects_specs covers this story
  • The premortem-identified failure modes

The evaluator checks:

Spec Compliance — {user-story, AC, test, code-line} quad per requirement (mandatory): For each acceptance criterion, the evaluator MUST produce a quad:

  • User-story: the user story this requirement serves (from its Serves: field or the parent story title)
  • AC text (verbatim from spec)
  • Test that exercises it (file:line)
  • Code line(s) that satisfy it (file:line)

The user-story anchor is mandatory. A missing user-story anchor blocks APPROVE with REQUEST_CHANGES — missing the story anchor is treated the same as a missing test or code-line. A missing element in any part of the quad = REQUEST_CHANGES.

Spec Compliance — semantic check:

  • Does the implementation truly satisfy Given/When/Then, or does it just pass the test?
  • Could any edge case violate a criterion?
  • Do any of the premortem failure modes apply to this diff?

Traceability:

  • Do all commits have Spec-Ref: trailers?
  • For two-commit pattern: does each story have BOTH a test: and feat: commit, with test: preceding feat:?
  • Are there orphan changes (files not linked to any spec)?
  • Does git log match prd.json story list?

ADR conformance:

  • Does the implementation respect every accepted ADR whose affects_specs covers this scope?
  • If an ADR is contradicted, REQUEST_CHANGES with a recommendation: either supersede the ADR or revise the implementation.

Security (per constitution):

  • No injection vulnerabilities (SQL, command, XSS)
  • No hardcoded secrets or credentials
  • Auth/authz checks present where needed

Backpropagation Signals:

  • Are any commits manual fixes (fix: prefix without Attempt: trailer)?
  • If so, flag as backpropagation candidates
  • Auto-suggest running /sdd-iterate on them (don't silently flag).

Verification record evidence (per Phase 2.2 of spec-plugin-v1.md). When the diff touches a spec referenced by a backprop entry in context/impl/backprop-log.json, surface that entry's verification status in the review evidence. Read the log dual-shape:

  • New entries (post-§2.2) carry a structured verification object (command, artifact_path, production_entrypoint, calibration_lineage, wiring_audit_pass, auditor, notes). Cite the relevant fields directly as review evidence.
  • Legacy entries (pre-§2.2) have only the verified_via_ralph boolean and no verification record (or verification: null post-migration). Surface the boolean and flag the entry as legacy pre-§2.2 — no structured evidence available. Do NOT treat a legacy verified_via_ralph: true as equivalent to a current verification record; it predates the structured-evidence requirement and the cross-family wiring-audit gate.

The dual-shape read stays open until v1.x decides on verified_via_ralph removal timing (open question in spec-plugin-v1.md).

5. Optional adversarial round (Skeptic)

If the evaluator's verdict is APPROVE, optionally invoke the sdd-skeptic agent for an independent second opinion. Different system prompt, no shared context with the evaluator. The skeptic's only job: find what the evaluator missed.

This is the "diversity of attack" pattern — different prompt = different blind spots. Recommended for: high-risk diffs (touching auth, data layer, money), large diffs (>200 LOC), or any diff where the evaluator's verdict feels glib.

6. Structured output

## SDD Review

### Premortem failure modes considered:
1. {failure mode 1} — addressed | unaddressed
2. {failure mode 2} — ...
3. {failure mode 3} — ...

### Spec Compliance: {N}/{total} requirements verified
- SPEC-{slug}-001: PASS | FAIL | UNTESTED
  - User-story: {story title or ID this requirement serves}
  - AC: "{verbatim from spec}"
  - Test: {file:line}
  - Code: {file:line}
- SPEC-{slug}-002: ...

### Traceability: COMPLETE | GAPS
- Commits with Spec-Ref: {N}/{total}
- Two-commit pattern (test before impl): {N}/{stories} stories
- Orphan changes: {list or "none"}

### ADR conformance: PASS | VIOLATIONS
- {ADR-NNN}: respected | contradicted ({explanation})

### Security: PASS | ISSUES
- {issue description if any}

### Backpropagation Candidates: {N}
- {commit hash}: {why it's a candidate} → suggest `/sdd-iterate {hash}`

### Skeptic findings (if run): {list or "none"}

### Verdict: APPROVE | REQUEST_CHANGES
{One sentence summary}

7. Post to PR or emit sidecar (mode-dependent)

Interactive mode (default): if reviewing a PR, ask: "Post this review as a PR comment?" If approved, post via gh pr comment.

Autonomous mode (--auto): do NOT prompt. Write the §6 structured markdown to stdout for log capture, then write a JSON sidecar to:

<repoRoot>/.sdd/review-runs/STORY-{N}/review-{ts}.json

Create parent directories as needed. The sidecar shape:

{
  "schema_version": 1,
  "scope": "STORY-3 | PR#42 | branch/foo | <range>",
  "story_id": "STORY-3 | null",
  "verdict": "approve | request_changes | needs_work",
  "timestamp_utc": "2026-05-15T18:42:31Z",
  "premortem_failure_modes": [
    { "summary": "string", "addressed": true }
  ],
  "spec_compliance": {
    "verified": 0,
    "total": 0,
    "findings": [
      {
        "requirement_id": "SPEC-foo-001",
        "status": "pass | fail | untested",
        "ac_text": "verbatim from spec",
        "test_ref": "path/to/test.py:42",
        "code_ref": "path/to/impl.py:88",
        "notes": "string"
      }
    ]
  },
  "traceability": {
    "status": "complete | gaps",
    "spec_ref_commits": { "present": 0, "total": 0 },
    "two_commit_pattern_stories": { "present": 0, "total": 0 },
    "orphan_changes": ["path/to/file"]
  },
  "adr_conformance": [
    { "adr_id": "ADR-001", "status": "respected | contradicted", "notes": "string" }
  ],
  "security": { "status": "pass | issues", "issues": ["string"] },
  "backprop_candidates": [
    { "commit_hash": "abc123", "reason": "string", "suggested_command": "/sdd-iterate abc123" }
  ],
  "skeptic_findings": ["string"],
  "recommended_actions": [
    { "kind": "fix | spec_amend | iterate | none", "target": "string", "rationale": "string" }
  ],
  "verdict_summary": "one-sentence summary"
}

verdict values map from the §6 markdown verdict: APPROVE → approve, REQUEST_CHANGES → request_changes. Use needs_work when the evaluator returned APPROVE but the skeptic flagged blocking issues.

Worked example for Mission Runner consumers:

# Mission Runner invokes /sdd-review on a story it just shipped:
claude --print "/sdd-review STORY-3 --auto"

# Reads the resulting sidecar, branches on verdict:
cat .sdd/review-runs/STORY-3/review-20260515T184231Z.json \
  | jq -r '.verdict, (.recommended_actions[] | .kind)'
# approve
# none

If verdict is request_changes or needs_work, the Mission Runner can route into /sdd-iterate (using backprop_candidates[].suggested_command) or surface recommended_actions to the operator.

8. Log to progress

Append to progress.txt: [{timestamp}] [PASS|FAIL] Review: {scope} — {verdict} (both modes).

Output contract

  • Read-only analysis (no code modifications beyond the autonomous-mode sidecar)
  • Premortem run before evaluator invocation
  • Every spec requirement carries a {user-story, AC, test, code-line} quad — missing pieces block APPROVE; missing user-story anchor is treated the same as a missing test or code-line (REQUEST_CHANGES)
  • ADR conformance checked
  • Two-commit pattern verified per story
  • Backpropagation candidates surfaced WITH a suggested /sdd-iterate command
  • progress.txt updated
  • In --auto mode: structured JSON sidecar written to <repoRoot>/.sdd/review-runs/STORY-{N}/review-{ts}.json and no interactive PR-comment prompt

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.