بنقرة واحدة
sg-review
Directly perform code review on changed files — prose review mode without Superpowers
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Directly perform code review on changed files — prose review mode without Superpowers
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
| name | sg-review |
| description | Directly perform code review on changed files — prose review mode without Superpowers |
| argument-hint | [implementation description] - optional. Falls back to most recent commit message. |
<execution_context> Self-contained. Reads git history to derive BASE_SHA and HEAD_SHA, reads changed files, reads PLAN.md for requirements, writes SUMMARY.md. </execution_context>
1. **Derive git range.** ```bash HEAD_SHA=$(git rev-parse HEAD) BASE_OVERRIDE="" # If ARGUMENTS is a SHA or sha..sha range, use as base override if printf '%s' "${ARGUMENTS:-}" | grep -qE '^[0-9a-f]{7,40}\.\.[0-9a-f]{7,40}$'; then BASE_SHA=$(printf '%s' "$ARGUMENTS" | cut -d. -f1) HEAD_SHA=$(printf '%s' "$ARGUMENTS" | sed 's/.*\.\.//') BASE_OVERRIDE="$ARGUMENTS" elif printf '%s' "${ARGUMENTS:-}" | grep -qE '^[0-9a-f]{7,40}$'; then BASE_SHA=$(git rev-parse "$ARGUMENTS" 2>/dev/null) if [ -z "$BASE_SHA" ]; then echo "Error: '$ARGUMENTS' is not a valid SHA." exit 1 fi BASE_OVERRIDE="$ARGUMENTS" else BASE_SHA=$(git merge-base HEAD main 2>/dev/null \ || git merge-base HEAD master 2>/dev/null \ || git rev-parse HEAD~1 2>/dev/null \ || git rev-parse HEAD) fi if [ "$BASE_SHA" = "$HEAD_SHA" ]; then # Phase 42/43 retro P1 #2 closure: detect uncommitted phase implementation. # AskUserQuestion is not available in this environment, so emit a concrete # suggested command and exit instead of auto-committing. WORKING_PORCELAIN=$(git status --porcelain 2>/dev/null) if [ -z "$WORKING_PORCELAIN" ]; then
echo "Error: BASE_SHA == HEAD_SHA and working tree is clean — no commits to review."
echo "Options:"
echo " 1. Pass an explicit base SHA: sg-review <base-sha>"
echo " 2. Pass a range: sg-review <base-sha>..<head-sha>"
echo " 3. Run from a feature branch after committing your changes."
exit 1
fi
CURRENT_PHASE_SLUG=$(grep -E '^\| [0-9]{4}-' .planning/HANDOFF.md 2>/dev/null \
| tail -1 | awk -F'|' '{gsub(/^[ \t]+|[ \t]+$/,"",$3); print $3}')
PHASE_NUM_AUTO=$(printf '%s' "$CURRENT_PHASE_SLUG" | sed -E 's/^0*([0-9]+)-.*/\1/')
PHASE_PAD_AUTO=$(printf "%02d" "$PHASE_NUM_AUTO" 2>/dev/null || echo "$PHASE_NUM_AUTO")
CANDIDATES=$(printf '%s\n' "$WORKING_PORCELAIN" \
| awk '{sub(/^[^ ]+ +/, ""); print}' \
| grep -E "^(skills/|\.agents/skills/|\.planning/phases/${PHASE_PAD_AUTO}-[^/]*/(.*SUMMARY|parallel_groups))" \
|| true)
PHASE_SUBJECT_SLUG=$(printf '%s' "$CURRENT_PHASE_SLUG" | sed -E 's/^[0-9]+-//' | tr '-' ' ')
echo "Error: BASE_SHA == HEAD_SHA — no commits to review."
if [ -n "$CANDIDATES" ]; then
echo ""
echo "Working tree contains likely Phase ${PHASE_NUM_AUTO} implementation:"
printf '%s\n' "$CANDIDATES" | sed 's/^/ /'
echo ""
echo "Commit these files first, then re-run sg-review. Suggested commands:"
echo ""
echo " git add \\"
printf '%s\n' "$CANDIDATES" | sed 's|^| |;s|$| \\|'
echo " git commit -m \"feat(${PHASE_PAD_AUTO}): ${PHASE_SUBJECT_SLUG}\""
else
echo "Options:"
echo " 1. Pass an explicit base SHA: sg-review <base-sha>"
echo " 2. Pass a range: sg-review <base-sha>..<head-sha>"
echo " 3. Commit your working tree changes (no phase-implementation candidates detected)."
fi
exit 1
fi echo "Reviewing: $BASE_SHA..$HEAD_SHA"
2. **Determine description.**
```bash
# If BASE_OVERRIDE is set, ARGUMENTS is a SHA so don't use as description
if [ -n "$ARGUMENTS" ] && [ -z "$BASE_OVERRIDE" ]; then
DESCRIPTION="$ARGUMENTS"
else
DESCRIPTION=$(git log --format=%s -1)
DESCRIPTION="${DESCRIPTION:-(no commit message found)}"
fi
Read .planning/STATE.md, then extract the Phase: value from the YAML frontmatter. Set PHASE_NUM to the extracted value.
if [ -n "$PHASE_NUM" ]; then
PHASE_PAD=$(printf "%02d" "$PHASE_NUM")
PLAN_FILE=$(ls .planning/phases/${PHASE_PAD}-*/*-PLAN.md 2>/dev/null | tail -1)
else
PLAN_FILE=""
fi
if [ -n "$PLAN_FILE" ]; then
# Read the PLAN_FILE path, then extract the text content between <objective> and </objective> tags. Set PLAN_REQUIREMENTS.
else
PLAN_REQUIREMENTS="(no plan file found — review current HEAD changes)"
fi
3.9. Record review row in HANDOFF.md.
HANDOFF_FILE=".planning/HANDOFF.md"
if [ ! -f "$HANDOFF_FILE" ] || ! grep -q "Timestamp.*Phase.*From.*To.*Plan Hash" "$HANDOFF_FILE" 2>/dev/null; then
mkdir -p "$(dirname "$HANDOFF_FILE")"
printf '| Timestamp | Phase | From | To | Plan Hash | User |\n| --- | --- | --- | --- | --- | --- |\n' > "$HANDOFF_FILE"
fi
TS=$(date -u +%Y-%m-%dT%H:%M:%SZ)
PHASE_PAD_R=$(printf "%02d" "${PHASE_NUM:-0}" 2>/dev/null || echo "${PHASE_NUM:-0}")
PHASE_SLUG_R=$(ls -d .planning/phases/${PHASE_PAD_R}-* 2>/dev/null | head -1 | xargs basename 2>/dev/null)
[ -z "$PHASE_SLUG_R" ] && PHASE_SLUG_R="${PHASE_NUM:-unknown}"
Read .planning/HANDOFF.md, then extract the To column (5th pipe-delimited field) from the last row starting with "| " followed by a 4-digit year. Set FROM_STAGE_R (default "init" if empty).
[ -z "$FROM_STAGE_R" ] && FROM_STAGE_R="init"
GIT_USER=$(git config user.name 2>/dev/null || echo "-")
[ -z "$GIT_USER" ] && GIT_USER="-"
echo "| $TS | $PHASE_SLUG_R | $FROM_STAGE_R | review | - | $GIT_USER |" >> "$HANDOFF_FILE"
Perform prose review directly.
## Code Review Execution
Review range: $BASE_SHA..$HEAD_SHA
Implementation: $DESCRIPTION
--- Review procedure ---
Execute the following steps in order:
a. Check changed file list with git diff $BASE_SHA $HEAD_SHA --name-only
b. Open each changed file with the Read tool to inspect contents
c. Perform review against the following criteria:
.planning/phases/NN-*/NN-01-SUMMARY.md:# Phase N Review Summary
## What Was Implemented
<DESCRIPTION>
## Git Range
Base: <BASE_SHA>
Head: <HEAD_SHA>
## Review Findings
| severity | file | finding |
|----------|------|---------|
| high | path/to/file | description |
| medium | path/to/file | description |
| low | path/to/file | description |
## Verdict
approved | approved-with-comments | revision-required
## Follow-up Actions
- [ ] item
e. After completion, output:
Review complete. Result: <VERDICT>
Next step: /super-gsd:sg-learn
<success_criteria>
review row is recorded in HANDOFF.md.Detect the current workflow stage from HANDOFF.md and STATE.md and report the next sg-* skill to activate.
Detect existing session or start new project — super-gsd workflow entry point
Display current workflow stage, last handoff timestamp, and next recommended command
Toggle the sg-learn stage on or off in the super-gsd workflow by flipping super_gsd.skip_learn in .planning/config.json. Accepts on|off, or no argument to flip.
Toggle the sg-review stage on or off in the super-gsd workflow by flipping super_gsd.skip_review in .planning/config.json. Accepts on|off, or no argument to flip.
Toggle the sg-tdd stage on or off in the super-gsd workflow by flipping super_gsd.tdd_mode in .planning/config.json. Accepts on|off, or no argument to flip.