Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .claude/commands/pre-pr-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ This command runs a comprehensive checklist to ensure your changes are ready for
5. **Integration Tests**: Runs Bats integration tests
6. **Shellcheck**: Validates shell scripts

### Code Review (5観点)

差分に対して以下の5観点でクイックレビューを実施する:

1. **Security**: 機密情報露出、インジェクション、認証漏れ
2. **Performance**: N+1クエリ、メモリリーク、不要な再レンダリング
3. **Quality**: 命名、単一責任、テストカバレッジ、エラーハンドリング
4. **Accessibility**: ARIA属性、キーボードナビ、セマンティックHTML
5. **AI Residuals**: `it.skip`、`localhost`ハードコード、`TODO`/`FIXME`残骸、仮実装

critical / major の指摘があれば REQUEST_CHANGES 相当として扱い、PR作成前に修正必須とする。
minor / recommendation のみなら APPROVE 相当として通過。
Comment on lines +24 to +35

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

仕様記述と実装が乖離しています(5観点レビュー未実装)。

Line 24-35 と Line 71-78 では /pre-pr-checklist が5観点レビューを実行・表示する前提ですが、script/pre-pr-checklist.sh:45-122 には該当処理がなく、現状は Quality Checks / PR Analysis / Branch Status のみです。ユーザーに誤った期待を与えるため、(1) スクリプト実装を追加するか、実装完了まで (2) 本ドキュメントを「手動レビュー項目」表現に落とす必要があります。

Also applies to: 71-78

🧰 Tools
🪛 LanguageTool

[grammar] ~34-~34: Ensure spelling is correct
Context: ...ritical / major の指摘があれば REQUEST_CHANGES 相当として扱い、PR作成前に修正必須とする。 minor / recommendation のみなら APPROVE 相当として通過。 ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/pre-pr-checklist.md around lines 24 - 35, The doc claims
/pre-pr-checklist runs a 5-point automated review, but
script/pre-pr-checklist.sh (lines ~45-122) doesn't implement those checks;
update either by (A) implementing the missing automated checks in
script/pre-pr-checklist.sh (add functions to perform Security, Performance,
Quality, Accessibility, and AI Residuals checks and ensure /pre-pr-checklist
outputs their results) or (B) change .claude/commands/pre-pr-checklist.md (the
text around the current /pre-pr-checklist references at lines 24-35 and 71-78)
to explicitly state these are manual review items/manual checklist until
automation is added; pick one approach, keep messages and headings consistent
(use the “5観点” terminology), and ensure /pre-pr-checklist and
script/pre-pr-checklist.sh are aligned after the change.


### PR Analysis

- **Size Estimation**: Calculates diff lines and file count
Expand Down Expand Up @@ -55,6 +68,14 @@ This command runs a comprehensive checklist to ensure your changes are ready for
✓ Tests passed (101/101)
✓ Coverage: 82.5% (threshold: 70%)

🔍 Code Review (5観点)
✓ Security: No issues
✓ Performance: No issues
⚠ Quality: 1 minor (naming in src/utils.ts:42)
✓ Accessibility: No issues
⚠ AI Residuals: 1 minor (TODO in src/handler.ts:15)
→ Verdict: APPROVE (minor only)

📊 PR Analysis
• Size: Medium (247 lines, 8 files)
• Suggested label: size/M
Expand Down
38 changes: 38 additions & 0 deletions .claude/commands/repo-maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -620,6 +620,43 @@ PR 作成前のチェック項目を検証:
- ✅ すべてのチェック項目が設定済み
- ⚠️ 不足している項目あり(詳細をリスト)

### 3.3.1 Code Review Rules Check

コードレビュー基準の設定状況を確認:

実行内容:

- `.claude/rules/code-review-standards.md` の存在確認
- `.claude/rules/development-standards.md` の存在確認
- `.claude/rules/git-conventions.md` の存在確認
- config リポジトリのルールファイルとの差分確認(config リポジトリ自身は除く)

Comment on lines +623 to +633

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

ルール検証対象と同期対象の不一致でドリフトが残ります。

