review-preplisted
Install: claude install-skill jamestexas/agents
# review-prep — Structural Pre-flight for PR Review
Produce the reviewer's local structural context before analysis agents run.
**This output is local only — never include it in a GitHub review.**
## Arguments
`$ARGUMENTS` — `<pr-number-or-repo#N> [repo-path]`
- First arg: PR number (e.g. `123`) or `owner/repo#N` (e.g. `myorg/myrepo#123`)
- Second arg (optional): local path to the repo checkout
## What To Do
### Step 1: Get changed files
```bash
# Parse PR ref
if echo "$PR_ARG" | grep -q '#'; then
REPO=$(echo "$PR_ARG" | cut -d'#' -f1)
PR_NUM=$(echo "$PR_ARG" | cut -d'#' -f2)
CHANGED_FILES=$(gh pr diff "$PR_NUM" --repo "$REPO" --name-only 2>/dev/null)
else
PR_NUM="$PR_ARG"
CHANGED_FILES=$(gh pr diff "$PR_NUM" --name-only 2>/dev/null)
fi
```
If `$CHANGED_FILES` is empty, report:
```
status: unavailable
reason: could not fetch PR diff — check gh auth and PR number
```
Stop here.
### Step 2: Determine scope directory
Find the lowest common ancestor of changed `.go` files:
```bash
GO_FILES=$(echo "$CHANGED_FILES" | grep '\.go$')
if [ -z "$GO_FILES" ]; then
echo "status: unavailable"
echo "reason: no Go files changed in this PR — review-prep targets Go codebases"
exit 0
fi
SCOPE_DIR=$(echo "$GO_FILES" | xargs -I{} dirname {} | sort -u | \
python3 -c "
import sys
dirs = [d.strip() for d in sys.stdin.readlines()]
if not dirs: exit(1)
common = dirs[0]
for d in dirs[1:]:
while not d.startswith(common):
common = '/'.join(common.split('/')[:-1])