| name | branch-diff-code-review |
| description | 當使用者想對當前分支自其 base 分支分岔以來的所有變更做一般性程式碼審查、且不將審查範圍預設為 origin/main 時,使用此 skill。它應判定分支的 fork point、檢視完整的 branch diff、優先處理 bug 與回歸風險,並以 zh-tw 呈現審查結果,同時遵循 repository 的 .gemini/styleguide.md 程式碼審查人設與結尾儀式。 |
Branch Diff Code Review
Use this skill when the user wants a code review for the whole branch after it split from its base, rather than a review of only the latest commit or a fixed comparison against origin/main.
Required Style Guide
Before writing the review, read the repository style guide at:
../../../.gemini/styleguide.md
Treat its Code Review Feedback Persona: The Versatile Poet section as mandatory.
Minimum requirements from the style guide:
- write the review in
zh-tw
- keep necessary
en-us technical terms in English
- end every completed review with one randomly chosen literary closing style:
Do not skip the closing ritual, even when the findings are short.
Review Goal
Review the branch diff from the actual branch divergence point.
Focus on finding:
- correctness bugs
- behavior regressions
- edge-case handling problems
- state or data flow risks
- API contract mismatches
- missing or weak test coverage
- maintainability issues that are likely to hide bugs
Do not optimize for praise-first summaries.
Findings come first.
Workflow
- Resolve the review target:
- default to the current checked-out branch
- if the user names a branch or base reference, use that instead
- Determine the most credible review base without assuming
origin/main:
- first prefer a user-provided base reference
- otherwise check the branch upstream when it exists
- otherwise infer the most likely parent branch from local git context and reachable refs
- Determine the fork point:
- prefer
git merge-base --fork-point when it returns a valid ancestor
- fall back to
git merge-base when fork-point metadata is unavailable
- Collect diff and commit data:
- run
git diff <fork_point>...HEAD and git log --oneline <fork_point>..HEAD
- collect
git diff --stat for a file overview
- Inspect changed files and read surrounding code where needed before judging behavior.
- agy 優先策略:收集完 diff 與程式碼觀察後,優先委派 antigravity-cli(
agy)生成審查報告本文:
- (Fallback)自行依 diff 與程式碼觀察撰寫審查報告,遵循 Output Rules 格式。
- Prefer evidence from the repository over speculation.
- When a suspected issue depends on unseen runtime behavior, mark it as a risk or open question instead of overstating certainty.
- Check whether tests were added or updated when the branch changes behavior.
- Keep the review scoped to the branch diff unless the user explicitly asks for wider architectural analysis.
Investigation Guidance
Use fast local inspection first:
git branch --show-current
git rev-parse --abbrev-ref --symbolic-full-name @{upstream}
git merge-base --fork-point <base> HEAD
git merge-base <base> HEAD
git diff <fork_point>...HEAD --stat
git diff <fork_point>...HEAD -- <path>
git log --oneline <fork_point>..HEAD
rg for impacted symbols, call sites, tests, routes, providers, services, and models
When the branch base is ambiguous, state the chosen base and why.
If no safe base can be inferred, stop and report that the review scope could not be determined reliably.
Output Rules
Present findings first, ordered by severity.
Preferred structure:
Findings
Open Questions / Assumptions
Summary
- Literary closing selected from the style guide
For each finding:
- include severity such as
P0 to P3 when useful
- include file and line references when you can support them
- explain the concrete risk, likely behavior, and why it matters
- mention missing tests when that is part of the risk
If there are no findings:
- say so explicitly
- still mention any residual risk or testing gap
- still include the literary closing
Tone Rules
- primary language:
zh-tw
- preserve
en-us proper nouns and technical terms
- tone: direct, calm, evidence-based
- avoid vague feedback such as
建議再確認
- prefer concrete statements such as
這裡在 empty state 會提前 return,導致 loading flag 無法復原
Scope Boundaries
- default to review only committed and uncommitted branch changes that are part of the requested diff scope
- do not silently switch to
origin/main comparison just because it is available
- do not review only
HEAD unless the user explicitly asks for latest-commit review
- do not rewrite code unless the user asks to address findings