このセクションでは code-review-standards.md を必須としている一方、同ファイルの Config Template Sync 管理対象(Line 2253-2255 / Line 2294 以降)に含まれていません。結果として「存在は確認するが更新追従しない」状態になります。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/repo-maintenance.md around lines 623 - 633, The doc marks
`.claude/rules/code-review-standards.md` as required but it is missing from the
Config Template Sync management list, causing drift; update the Config Template
Sync sections (the template management list referenced around Line 2253-2255 and
the template sync rules near Line 2294 onward) to include
`.claude/rules/code-review-standards.md` so the file is both validated and kept
in sync, and ensure the README/sections that enumerate required rule files match
the sync list to prevent future mismatches.

結果:

- ✅ すべてのレビュールールが設定済み
- ⚠️ 不足しているルールあり(詳細をリスト)
- 🔄 config リポジトリとの差分あり(更新推奨ファイルをリスト)

MODE が `full` の場合:

- 不足ルールを config リポジトリからコピー
- 差分があるファイルについて更新を提案
Comment on lines +642 to +643

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include code-review standards in maintenance rule sync

This section says full mode will copy missing review rules, but the command’s executable sync list (MANAGED_FILES in the same file around lines 2294–2304) does not include .claude/rules/code-review-standards.md. That means /repo-maintenance can claim to manage review rules while never actually propagating the new standards file to existing repositories.

Useful? React with 👍 / 👎.


```bash
# config リポジトリのパスを取得(このリポジトリ自身なら SKIP)
CONFIG_REPO="$(git -C /path/to/config rev-parse --show-toplevel 2>/dev/null)"

# ルールファイルの存在確認
RULES_DIR=".claude/rules"
REQUIRED_RULES=("code-review-standards.md" "development-standards.md" "git-conventions.md")

for rule in "${REQUIRED_RULES[@]}"; do
if [ ! -f "${RULES_DIR}/${rule}" ]; then
echo "⚠️ Missing: ${RULES_DIR}/${rule}"
fi
done
```
Comment on lines +645 to +658

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

サンプルスクリプトが実行不能・仕様不足です。

Line 647 の /path/to/config はプレースホルダのままで、さらに記載済み要件(差分確認・config自身除外)がこのコード片で満たされていません。運用手順として誤実装を誘発します。

