jpskill.com
🛠️ 開発・MCP コミュニティ

code-review-standards

Code review framework and criteria. References security-sentinel for security checks. Use when performing code reviews or defining review standards.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o code-review-standards.zip https://jpskill.com/download/17456.zip && unzip -o code-review-standards.zip && rm code-review-standards.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17456.zip -OutFile "$d\code-review-standards.zip"; Expand-Archive "$d\code-review-standards.zip" -DestinationPath $d -Force; ri "$d\code-review-standards.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して code-review-standards.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → code-review-standards フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

コードレビュー基準

適用場面

  • プルリクエストのレビュー
  • コードレビューの実施
  • レビュー基準の定義
  • レビュープロセスの確立

概要

コードレビュー基準は、一貫性のある徹底的なレビューを保証し、バグが本番環境に到達する前に検出します。このスキルは、専門的なスキルからの基準を集約したものです。

レビューフレームワーク

4段階の重大度分類

  1. CRITICAL 🔴 - マージ前に修正必須

    • セキュリティ脆弱性
    • データ損失のリスク
    • 認証バイパス
    • SQL injection のリスク
  2. HIGH 🟠 - マージ前に修正すべき

    • TypeScript strict mode 違反
    • エラー処理の欠落
    • パフォーマンスの問題 (N+1 クエリ)
    • 入力検証の欠落
  3. MEDIUM 🟡 - 近いうちに修正 (計画があればマージ可能)

    • コード品質の問題
    • テストの欠落
    • 不適切な命名
    • ドキュメントの欠落
  4. LOW 🟢 - あると良い

    • スタイルの提案
    • 最適化の機会
    • リファクタリングのアイデア

レビューチェックリスト

1. 正確性

→ 参照: correctness-criteria.md

  • [ ] すべてのテストケースに対してロジックが正しい
  • [ ] エッジケースが処理されている (null, empty, max, min)
  • [ ] エラー条件が適切に処理されている
  • [ ] 戻り値の型が関数シグネチャと一致する
  • [ ] 非同期操作が適切に await されている
  • [ ] 競合状態がない
  • [ ] off-by-one エラーがない

2. セキュリティ

→ 参照: security-sentinel skill → 参照: security-checklist.md

CRITICAL - すべてのレビューで確認必須:

  • [ ] ハードコードされたシークレットがない
  • [ ] Zod による入力検証 (すべての入力)
  • [ ] 保護されたルートで認証がチェックされている
  • [ ] 認可が強制されている (リソースの所有権)
  • [ ] SQL injection が防止されている (Drizzle を使用)
  • [ ] XSS が防止されている (サニタイズなしに dangerouslySetInnerHTML を使用しない)
  • [ ] 状態を変更する操作に対する CSRF 保護
  • [ ] ログに機密データがない
  • [ ] パスワードがハッシュされている (bcrypt, 12+ ラウンド)
  • [ ] JWT が適切に検証されている

完全なセキュリティ基準:security-sentinel/SKILL.md


3. TypeScript 品質

→ 参照: typescript-strict-guard skill

  • [ ] any 型がない
  • [ ] 詳しいコメントなしに @ts-ignore がない
  • [ ] コメントなしに ! non-null assertion がない
  • [ ] すべての関数パラメータに明示的な型がある
  • [ ] すべての関数に明示的な戻り値の型がある
  • [ ] 型ガードが不明な型に使用されている
  • [ ] ジェネリクスの適切な使用
  • [ ] 暗黙的な any がない

4. テスト

→ 参照: quality-gates/test-patterns.md

  • [ ] 新しいコードに対するテストが存在する
  • [ ] テストが AAA パターンに従っている
  • [ ] カバレッジが閾値を満たしている (75%/90%)
  • [ ] UI テストが DOM の状態を検証する (モックだけではない)
  • [ ] 視覚的な変更に対する E2E テスト
  • [ ] 理由なくスキップされたテストがない
  • [ ] テストが独立している
  • [ ] テストが後処理を行っている

5. パフォーマンス

→ 参照: performance-criteria.md

  • [ ] N+1 クエリの問題がない
  • [ ] データベースクエリが最適化されている
  • [ ] 非同期操作が可能な限り並列化されている
  • [ ] 大規模なデータセットがページネーションされている
  • [ ] 画像が最適化されている
  • [ ] 不要な再レンダリングがない
  • [ ] コストの高い計算がメモ化されている

6. コード品質

