Review the quality, architectural compliance, and security of code changes.
Flow
Step 1: Check the changes
git diff main...HEAD --stat
git diff main...HEAD
The base branch follows the repository's conventions (main / develop , etc.).
Or target a specific file or directory (if specified by the user).
Step 2: ① Specification compliance review
Delegate to the Agent tool to verify compliance with the specification:
Check items:
- Whether the requirements and acceptance criteria of the corresponding Issue/PR are satisfied
- Whether any out-of-scope implementation has been mixed in
- Whether there is any deviation from the plan (
_/local-plans/, etc.)
Step 3: ② Code quality review (including OWASP security)
Delegate to the Agent tool to check code quality and security:
Check items (quality):
- Architectural compliance (component hierarchy, placement location)
- Naming conventions
- Import rules
- If frontend (React, etc.) changes are included: unnecessary re-render risks and props minimization
- Test coverage
Check items (security, mandatory):
- OWASP Top 10 (XSS, CSRF, injection, etc.)
- Hardcoding API keys and secrets
- Input validation (validation at system boundaries)
- Authentication and authorization implementation
- Handling of sensitive data
Step 4: Generate the report
If out-of-scope items are detected, include "Items excluded from scope" and proposed handling in this report (see "Handling out-of-scope items" below). The issue number for the extracted follow-up will be finalized when the issue is created after user approval, so write 'TBD' at the report stage. Collect out-of-scope items during the review (Steps 2–3).
Compile the report in the following format (described in two stages: ① specification compliance and ② code quality/security):
## Code Review Results
### ①仕様準拠レビュー
✅ 問題なし
- ...
⚠️ 要確認:
- 受け入れ条件 X が未実装
### ②コード品質レビュー
#### コード品質
✅ 問題なし
- ...
⚠️ 要改善(非ブロッキング):
- `src/components/Foo.tsx:42` — 説明
❌ 要修正(ブロッキング):
- `src/components/Bar.tsx:10` — 説明
#### セキュリティ(OWASP)
✅ 問題なし
- ...
❌ セキュリティ問題:
- 深刻度: HIGH/MEDIUM/LOW
- `src/api/endpoint.ts:20` — 説明
- 推奨修正: ...
Handling out-of-scope items
This skill is in principle a read-only review, but if during the review it detects matters that should be addressed but are judged to be outside the current scope (unaddressed improvements, separate features, technical debt, follow-up work), track them rather than leaving them unattended.An exception that performs write operations, namely commenting on/creating Issues, only when out-of-scope items are detected and after obtaining user approvalAssume.
Procedure
- Check existing Issues Search for existing open Issues implementing the target:
gh issue list --state open --search "${KEYWORD}"
The keyword is "${KEYWORD}" and pass it quoted.
-
Present it to the user and obtain approval Include out-of-scope items, whether an existing Issue exists, and proposed handling (adding a comment to an existing Issue or creating a new one) in the review report and present them to the user.Execute after obtaining approval(do not perform Issue operations without confirmation).
-
If an existing Issue exists: add a comment
gh issue comment "${ISSUE_NUMBER}" --body "$(cat <<'EOF'
## 実装サポート情報(別作業から検出)
### 検出背景
コードレビュー(`git diff` ベース)の過程で発見した事項。
### 関連ファイル・シンボル
- `src/path/to/file.ts` — 対象関数名・クラス名
### パッケージ・サービスから見た役割・影響範囲
(このシンボルの担う境界、呼び出し元/呼び出し先)
### 着手時の注意点・依存関係
(依存パッケージ、順序制約など)
EOF
)"
-
If no existing Issue exists: create a new one
create-issue-treeif introduced, use it (for linking to an existing route, use--root <ルートissue番号>), if not introduced, usecreate-issueto create it under the appropriate parent Issue. The title shall be in Conventional Commits format. -
State it clearly in the review report Out-of-scope items are collected during the review (Steps 2-3) and included in the Step 4 report. Write operations to Issues are performed after approval. The review report shall state the "items excluded from scope" and the proposed handling. Since the destination Issue number is finalized by creation after approval, it shall be 'TBD' at the time of the report, and the finalized number shall be notified separately after creation.
Security note:
ghThe keyword and comment body passed to"${var}"shall be quoted with the variable<<'EOF'), and the body shall be passed via HEREDOC (
Verification
After the review is complete, confirm that the report contains both sections "(1) Specification compliance" and "(2) Code quality/security" (if .claude/rules/verification.md exists in the target repository, follow its 5-level gate. If it does not exist, follow the next key points: do not declare completion without evidence). If security issues (HIGH) remain, do not declare completion.
Common failures
| Problem | Workaround |
|---|---|
| Entering the code quality review without confirming specification compliance | Follow the order of Step 2 ((1) Specification compliance) -> Step 3 ((2) Code quality/security) |
| Reporting the security review separately and independently from code quality | Integrate and report it in the "Security (OWASP)" subsection within the (2) code quality section |
| Leaving out-of-scope detections unrecorded | When detected, immediately record it in the "items excluded from scope" section of Step 4, and turn it into an Issue after approval |
Notes
- This skill, in principle, performs only read-only review (no automatic fixes). However, solely for the purpose of out-of-scope tracking, write operations such as Issue comments/creation after user approval are exceptionally permitted
- Advise that security issues must always be fixed before merging
Execution in a sandbox environment
Step 1〜4(git diff reading, (1) specification compliance review, (2) code quality/security review, report generation) can be executed in a sandbox environment. It does not perform operations over the network, and does not write outside the workspace. As a prerequisite, the base ref (origin/<base> etc.) must exist locally, and updating base to the latest git fetch is a network operation, so disable the sandbox on a per-command basis. Only the out-of-scope tracking in "Notes" (posting Issue comments and creating new issues) is an optional step that requires the network, so disable the sandbox on a per-command basis.