🔧 提案差分(実行可能な最小版)
-# config リポジトリのパスを取得(このリポジトリ自身なら SKIP)
-CONFIG_REPO="$(git -C /path/to/config rev-parse --show-toplevel 2>/dev/null)"
+# config リポジトリのパスを探索(このリポジトリ自身は SKIP)
+CONFIG_REPO=""
+for p in "$HOME/develop/github.com/keito4/config" "$HOME/ghq/github.com/keito4/config" "$HOME/src/github.com/keito4/config"; do
+  [ -d "$p/.claude/rules" ] && CONFIG_REPO="$p" && break
+done
+
+REPO_NAME=$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null || echo "")
+if [ "$REPO_NAME" = "keito4/config" ]; then
+  echo "⏭️ Skip rules diff check on config repository itself"
+else
+  for rule in "${REQUIRED_RULES[@]}"; do
+    if [ -f "${RULES_DIR}/${rule}" ] && [ -f "${CONFIG_REPO}/.claude/rules/${rule}" ]; then
+      diff -q "${CONFIG_REPO}/.claude/rules/${rule}" "${RULES_DIR}/${rule}" >/dev/null 2>&1 || \
+        echo "🔄 Diff detected: ${RULES_DIR}/${rule}"
+    fi
+  done
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```bash
# config リポジトリのパスを取得(このリポジトリ自身なら SKIP)
CONFIG_REPO="$(git -C /path/to/config rev-parse --show-toplevel 2>/dev/null)"
# ルールファイルの存在確認
RULES_DIR=".claude/rules"
REQUIRED_RULES=("code-review-standards.md" "development-standards.md" "git-conventions.md")
for rule in "${REQUIRED_RULES[@]}"; do
if [ ! -f "${RULES_DIR}/${rule}" ]; then
echo "⚠️ Missing: ${RULES_DIR}/${rule}"
fi
done
```
# config リポジトリのパスを探索(このリポジトリ自身は SKIP)
CONFIG_REPO=""
for p in "$HOME/develop/github.com/keito4/config" "$HOME/ghq/github.com/keito4/config" "$HOME/src/github.com/keito4/config"; do
[ -d "$p/.claude/rules" ] && CONFIG_REPO="$p" && break
done
REPO_NAME=$(gh repo view --json nameWithOwner --jq '.nameWithOwner' 2>/dev/null || echo "")
if [ "$REPO_NAME" = "keito4/config" ]; then
echo "⏭️ Skip rules diff check on config repository itself"
else
for rule in "${REQUIRED_RULES[@]}"; do
if [ -f "${RULES_DIR}/${rule}" ] && [ -f "${CONFIG_REPO}/.claude/rules/${rule}" ]; then
diff -q "${CONFIG_REPO}/.claude/rules/${rule}" "${RULES_DIR}/${rule}" >/dev/null 2>&1 || \
echo "🔄 Diff detected: ${RULES_DIR}/${rule}"
fi
done
fi
# ルールファイルの存在確認
RULES_DIR=".claude/rules"
REQUIRED_RULES=("code-review-standards.md" "development-standards.md" "git-conventions.md")
for rule in "${REQUIRED_RULES[@]}"; do
if [ ! -f "${RULES_DIR}/${rule}" ]; then
echo "⚠️ Missing: ${RULES_DIR}/${rule}"
fi
done
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/repo-maintenance.md around lines 645 - 658, Replace the
hard-coded placeholder and add the missing checks: accept or derive the config
repo path into CONFIG_REPO (e.g., from an argument or GIT_CONFIG_REPO) and
compute CUR_REPO="$(git rev-parse --show-toplevel 2>/dev/null)"; if CONFIG_REPO
is empty fail fast, and if CONFIG_REPO == CUR_REPO skip (to exclude config repo
itself). Then check for REQUIRED_RULES under "${CONFIG_REPO}/${RULES_DIR}"
(using RULES_DIR and REQUIRED_RULES from the diff) and, if you need to only act
on changed files, use git -C "${CONFIG_REPO}" diff --name-only HEAD~1..HEAD (or
a provided ref range) to limit checks to changed rule files; emit clear warnings
for missing files and exit non-zero on fatal cases.


### 3.4 CLAUDE.md Symlink Check

CLAUDE.md が AGENTS.md へのシンボリックリンクであることを確認:
Expand Down Expand Up @@ -2716,6 +2753,7 @@ fi
├── .editorconfig: ✅ Configured (or 🔧 Generated)
├── scripts: ✅ All standard scripts defined (or ⚠️ Missing: test, lint)
├── Pre-PR Checklist: ✅ CI workflow exists
├── Code Review Rules: ✅ All rules configured (or ⚠️ Missing rules)
├── CLAUDE.md: ✅ Symlink to AGENTS.md
├── AGENTS.md: ✅ Auto-generated sections up to date (or 🔧 Updated)
├── CI/CD: ✅ Standard level configured
Expand Down
157 changes: 156 additions & 1 deletion .claude/commands/security-review.md
Original file line number Diff line number Diff line change
@@ -1 +1,156 @@
このコードを10個の改善案を出してください。
---
description: 5観点コードレビュー(Security / Performance / Quality / Accessibility / AI Residuals)
allowed-tools: Read, Grep, Glob, Bash(git:*), Bash(grep:*), Bash(wc:*)
argument-hint: '[--scope FILE_OR_DIR] [--base-ref REF]'
---

# Code Review Command

変更差分を5観点でレビューし、severity ベースの verdict(APPROVE / REQUEST_CHANGES)を返す。

## Step 1: レビュー対象の特定

引数に応じてレビュー対象を決定する。

```bash
# --base-ref が指定されている場合
git diff --name-only --diff-filter=ACMR ${BASE_REF}

# --scope が指定されている場合
# 指定されたファイル/ディレクトリのみ対象

# どちらもない場合: ステージング差分 → 直近コミット差分 → main との差分
git diff --cached --name-only --diff-filter=ACMR
# ステージングが空なら
git diff --name-only --diff-filter=ACMR HEAD~1
# それも空なら
git diff --name-only --diff-filter=ACMR main...HEAD
```