→ 参照: maintainability-rules.md

  • [ ] 本番コードに console.log がない
  • [ ] コメントアウトされたコードがない
  • [ ] GitHub issue なしに TODO がない
  • [ ] 関数が単一責任を持つ
  • [ ] 変数名が記述的である
  • [ ] デッドコードがない
  • [ ] 重複したロジックがない
  • [ ] 適切なエラーメッセージ

7. アーキテクチャ準拠

→ 参照: architecture-patterns skill

  • [ ] 問題に対して正しいパターンが選択されている
  • [ ] パターンが正しく実装されている
  • [ ] パターンの違反がない
  • [ ] Next.js のベストプラクティスに従っている
  • [ ] Server vs Client Components が正しい
  • [ ] 状態管理が適切である

レビュープロセス

ステップ 1: 事前レビュー (2 分)

  1. PR の説明を読む
  2. 何が変更されたのか、なぜ変更されたのかを理解する
  3. CI/CD のステータスを確認する (テスト、ビルド、カバレッジ)
  4. リスクの高い領域を特定する (認証、支払い、データ処理)

ステップ 2: セキュリティレビュー (5 分)

すべての PR に対して:

  • ハードコードされたシークレットがないか確認する
  • 入力検証を確認する
  • 認証/認可を確認する

Auth/API/Data PR に対して:

  • security-sentinel skill を実行する
  • OWASP Top 10 の基準を確認する
  • インジェクションのリスクを確認する

security-checklist.md

ステップ 3: コードレビュー (10-20 分)

  1. 正確性: 意図したとおりに動作するか?
  2. TypeScript: strict mode に準拠しているか?
  3. テスト: 適切なカバレッジと品質か?
  4. パフォーマンス: 明らかな問題はないか?
  5. 品質: 読みやすく、保守しやすいコードか?
  6. アーキテクチャ: 確立されたパターンに従っているか?

ステップ 4: フィードバックの記述 (5 分)

重大度レベルとテンプレートを使用する: → review-templates.md

フォーマット:

## 🔴 CRITICAL Issues

- [ ] [Security] Hardcoded API key in auth.ts:45
  - **Risk**: API key exposed in version control
  - **Fix**: Move to environment variable
  - **File**: src/lib/auth.ts:45

## 🟠 HIGH Issues

- [ ] [TypeScript] Using `any` type in processData()
  - **Issue**: No type safety
  - **Fix**: Define explicit interface
  - **File**: src/utils/process.ts:12

## 🟡 MEDIUM Issues

- [ ] [Testing] Missing tests for error cases
  - **Coverage**: Only happy path tested
  - **Needed**: Test null input, invalid format
  - **File**: tests/unit/process.test.ts

## 🟢 LOW Issues / Suggestions

- Consider extracting helper function for readability

ステップ 5: 評決

いずれかを選択:

  • APPROVE - 重大な/高い問題なし
  • 🔄 REQUEST CHANGES - 重大または複数の高い問題あり
  • 💬 COMMENT - 質問または低い/中程度の問題のみ

レビューテンプレート

セキュリティ問題テンプレート

🔴 **[Security] [Vulnerability Type]**

**Location**: `src/path/file.ts:123`

**Issue**: [Description of vulnerability]

**Risk**: [What could go wrong]

