gza-code-review-interactive
Review changes on current branch and output a structured review. Optionally post to PR with --pr flag, or apply non-blocking follow-ups inline with --apply-followups.
mhawthorne · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add mhawthorne/gza --skill gza-code-review-interactive技能说明
name: gza-code-review-interactive description: Review changes on current branch and output a structured review. Optionally post to PR with --pr flag, or apply non-blocking follow-ups inline with --apply-followups. allowed-tools: Bash(git:), Bash(gh:), Bash(uv run:*), Read, Edit, Write, Glob, Grep, Agent, AskUserQuestion version: 2.4.0 public: true
Interactive Code Review
Review committed changes on the current feature branch and output a structured review.
Requires being on a non-main branch with commits ahead of main. If not, stop and tell the user: "Switch to a feature branch with commits to review. This skill reviews committed changes on feature branches (git diff main...HEAD)."
Arguments
--pr— Post the review as a PR comment (requires an existing PR on the branch)--apply-followups— After the review, apply all non-blocking follow-ups inline without prompting. Has no effect if the verdict isCHANGES_REQUESTED(blockers exist) or if the review reports no follow-ups. Without this flag, the skill prompts the user interactively before applying.- No arguments — Just output the review locally, no PR interaction. If follow-ups exist, prompt the user once at the end (see Step 6).
Process
Step 1: Verify branch state
- Check current branch:
git branch --show-current- If on
mainormaster, stop and tell the user to switch to a feature branch
- If on
- Check for uncommitted changes:
git status --porcelain- If there are uncommitted changes, warn the user but proceed with reviewing committed changes
- Check if branch has commits ahead of main:
git log main..HEAD --oneline- If no commits ahead, stop and tell the user there's nothing to review
Step 2: Find PR (only if --pr flag is set)
- Look up existing PR:
gh pr view --json number,url,title 2>/dev/null - If no PR exists, stop and tell the user to create one first (do NOT create a PR automatically)
- Capture the PR number and URL
Step 3: Capture review context in the parent session
Capture canonical ask context before spawning the reviewer:
- If the caller already provided a
## Review scope:section, pass it through unchanged, along with any## Original plan context (out of scope except for the review scope):section. - Otherwise, if the caller already provided exactly one canonical ask section (
## Original plan:or## Original request:), pass that section through unchanged. - Otherwise, try to resolve ask context from the branch's linked gza task chain (
uv run gza show <TASK_ID>/uv run gza log <TASK_ID>is preferred once you identify the task for this branch). - If linked ask content exists but is unavailable on this machine, pass an explicit unavailable-content marker section (for example,
## Original plan:followed by(plan task <TASK_ID> exists but content unavailable on this machine - flag as blocker)). - If no retrievable plan or request exists for this branch, pass no ask section and let the reviewer state:
No plan or request provided.
Then capture the committed diff:
- If the caller already provided diff context, use that as-is and do not reconstruct it. Otherwise, collect the committed branch diff once in the parent session:
git diff main...HEAD
Pass this diff to the subagent as ## Implementation diff context.
Step 4: Run the review
Spawn a general-purpose Agent subagent to perform the review. Give it this prompt (include the captured diff context):
You are reviewing a pull request. Your job is to read the project review guidelines, examine the diff, and produce a structured review.
Step 1: Read REVIEW.md from the project root for review guidelines and criteria.
Step 2: Start with a repo-rules/learnings pass: compare the diff and behavior against AGENTS.md, REVIEW.md, project docs, and .gza/learnings.md; call out violations or regressions explicitly.
Keep this review stack-agnostic. If project verification instructions are missing, state that explicitly in assumptions/risks.
Step 3: The provided diff is authoritative - do not use git commands to reconstruct, re-derive, or expand it. You may read unchanged source files when surrounding context is needed to judge correctness.
Step 3.5: When you need to verify behavior that isn't visible in the diff (e.g., whether a CLI command exists, how a called function works, what a referenced method does), use the Read, Grep, or Glob tools to check the current codebase. Do not guess or assume — verify.
Step 3.7: If ## Review scope: is present, grade ask-adherence against that section only and use any original-plan-context section only for boundaries/contracts. Otherwise, review the diff against the provided canonical ask context (## Original plan: or ## Original request:). If ask content is marked unavailable, call that out as a blocker. If neither ask section is provided, state No plan or request provided.
Step 4: Write a structured review with these sections:
## Summary
<Provide 3-5 bullets summarizing the review>
<Then answer this checklist with exactly 6 bullets in `Yes/No - ...` form and one short evidence clause each:>
<- Did I check the diff against AGENTS.md and `.gza/learnings.md` and flag any violations/regressions?>
<- Did I check for silent broad-exception fallbacks that mask errors while changing user/agent-visible state?>
<- Did I check for misleading output (contradictory UI/prompt/context signals)?>
<- Was a `## Review scope:` section provided, and if so did I grade ask-adherence against that scope while treating sibling slices as non-blocking unless they break an explicit contract? Otherwise, was an `## Original plan:` or `## Original request:` section provided, and did I verify ask-adherence against it while calling out intentional deviations? If neither was provided, did I state "No plan or request provided."?>
<- Did I require targeted regression tests that match each failure mode (not generic "add tests
阅读完整来源 ↗