差分がない場合はレビュー不要としてメッセージを表示して終了する。

## Step 2: 差分の収集

```bash
git diff --stat ${BASE_REF:-HEAD~1}
git diff ${BASE_REF:-HEAD~1} -- ${CHANGED_FILES}
```

## Step 3: AI Residuals の静的走査

変更ファイルに対して以下のパターンを検索する。

### Major(出荷リスク)

```
localhost|127\.0\.0\.1|0\.0\.0\.0 # ローカルアドレス
it\.skip|describe\.skip|test\.skip # スキップされたテスト
PRIVATE_KEY|SECRET_KEY|PASSWORD= # ハードコードされた秘密情報候補
staging\.|dev\.|sandbox\. # 環境固定 URL
```
Comment on lines +45 to +50

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fenced code blocks need language tags (MD040).

Line 45, Line 54, and Line 61 use unlabeled fences. Add a language token (e.g. text) to satisfy markdownlint and keep CI stable.

🔧 Proposed fix
-```
+```text
 localhost|127\.0\.0\.1|0\.0\.0\.0   # ローカルアドレス
 it\.skip|describe\.skip|test\.skip  # スキップされたテスト
 PRIVATE_KEY|SECRET_KEY|PASSWORD=    # ハードコードされた秘密情報候補
 staging\.|dev\.|sandbox\.           # 環境固定 URL

@@
- +text
mockData|dummyData|fakeData|testData # テストデータ残骸
TODO|FIXME|HACK|XXX # 未対応マーカー

@@
-```
+```text
temporary|placeholder|replace.later|workaround  # 仮実装コメント
</details>
Based on learnings: Fail on code formatting violations during code review.


Also applies to: 54-57, 61-63

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.0)</summary>

[warning] 45-45: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @.claude/commands/security-review.md around lines 45 - 50, Update the three
unlabeled fenced code blocks that contain the regex lists (the blocks starting
with lines containing "localhost|127.0.0.1|0.0.0.0",
"mockData|dummyData|fakeData|testData", and
"temporary|placeholder|replace.later|workaround") by adding a language token
(e.g., text) immediately after each opening triple backtick so the fences read


### Minor(残骸候補)

```
mockData|dummyData|fakeData|testData # テストデータ残骸
TODO|FIXME|HACK|XXX # 未対応マーカー
```

### Recommendation(仮実装)

```
temporary|placeholder|replace.later|workaround # 仮実装コメント
```

各ヒットのファイル名・行番号・該当行を記録する。

## Step 4: 5観点レビュー

変更差分を以下の5観点で評価する。

### 4.1 Security

- SQL インジェクション(文字列結合によるクエリ構築)
- XSS(未サニタイズの出力)
- 機密情報露出(API キー、トークン、パスワードのハードコード)
- 入力バリデーション不足(外部入力の未検証使用)
- 認証・認可の欠落(エンドポイントの保護漏れ)

### 4.2 Performance

- N+1 クエリ(ループ内の DB アクセス)
- 不要な再レンダリング(依存配列の誤り、メモ化の欠落)
- メモリリーク(イベントリスナーの未解除、タイマーの未クリア)
- 非効率なアルゴリズム(O(n²) 以上の計算量)
- 大きなバンドル影響(不要な import、tree-shaking 阻害)

### 4.3 Quality

- 命名の明瞭さ(意図が伝わる命名か)
- 単一責任の遵守(1関数/1クラスが1つの責務か)
- テストカバレッジ(変更コードに対するテストの存在)
- エラーハンドリング(例外の適切な捕捉と処理)
- コードの重複(DRY 違反)

### 4.4 Accessibility

- ARIA 属性(インタラクティブ要素の適切なラベル付け)
- キーボードナビゲーション(フォーカス管理、Tab 順序)
- カラーコントラスト(WCAG AA 基準)
- セマンティック HTML(div/span の乱用)
- フォーム要素のラベル(`<label>` の紐付け)

### 4.5 AI Residuals

Step 3 で検出したパターンに加え、文脈を考慮して判定する。