**Fix**:
```typescript
// Suggested fix

Reference: [OWASP

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

Code Review Standards

When to Use

  • Reviewing pull requests
  • Performing code reviews
  • Defining review criteria
  • Establishing review process

Overview

Code review standards ensure consistent, thorough reviews that catch bugs before they reach production. This skill aggregates criteria from specialized skills.

Review Framework

4-Level Severity Classification

  1. CRITICAL 🔴 - Must fix before merge

    • Security vulnerabilities
    • Data loss risks
    • Authentication bypasses
    • SQL injection risks
  2. HIGH 🟠 - Should fix before merge

    • TypeScript strict mode violations
    • Missing error handling
    • Performance issues (N+1 queries)
    • Missing input validation
  3. MEDIUM 🟡 - Fix soon (can merge with plan)

    • Code quality issues
    • Missing tests
    • Poor naming
    • Missing documentation
  4. LOW 🟢 - Nice to have

    • Style suggestions
    • Optimization opportunities
    • Refactoring ideas

Review Checklist

1. Correctness

→ See: correctness-criteria.md

  • [ ] Logic is correct for all test cases
  • [ ] Edge cases handled (null, empty, max, min)
  • [ ] Error conditions properly handled
  • [ ] Return types match function signatures
  • [ ] Async operations properly awaited
  • [ ] No race conditions
  • [ ] No off-by-one errors

2. Security

→ See: security-sentinel skill → See: security-checklist.md

CRITICAL - Must check every review:

  • [ ] No hardcoded secrets
  • [ ] Input validation with Zod (ALL inputs)
  • [ ] Authentication checked on protected routes
  • [ ] Authorization enforced (resource ownership)
  • [ ] SQL injection prevented (using Drizzle)
  • [ ] XSS prevented (no dangerouslySetInnerHTML without sanitization)
  • [ ] CSRF protection on state-changing operations
  • [ ] No sensitive data in logs
  • [ ] Passwords hashed (bcrypt, 12+ rounds)
  • [ ] JWTs properly verified

For complete security criteria:security-sentinel/SKILL.md


3. TypeScript Quality

→ See: typescript-strict-guard skill

  • [ ] No any types
  • [ ] No @ts-ignore without extensive comment
  • [ ] No ! non-null assertions without comment
  • [ ] Explicit types on all function parameters
  • [ ] Explicit return types on all functions
  • [ ] Type guards used for unknown types
  • [ ] Proper use of generics
  • [ ] No implicit any

4. Testing

→ See: quality-gates/test-patterns.md

  • [ ] Tests exist for new code
  • [ ] Tests follow AAA pattern
  • [ ] Coverage meets thresholds (75%/90%)
  • [ ] UI tests verify DOM state (not just mocks)
  • [ ] E2E tests for visual changes
  • [ ] No skipped tests without reason
  • [ ] Tests are independent
  • [ ] Tests clean up after themselves

5. Performance

→ See: performance-criteria.md

  • [ ] No N+1 query problems
  • [ ] Database queries optimized
  • [ ] Async operations parallelized where possible
  • [ ] Large datasets paginated
  • [ ] Images optimized
  • [ ] No unnecessary re-renders
  • [ ] Expensive calculations memoized

6. Code Quality

→ See: maintainability-rules.md

  • [ ] No console.log in production code
  • [ ] No commented-out code
  • [ ] No TODO without GitHub issue
  • [ ] Functions have single responsibility
  • [ ] Variable names are descriptive
  • [ ] No dead code
  • [ ] No duplicated logic
  • [ ] Proper error messages

7. Architecture Compliance

→ See: architecture-patterns skill

  • [ ] Correct pattern chosen for problem
  • [ ] Pattern implemented correctly
  • [ ] No pattern violations
  • [ ] Follows Next.js best practices
  • [ ] Server vs Client Components correct
  • [ ] State management appropriate

Review Process

Step 1: Pre-Review (2 minutes)

  1. Read PR description
  2. Understand what changed and why
  3. Check CI/CD status (tests, build, coverage)
  4. Identify high-risk areas (auth, payments, data handling)

Step 2: Security Review (5 minutes)

For ALL PRs:

  • Check for hardcoded secrets
  • Verify input validation
  • Check authentication/authorization

For Auth/API/Data PRs:

  • Run security-sentinel skill
  • Review OWASP Top 10 criteria
  • Check for injection risks

security-checklist.md

Step 3: Code Review (10-20 minutes)

  1. Correctness: Does it work as intended?
  2. TypeScript: Strict mode compliance?
  3. Testing: Adequate coverage and quality?
  4. Performance: Any obvious issues?
  5. Quality: Readable, maintainable code?
  6. Architecture: Follows established patterns?

Step 4: Write Feedback (5 minutes)

Use severity levels and templates: → review-templates.md

Format:

## 🔴 CRITICAL Issues

- [ ] [Security] Hardcoded API key in auth.ts:45
  - **Risk**: API key exposed in version control
  - **Fix**: Move to environment variable
  - **File**: src/lib/auth.ts:45

## 🟠 HIGH Issues

- [ ] [TypeScript] Using `any` type in processData()
  - **Issue**: No type safety
  - **Fix**: Define explicit interface
  - **File**: src/utils/process.ts:12

## 🟡 MEDIUM Issues

- [ ] [Testing] Missing tests for error cases
  - **Coverage**: Only happy path tested
  - **Needed**: Test null input, invalid format
  - **File**: tests/unit/process.test.ts

## 🟢 LOW Issues / Suggestions

- Consider extracting helper function for readability

Step 5: Verdict

Choose one:

  • APPROVE - No critical/high issues
  • 🔄 REQUEST CHANGES - Critical or multiple high issues
  • 💬 COMMENT - Questions or low/medium issues only

Review Templates

Security Issue Template

🔴 **[Security] [Vulnerability Type]**

**Location**: `src/path/file.ts:123`

**Issue**: [Description of vulnerability]

**Risk**: [What could go wrong]

**Fix**:
```typescript
// Suggested fix

