From empire-dev
Converts team-review findings into question-style PR comments, validates each with the user, then posts a single GitHub review.
How this skill is triggered — by the user, by Claude, or both
Slash command
/empire-dev:socratic-pr-reviewThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
<section id="overview">
Socratic PR review: lead the author to the defect with a question, do not dictate the fix. Pipeline: resolve PR → team-review → draft question-comments → re-check vs code → validate one by one → propose verdict → post one review atomically. This is the one empire-dev skill that writes to GitHub. It posts exactly ONE review, only after the user validates every comment and the verdict.
gh pr view --json number,url,headRefOidOWNER/REPO from the PR's OWN base repo, never from gh repo view (the cwd repo may differ from the PR's repo or fork):
gh pr view "$PR" --json number,url,baseRefName,headRefOid (a bare number resolves against cwd; pass a full URL for any other repo or fork)OWNER/REPO from the returned .url (https://github.com/OWNER/REPO/pull/N); set PR from .numberOWNER/REPO#PR @ <sha> + url and confirm it is the intended PR before team-review or any post. A wrong target is unrecoverable once posted.SHA as provisional here; re-fetch it immediately before posting (see post-review).team-review skill on the resolved PR; pass the PR number.path + line from the diff:
side: RIGHTside: LEFT, only when that line sits inside a displayed diff hunk; else fold into the summary bodystart_line + line (same side)X guaranteed to be non-null".permissions / harness-support replace allowed-tools / compatibility, or coexist?"permissions values?", "Why drop the retry here?"items is empty?" not "This crashes on empty input."user" → "Is user ever null by the time we reach this?"path:line and a 1-2 line diff snippet for contextAPPROVE — no unresolved Must-fix; only questions or nits remainREQUEST_CHANGES — one or more unresolved Must-fix commentsCOMMENT — questions worth raising, no blocking stanceREQUEST_CHANGES blocks the PR; MUST confirm the blocking event explicitly, separate from summary approval.Post the ENTIRE review in ONE GitHub API call. Never post comments individually; never create a pending review then submit separately.
Immediately before posting:
SHA=$(gh pr view "$PR" --json headRefOid -q .headRefOid). If it changed since target-detection, warn the user and re-confirm (anchors may have drifted).OWNER/REPO#PR @ $SHA, event — and get a final explicit "post" confirmation. The per-comment gate does not cover the destination.Build the payload with jq into a temp file; pass every comment body and the summary as --arg values, NEVER via string interpolation (bodies hold quotes, backticks, $()). Then a single POST, deleting the temp file after:
payload=$(mktemp)
# Append each comment as data, never interpolated into the JSON:
comments='[]'
comments=$(jq -c --arg path "$P" --argjson line "$N" --arg side RIGHT --arg body "$Q" \
'. + [{path: $path, line: $line, side: $side, body: $body}]' <<<"$comments")
# repeat per comment; for a span add --argjson start_line and --arg start_side
jq -n --arg commit "$SHA" --arg event "$EVENT" --arg body "$SUMMARY" --argjson comments "$comments" \
'{commit_id: $commit, event: $event, body: $body, comments: $comments}' >"$payload"
gh api --method POST "repos/$OWNER/$REPO/pulls/$PR/reviews" --input "$payload"
rm -f "$payload"
payload.json shape:
{
"commit_id": "<SHA>",
"event": "COMMENT|APPROVE|REQUEST_CHANGES",
"body": "<summary or empty>",
"comments": [
{ "path": "src/x.ts", "line": 42, "side": "RIGHT", "body": "..." },
{
"path": "src/x.ts",
"start_line": 40,
"start_side": "RIGHT",
"line": 44,
"side": "RIGHT",
"body": "..."
}
]
}
With comments present, any event MAY omit body; with no comments, COMMENT and REQUEST_CHANGES require a non-empty body (APPROVE MAY always be empty).
After posting, report the review URL from the API response.
On API error (line not in diff, stale SHA): re-resolve the anchor or SHA and retry the single call, max 2 retries. If a retry changes an anchor the user validated, re-confirm that comment first. Never split into multiple posts; surface to the user after repeated failure.
npx claudepluginhub marcoskichel/empire --plugin empire-devProvides behavioral guidelines to reduce common LLM coding mistakes, focusing on simplicity, surgical changes, assumption surfacing, and verifiable success criteria.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.