- テストファイル内の `mockData` は正当な使用(minor にしない)
- `.env.example` 内の `localhost` は正当な使用(major にしない)
- コメント内の `TODO: #123` は Issue 紐付きなら recommendation に留める

## Step 5: Verdict 判定

以下の基準で verdict を決定する。

| 条件 | Verdict |
| --------------------------- | ------------------- |
| critical が 1件以上 | **REQUEST_CHANGES** |
| major が 1件以上 | **REQUEST_CHANGES** |
| minor / recommendation のみ | **APPROVE** |

## Step 6: レビュー結果の出力

以下のフォーマットでレビュー結果を出力する。

```
## Code Review Result

**Verdict**: APPROVE / REQUEST_CHANGES

### Summary
- Files reviewed: {N}
- Issues found: {critical}C / {major}M / {minor}m / {recommendation}R

### Critical Issues
(critical があれば severity 順に表示)

### Major Issues
(major があれば表示)

### Observations
(minor / recommendation を表示)

| Severity | Category | Location | Issue | Suggestion |
|----------|----------|----------|-------|------------|
| minor | Quality | src/foo.ts:42 | ... | ... |

### AI Residuals Summary
(Step 3 の検出結果サマリ)
```
Comment on lines +54 to +149

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fenced code block に言語指定を付けてください。

Line 28 のコードフェンスは markdownlint (MD040) 的に text などの言語タグを付けるのが安全です。

🔧 Proposed fix
-```
+```text
 ## [観点名]
 - [severity] [指摘内容] (ファイル名:行番号)
</details>

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 28-28: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/security-review.md around lines 28 - 31, The Markdown
fenced code block starting with "```" followed by "## [観点名]" needs a language
tag to satisfy markdownlint MD040; change the opening fence to include a safe
language token like "text" (i.e., replace the opening ``` with ```text) so the
block reads as a text-language fenced code block and leave the closing ```
unchanged; you can locate the block by the content "## [観点名]" inside
.claude/commands/security-review.md.

Comment on lines +125 to +149

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Output template block should declare a fence language.

Line 125 should specify a language (markdown is appropriate) to resolve MD040.

🔧 Proposed fix
-```
+```markdown
 ## Code Review Result
 
 **Verdict**: APPROVE / REQUEST_CHANGES
@@
 ### AI Residuals Summary
 (Step 3 の検出結果サマリ)
</details>
Based on learnings: Fail on code formatting violations during code review.

<!-- suggestion_start -->

<details>
<summary>📝 Committable suggestion</summary>

> ‼️ **IMPORTANT**
> Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

```suggestion

🧰 Tools
🪛 markdownlint-cli2 (0.22.0)

[warning] 125-125: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.claude/commands/security-review.md around lines 125 - 149, The fenced
output template block at the top of the snippet is missing a language tag
(causing MD040); update the opening fence for the template block that wraps the
"## Code Review Result" section to declare a language (e.g., change the leading
``` to ```markdown) so the block is a proper Markdown code fence and ensure the
closing ``` remains present; locate the template block by the "## Code Review
Result" heading and adjust that fence accordingly.


## 注意事項

- minor / recommendation だけで REQUEST_CHANGES にしない
- 証拠のない懸念は major にしない(推測ではなく根拠を示す)
- テストファイル内のモックデータは正当な使用として除外する
- 設定ファイル(`.env.example` 等)のローカルアドレスは除外する
14 changes: 12 additions & 2 deletions .claude/commands/setup-new-repo.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ CI workflow と合わせて必ずコピーする。

`claude-code-review.yml` は PR に対して Claude による自動コードレビューを実行する workflow。

## Step 8: Setup Claude Code Hooks
## Step 8: Setup Claude Code Hooks & Rules

Claude Code の品質ゲートフックをセットアップする
Claude Code の品質ゲートフック・レビュールールをセットアップする

### 8.1 hooks ディレクトリ作成とファイルコピー

Expand All @@ -313,6 +313,15 @@ cp CONFIG_REPO/.claude/hooks/pre_git_quality_gates.py TARGET_DIR/.claude/hooks/
cp CONFIG_REPO/.claude/hooks/post_git_push_ci.py TARGET_DIR/.claude/hooks/
```