Reference: [OWASP link or skill reference]


### TypeScript Issue Template

```markdown
🟠 **[TypeScript] [Issue Type]**

**Location**: `src/path/file.ts:45`

**Issue**: [What's wrong]

**Fix**:
```typescript
// Current (bad)
function process(data: any) { }

// Suggested (good)
function process(data: ProcessData): ProcessedResult { }

Reference: typescript-strict-guard skill


### Performance Issue Template

```markdown
🟡 **[Performance] [Issue Type]**

**Location**: `src/path/file.ts:78`

**Issue**: N+1 query problem in getUserProjects()

**Impact**: Linear time complexity, slow for large datasets

**Fix**:
```typescript
// Use join instead of separate queries
const projects = await db
  .select()
  .from(projectsTable)
  .leftJoin(usersTable, eq(projectsTable.userId, usersTable.id))

---

## Common Review Patterns

### Code Smells

**Long Functions**
```typescript
// 🔴 BAD: 100+ line function
function processEverything() {
  // ... 100 lines
}

// ✅ GOOD: Extracted helpers
function processEverything() {
  const validated = validateInput()
  const processed = processData(validated)
  const saved = saveToDatabase(processed)
  return saved
}

Deeply Nested Logic

// 🔴 BAD: 4+ levels of nesting
if (user) {
  if (user.projects) {
    if (user.projects.length > 0) {
      if (user.projects[0].status === 'active') {
        // ...
      }
    }
  }
}

// ✅ GOOD: Early returns
if (!user) return
if (!user.projects || user.projects.length === 0) return
if (user.projects[0].status !== 'active') return
// ...

Magic Numbers

// 🔴 BAD: Unexplained numbers
setTimeout(callback, 3600000)

// ✅ GOOD: Named constants
const ONE_HOUR_MS = 60 * 60 * 1000
setTimeout(callback, ONE_HOUR_MS)

Progressive Disclosure

  1. SKILL.md (this file) - Review framework overview
  2. security-checklist.md - OWASP Top 10 checklist
  3. performance-criteria.md - Performance review criteria
  4. maintainability-rules.md - Code quality rules
  5. review-templates.md - Feedback templates

Integration with Other Skills

Code review aggregates criteria from:

  • security-sentinel - Security vulnerability checks
  • typescript-strict-guard - Type safety validation
  • quality-gates - Quality checkpoint framework
  • architecture-patterns - Pattern compliance
  • nextjs-15-specialist - Next.js best practices

Example Review

# Code Review: Add User Authentication

## Summary
Adds JWT-based authentication with login/logout endpoints.

## 🔴 CRITICAL Issues

### 1. Hardcoded JWT Secret
**File**: `src/lib/auth.ts:12`
**Issue**: JWT secret is hardcoded as "secret123"
**Risk**: Anyone can forge JWTs
**Fix**:
```typescript
- const secret = "secret123"
+ const secret = process.env.JWT_SECRET
+ if (!secret) throw new Error('JWT_SECRET not set')

🟠 HIGH Issues

2. Missing Input Validation

File: src/app/api/auth/login/route.ts:15 Issue: User input not validated before use Fix: Add Zod schema validation

const loginSchema = z.object({
  email: z.string().email(),
  password: z.string().min(8),
})

const validated = loginSchema.parse(body)

🟡 MEDIUM Issues

3. Missing Tests

File: tests/integration/auth.test.ts Issue: No tests for error cases Needed:

  • Test invalid email format
  • Test wrong password
  • Test expired JWT

Verdict

🔄 REQUEST CHANGES - Fix critical and high issues before merge.

Once fixed, this will be a solid authentication implementation.



---

## See Also

- security-checklist.md - OWASP Top 10 checklist
- performance-criteria.md - Performance review guide
- maintainability-rules.md - Code quality rules
- review-templates.md - Feedback templates
- ../security-sentinel/SKILL.md - Security patterns
- ../quality-gates/SKILL.md - Quality framework