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.4---56**Language: Always interact with the user in 日本語.**78# code-review-git-en910Ideal for self-review before PR creation or final check before merge.1112## Prerequisites1314- Claude Code environment15- `git`, `gh` CLI1617## Arguments1819- No arguments: Diff between current branch and `origin/develop`20- Branch specified: Compare against specified remote branch (e.g., `origin/main`)2122## Phase 1: Diff Retrieval and Analysis23241. `git fetch origin`252. Determine comparison branch (argument provided -> use it / none -> `origin/develop`)263. Get merge base (`git merge-base <comparison-branch> HEAD`)274. Diff file list (`git diff --name-status <merge-base>...HEAD`)285. Diff stats (`git diff --stat <merge-base>...HEAD`)296. Commit list (`git log --oneline <merge-base>..HEAD`)307. Create tasks with TaskCreate3132## Phase 2: Code Quality Check (diff only)3334Retrieve diffs of changed files and **check focusing on changed areas**. Read surrounding context (full function, etc.) as needed.3536Check criteria in `references/check-criteria.md`.3738#### Steps391. Classify changed files (source code, tests, config, docs)402. Retrieve and check diff for each source file413. Read full file if surrounding context is needed424. Check test validity if test files were changed4344## Phase 3: Doc Drift Check (docs vs code within diff)4546**Cross-reference changes within the diff only.** Do not scan all project docs.47481. Classify diff files (docs: `.md`/`.rst`/`.txt` / code: source and config)492. Identify code changes that need doc updates (API changes, config changes, structure changes)503. Identify doc changes that should have corresponding code changes514. Detect drift:52 - Code changed, no doc update -> missing update53 - Doc changed, no code change -> advance update or unnecessary change54 - Both changed, contradictory -> inconsistency5556## Phase 4: Test Execution5758Run tests if possible and include results in report.5960## Phase 5: Report Generation61621. Confirm output destination with `AskUserQuestion`:63 - **GitHub Issue** (recommended): `review: Git diff review (<branch> -> <comparison>, <YYYY-MM-DD>)`64 - **Local MD**: `code-review-git-report.md`65 - **Console output**: Print the report directly in the conversation662. Use report format from `templates/report.md`673. Report summary to user6869## Severity Criteria7071| Severity | Criteria |72|----------|----------|73| Critical | Security risk, data loss, production incident, docs clearly contradicting spec |74| Important | Bug risk, architecture violation, insufficient tests, missing doc updates |75| Suggestion | Readability/maintainability improvements, refactoring candidates, doc supplements |76| Minor | Naming improvements, code style, wording inconsistencies |7778## Rules7980- **Focus on diff.** Unchanged code is out of scope (except obvious security risks)81- Never report based on guesses. Verify against actual code and diff82- Always include file path and line number in findings83- Provide concrete improvement suggestions84- Check surrounding context (full function, callers, etc.) for accurate review85- Always include Critical/Important findings. Include Suggestion/Minor only if clear benefit86- Respect project conventions and patterns87- Doc drift check is limited to cross-referencing changes within the diff88- Track progress with TaskCreate/TaskUpdate