### 8.1.5 rules ディレクトリ作成とファイルコピー

```bash
mkdir -p TARGET_DIR/.claude/rules
cp CONFIG_REPO/.claude/rules/code-review-standards.md TARGET_DIR/.claude/rules/
cp CONFIG_REPO/.claude/rules/development-standards.md TARGET_DIR/.claude/rules/
cp CONFIG_REPO/.claude/rules/git-conventions.md TARGET_DIR/.claude/rules/
```

### 8.2 `.claude/settings.json` 作成

hooks セクションのみ含める。permissions セクションはプロジェクト固有のため含めない(ユーザーが後から設定)。
Expand Down Expand Up @@ -713,6 +722,7 @@ Files Created:
✅ .github/ISSUE_TEMPLATE/
✅ .github/PULL_REQUEST_TEMPLATE.md
✅ .claude/hooks/ (3 ファイル)
✅ .claude/rules/ (3 ファイル: code-review-standards, development-standards, git-conventions)
✅ .claude/settings.json
✅ .claude/plugins.txt
✅ .claude/skills.txt
Expand Down
39 changes: 39 additions & 0 deletions .claude/rules/code-review-standards.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
paths:
- '**/*'
---

# Code Review Standards

## 5観点レビュー

コードレビュー時は以下の5観点で評価する。

| 観点 | チェック内容 |
| ----------------- | -------------------------------------------------------------- |
| **Security** | SQLインジェクション, XSS, 機密情報露出, 入力バリデーション不足 |
| **Performance** | N+1クエリ, 不要な再レンダリング, メモリリーク, 不要な再計算 |
| **Quality** | 命名, 単一責任, テストカバレッジ, エラーハンドリング |
| **Accessibility** | ARIA属性, キーボードナビゲーション, カラーコントラスト |
| **AI Residuals** | モック残骸, ハードコード値, スキップされたテスト, 仮実装 |

## Severity 判定基準

各指摘を以下の severity に分類し、verdict を決定する。

| Severity | 定義 | Verdict への影響 |
| ------------------ | ------------------------------------------------------ | ----------------------- |
| **critical** | セキュリティ脆弱性、データ損失リスク、本番障害の可能性 | 1件でも REQUEST_CHANGES |
| **major** | 既存機能の破壊、仕様との矛盾、テスト不通過 | 1件でも REQUEST_CHANGES |
| **minor** | 命名改善、コメント不足、スタイル不統一 | verdict に影響しない |
| **recommendation** | ベストプラクティス提案、将来の改善案 | verdict に影響しない |

minor / recommendation のみの場合は APPROVE を返す。「あったほうが良い改善」は REQUEST_CHANGES の理由にならない。

## AI Residuals 検出パターン

| Severity | パターン |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------- |
| **major** | `localhost` / `127.0.0.1` の接続先, `it.skip` / `describe.skip` / `test.skip`, ハードコードされた秘密情報, dev/staging 固定 URL |
| **minor** | `mockData`, `dummy`, `fakeData`, `TODO`, `FIXME` |
| **recommendation** | `temporary implementation`, `replace later`, `placeholder` などの仮実装コメント |
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Development infrastructure template repository providing DevContainer images, CI
| `/pre-pr-checklist` | (no description) |
| `/repo-maintenance` | Comprehensive repository maintenance - run all health checks and updates |
| `/security-credential-scan` | (no description) |
| `/security-review` | (no description) |
| `/security-review` | 5観点コードレビュー(Security / Performance / Quality / Accessibility / AI Residuals) |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align /security-review description with real command behavior

The command table now advertises /security-review as a 5-perspective review workflow, but .claude/commands/security-review.md is still a single-line prompt asking for “10 improvements.” This mismatch will mislead users/agents into expecting severity-based review output that the command does not currently implement.

Useful? React with 👍 / 👎.

| `/setup-ci` | Setup comprehensive CI/CD workflows for your repository |
| `/setup-doppler` | Setup Doppler secret management with dev/dev_personal configuration |
| `/setup-husky` | (no description) |
Expand Down