sdd-review
Use when reviewing code changes before commit, comparing implementation against SDD plan, or doing standalone code review with advisor consultation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when reviewing code changes before commit, comparing implementation against SDD plan, or doing standalone code review with advisor consultation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when creating an SDD implementation plan from exploration.md, with deep interview, task breakdown, and batch assignments.
Generate a Product Requirements Document via interactive interview. Writes a markdown PRD that captures intent, user stories, and out-of-scope. Use when the brief is vague, when no ticket is bound, or when SDD invokes it from its PRD gate.
Use when executing an SDD plan via batch-based task implementation, tracking progress with [ ]/[X] markers and quality gates.
Use when starting an SDD workflow to discover codebase context, curate relevant files, and prepare exploration.md for planning.
SDD Orchestrator coordinates SDD (Spec-Driven Development) workflow via sub-agents
API-first design patterns — OpenAPI, REST conventions, error models, versioning
| name | sdd-review |
| description | Use when reviewing code changes before commit, comparing implementation against SDD plan, or doing standalone code review with advisor consultation. |
| argument-hint | [change_name?] |
| disable-model-invocation | false |
| allowed-tools | Bash(git:*), Bash(pwd), Bash(find:*), Read, Write, Glob, Grep, AskUserQuestion, Skill |
pwdgit rev-parse --is-inside-work-tree 2>/dev/null || echo "__NO_GIT__"Heavy git context (base branch, status, diff, log) is resolved in Step 0 below using
git -C <target_path>after the target repo is determined. This avoids frontmatter pre-execution failures when CWD is a workspace, not a repo.
This skill reads config.json from its own directory (if present):
workspace — Workspace-aware target resolution. See Step 0 below for the schema and algorithm. If config.json is absent, the skill falls back to scanning the CWD on each invocation.The skill may propose updates to config.json (via Write tool) when it discovers repos in a workspace or the user asks to "always" review a specific repo. Write-back is always opt-in: the skill asks via AskUserQuestion before persisting, never overwrites a non-empty value silently, and only modifies its own config.json.
This skill must work in two scenarios: (a) CWD is a git repository (direct mode) and (b) CWD is a workspace containing one or more git repositories nested inside (workspace mode). Resolve the target repo before any git command.
Inputs:
CWD and Is git repo from the Dynamic Context block aboveconfig.json in this skill's directory, specifically the workspace block:
{
"workspace": {
"mode": "auto",
"default_target": "",
"known_repos": []
}
}
Resolution algorithm:
Read config.json from this skill's directory (if it exists; otherwise treat as empty workspace block).
Repo mode detection: if Is git repo == true AND workspace.mode != "multi-repo" → set target_path = ".", skip to step 6 (direct mode).
Workspace mode: resolve target by priority:
a. Explicit user argument — if the user named a repo, match against known_repos[].name first, else against known_repos[].path, else against any directory at <CWD>/<arg> containing a .git/ entry.
b. workspace.default_target — if non-empty AND the resolved path exists AND contains .git/, use it.
c. Single known repo — if known_repos.length == 1 AND the path is valid, use it.
d. Multiple known repos — call AskUserQuestion listing known_repos[].name as options. Add an "Other / scan again" option.
e. Empty known_repos — scan with find . -maxdepth 2 -name .git -type d 2>/dev/null | grep -v "/worktrees/" | grep -v "/.claude/". Each match's parent directory is a repo. Populate a discovery list with {name: <basename>, path: <relative>}. If exactly one → use it. If many → AskUserQuestion. If none → report "no git repository found" and stop.
Store target_path for the rest of the skill (input to git -C).
Configuration write-back (opt-in only): if config.json exists and any of these conditions hold, propose a write-back via AskUserQuestion. Never write silently; never overwrite a non-empty value without explicit confirmation:
known_repos from a scan → "Save these N repos to known_repos so I don't re-scan?"known_repos → "Add it to known_repos?"default_target?"
On confirmation, use the Write tool to update config.json (preserve all other fields, write the file atomically).Resolve heavy git context with target_path:
git -C <target_path> symbolic-ref --short refs/remotes/origin/HEAD 2>/dev/null || echo "origin/main" (fallback chain: try also origin/master if origin/main doesn't exist)git -C <target_path> status --shortgit -C <target_path> diff --stat <base>...HEADgit -C <target_path> diff <base>...HEADgit -C <target_path> log --oneline <base>..HEADUse these values from this point forward. Never cd <target_path> && git ... — Claude Code's anti-pattern alert blocks compound cd && git even with allowlists.
Two Operating Modes:
.sdd/{change-name}/plan.mdThe git status, diff, and log were resolved in Step 0 using git -C <target_path>. Use those values directly — no need to re-execute git commands.
If change_name provided:
.sdd/{change-name}/plan.md to understand expected changes.sdd/{change-name}/exploration.md for additional context if neededIf plan.md is not on disk, fall back to engram via the two-step recovery pattern in _shared/persistence-contract.md. If neither file nor engram has the plan, proceed in standalone mode (git diff only).
Optional build verification: If the diff includes changes to build configuration, dependency files, or structural code, run the project's build command (e.g., make build, mvn compile, npm run build, go build ./...) to verify the build still passes before reporting. This catches compilation errors that git diff alone cannot surface.
If SDD context available (change_name provided):
Always verify:
Change Correctness:
Code Quality & Cleanliness:
Intentionality Check:
Potential Issues to Flag:
Quick path: If git diff --stat shows ≤50 lines changed across ≤3 files, skip advisor skill consultation and proceed directly to the review report. Document 'Advisor consultation skipped — small change (≤50 lines, ≤3 files)' in the report.
Format your review as:
*-advisor pattern) and invoke them via the Skill tool to get a detailed diagnosis before reporting.Save the review-report artifact and any general-knowledge discoveries per _shared/persistence-contract.md (Phase Artifact Save Convention + General Knowledge Persistence Mandate). For this phase, title/topic_key is sdd/{change}/review-report.
Return the SDD Envelope as your last output (format: _shared/envelope-contract.md). Nothing may follow it.
| Field | Value |
|---|---|
| Status | ok (no critical issues) · warning (only minor) · failed (critical issues) |
| Phase | review |
| Artifacts | (none — review produces no file artifacts) |
| Next Recommended | commit if ok/warning; fix if failed |
| Risks | List critical findings, or "None" |
| Engram Ref | Observation ID from the persistence step, or omit if engram unavailable |
Do not invoke any other SDD skill or git commit directly — return the envelope; the orchestrator decides what runs next.
plan.md was read and the implementation was compared against its tasks.*-advisor) — vague verdicts are not Critical Issues.failed only when something must block commit).Specialist skills: any installed *-advisor. Shared contracts: envelope-contract, persistence-contract.
<user_instructions>