Language: Always interact with the user in 日本語.
code-review-git-en
Ideal for self-review before PR creation or final check before merge.
Prerequisites
- Claude Code environment
git, gh CLI
Arguments
- No arguments: Diff between current branch and
origin/develop
- Branch specified: Compare against specified remote branch (e.g.,
origin/main)
Phase 1: Diff Retrieval and Analysis
git fetch origin
- Determine comparison branch (argument provided -> use it / none ->
origin/develop)
- Get merge base (
git merge-base <comparison-branch> HEAD)
- Diff file list (
git diff --name-status <merge-base>...HEAD)
- Diff stats (
git diff --stat <merge-base>...HEAD)
- Commit list (
git log --oneline <merge-base>..HEAD)
- Create tasks with TaskCreate
Phase 2: Code Quality Check (diff only)
Retrieve diffs of changed files and check focusing on changed areas. Read surrounding context (full function, etc.) as needed.
Check criteria in references/check-criteria.md.
Steps
- Classify changed files (source code, tests, config, docs)
- Retrieve and check diff for each source file
- Read full file if surrounding context is needed
- Check test validity if test files were changed
Phase 3: Doc Drift Check (docs vs code within diff)
Cross-reference changes within the diff only. Do not scan all project docs.
- Classify diff files (docs:
.md/.rst/.txt / code: source and config)
- Identify code changes that need doc updates (API changes, config changes, structure changes)
- Identify doc changes that should have corresponding code changes
- Detect drift:
- Code changed, no doc update -> missing update
- Doc changed, no code change -> advance update or unnecessary change
- Both changed, contradictory -> inconsistency
Phase 4: Test Execution
Run tests if possible and include results in report.
Phase 5: Report Generation
- Confirm output destination with
AskUserQuestion:
- GitHub Issue (recommended):
review: Git diff review (<branch> -> <comparison>, <YYYY-MM-DD>)
- Local MD:
code-review-git-report.md
- Console output: Print the report directly in the conversation
- Use report format from
templates/report.md
- Report summary to user
Severity Criteria
| Severity |
Criteria |
| Critical |
Security risk, data loss, production incident, docs clearly contradicting spec |
| Important |
Bug risk, architecture violation, insufficient tests, missing doc updates |
| Suggestion |
Readability/maintainability improvements, refactoring candidates, doc supplements |
| Minor |
Naming improvements, code style, wording inconsistencies |
Rules
- Focus on diff. Unchanged code is out of scope (except obvious security risks)
- Never report based on guesses. Verify against actual code and diff
- Always include file path and line number in findings
- Provide concrete improvement suggestions
- Check surrounding context (full function, callers, etc.) for accurate review
- Always include Critical/Important findings. Include Suggestion/Minor only if clear benefit
- Respect project conventions and patterns
- Doc drift check is limited to cross-referencing changes within the diff
- Track progress with TaskCreate/TaskUpdate
1---2name: code-review-git-en3description: Code quality check and doc drift detection on git diff against remote.4user-invocable: true5---67**Language: Always interact with the user in 日本語.**89# code-review-git-en1011Ideal for self-review before PR creation or final check before merge.1213## Prerequisites1415- Claude Code environment16- `git`, `gh` CLI1718## Arguments1920- No arguments: Diff between current branch and `origin/develop`21- Branch specified: Compare against specified remote branch (e.g., `origin/main`)2223## Phase 1: Diff Retrieval and Analysis24251. `git fetch origin`262. Determine comparison branch (argument provided -> use it / none -> `origin/develop`)273. Get merge base (`git merge-base <comparison-branch> HEAD`)284. Diff file list (`git diff --name-status <merge-base>...HEAD`)295. Diff stats (`git diff --stat <merge-base>...HEAD`)306. Commit list (`git log --oneline <merge-base>..HEAD`)317. Create tasks with TaskCreate3233## Phase 2: Code Quality Check (diff only)3435Retrieve diffs of changed files and **check focusing on changed areas**. Read surrounding context (full function, etc.) as needed.3637Check criteria in `references/check-criteria.md`.3839#### Steps401. Classify changed files (source code, tests, config, docs)412. Retrieve and check diff for each source file423. Read full file if surrounding context is needed434. Check test validity if test files were changed4445## Phase 3: Doc Drift Check (docs vs code within diff)4647**Cross-reference changes within the diff only.** Do not scan all project docs.48491. Classify diff files (docs: `.md`/`.rst`/`.txt` / code: source and config)502. Identify code changes that need doc updates (API changes, config changes, structure changes)513. Identify doc changes that should have corresponding code changes524. Detect drift:53 - Code changed, no doc update -> missing update54 - Doc changed, no code change -> advance update or unnecessary change55 - Both changed, contradictory -> inconsistency5657## Phase 4: Test Execution5859Run tests if possible and include results in report.6061## Phase 5: Report Generation62631. Confirm output destination with `AskUserQuestion`:64 - **GitHub Issue** (recommended): `review: Git diff review (<branch> -> <comparison>, <YYYY-MM-DD>)`65 - **Local MD**: `code-review-git-report.md`66 - **Console output**: Print the report directly in the conversation672. Use report format from `templates/report.md`683. Report summary to user6970## Severity Criteria7172| Severity | Criteria |73|----------|----------|74| Critical | Security risk, data loss, production incident, docs clearly contradicting spec |75| Important | Bug risk, architecture violation, insufficient tests, missing doc updates |76| Suggestion | Readability/maintainability improvements, refactoring candidates, doc supplements |77| Minor | Naming improvements, code style, wording inconsistencies |7879## Rules8081- **Focus on diff.** Unchanged code is out of scope (except obvious security risks)82- Never report based on guesses. Verify against actual code and diff83- Always include file path and line number in findings84- Provide concrete improvement suggestions85- Check surrounding context (full function, callers, etc.) for accurate review86- Always include Critical/Important findings. Include Suggestion/Minor only if clear benefit87- Respect project conventions and patterns88- Doc drift check is limited to cross-referencing changes within the diff89- Track progress with TaskCreate/TaskUpdate