autofix
GitHubのCodeRabbitレビューコメントに基づき、コードの問題点を対話形式または一括で修正し、より効率的にコード品質を向上させるSkill。
📜 元の英語説明(参考)
Auto-fix CodeRabbit review comments - get CodeRabbit review comments from GitHub and fix them interactively or in batch
🇯🇵 日本人クリエイター向け解説
GitHubのCodeRabbitレビューコメントに基づき、コードの問題点を対話形式または一括で修正し、より効率的にコード品質を向上させるSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o autofix.zip https://jpskill.com/download/17974.zip && unzip -o autofix.zip && rm autofix.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17974.zip -OutFile "$d\autofix.zip"; Expand-Archive "$d\autofix.zip" -DestinationPath $d -Force; ri "$d\autofix.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
autofix.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
autofixフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
CodeRabbit Autofix
現在のブランチの PR に対する CodeRabbit のレビューコメントを取得し、インタラクティブまたはバッチで修正します。
前提条件
必要なツール
gh(GitHub CLI) - インストールガイドgit
確認: gh auth status
必要な状態
- GitHub 上の Git リポジトリ
- 現在のブランチにオープンな PR があること
- PR が CodeRabbit ボット (
coderabbitai,coderabbit[bot],coderabbitai[bot]) によってレビューされていること
ワークフロー
ステップ 0: リポジトリの指示をロードする (AGENTS.md)
autofix アクションを実行する前に、現在のリポジトリで AGENTS.md を検索し、適用可能な指示をロードします。
- 見つかった場合は、実行全体を通してそのビルド/リント/テスト/コミットのガイダンスに従います。
- 見つからなかった場合は、デフォルトのワークフローを続行します。
ステップ 1: コードのプッシュステータスを確認する
確認: git status + 未プッシュのコミットの確認
コミットされていない変更がある場合:
- 警告: "⚠️ コミットされていない変更は CodeRabbit のレビューに含まれません"
- 質問: "最初にコミットしてプッシュしますか?" → はいの場合: ユーザーの操作を待ち、続行します
未プッシュのコミットがある場合:
- 警告: "⚠️ N 個の未プッシュのコミットがあります。CodeRabbit はそれらをレビューしていません"
- 質問: "今すぐプッシュしますか?" → はいの場合:
git pushを実行し、"CodeRabbit は約 5 分でレビューします" と通知し、スキルを終了します
それ以外の場合: ステップ 2 に進みます
ステップ 2: オープンな PR を見つける
gh pr list --head $(git branch --show-current) --state open --json number,title
PR がない場合: "PR を作成しますか?" と質問します → はいの場合: PR を作成し (github.md § 5 を参照)、"約 5 分後にスキルを再度実行してください" と通知し、終了します
ステップ 3: 未解決の CodeRabbit スレッドを取得する
PR レビューのスレッドを取得します (github.md § 2 を参照):
- スレッド:
gh api graphql ... pullRequest.reviewThreads ...(github.md § 2 を参照)
以下にフィルタリングします:
- 未解決のスレッドのみ (
isResolved == false) - CodeRabbit ボット (
coderabbitai,coderabbit[bot],coderabbitai[bot]) によって開始されたスレッド
レビューが進行中の場合: "数分後にもう一度お試しください" というメッセージを確認します → "⏳ レビューが進行中です。数分後にもう一度お試しください" と通知し、終了します
未解決の CodeRabbit スレッドがない場合: "未解決の CodeRabbit レビュー スレッドは見つかりませんでした" と通知し、終了します
選択された各スレッドについて:
- ルートコメントから issue のメタデータを抽出します
ステップ 4: issue を解析して表示する
各コメントから抽出:
- ヘッダー:
_([^_]+)_ \| _([^_]+)_→ Issue type | Severity - 説明: メインの本文テキスト
- Agent prompt:
<details><summary>🤖 Prompt for AI Agents</summary>のコンテンツ (これが修正指示です)- 見つからない場合は、説明をフォールバックとして使用します
- 場所: ファイルパスと行番号
Severity をマッピング:
- 🔴 Critical/High → CRITICAL (アクション必須)
- 🟠 Medium → HIGH (レビュー推奨)
- 🟡 Minor/Low → MEDIUM (レビュー推奨)
- 🟢 Info/Suggestion → LOW (オプション)
- 🔒 Security → 優先度の高いものとして扱う
CodeRabbit の元の順序で表示します (すでに severity 順に並んでいます):
CodeRabbit Issues for PR #123: [PR Title]
| # | Severity | Issue Title | Location & Details | Type | Action |
|---|----------|-------------|-------------------|------|--------|
| 1 | 🔴 CRITICAL | Insecure authentication check | src/auth/service.py:42<br>Authorization logic inverted | 🐛 Bug 🔒 Security | Fix |
| 2 | 🟠 HIGH | Database query not awaited | src/db/repository.py:89<br>Async call missing await | 🐛 Bug | Fix |
ステップ 5: 修正の優先順位をユーザーに尋ねる
AskUserQuestion を使用します:
- 🔍 "Review each issue" - 手動レビューと承認 (推奨)
- ⚡ "Auto-fix all" - すべての "Fix" issue を承認なしに適用
- ❌ "Cancel" - 終了
選択に基づいてルーティング:
- Review → ステップ 5
- Auto-fix → ステップ 6
- Cancel → 終了
ステップ 6: 手動レビューモード
各 "Fix" issue について (CRITICAL が最初):
- 関連するファイルを読みます
- CodeRabbit の agent prompt を直接指示として実行します ("🤖 Prompt for AI Agents" セクションから)
- 提案された修正を計算します (まだ適用しないでください)
- 修正を表示し、1 つのステップで承認を求めます:
- Issue title + 場所
- CodeRabbit の agent prompt (ユーザーが確認できるように)
- 現在のコード
- 提案された diff
- AskUserQuestion: ✅ Apply fix | ⏭️ Defer | 🔧 Modify
"Apply fix" の場合:
- Edit ツールで適用します
- すべての修正後に 1 つの統合されたコミットのために、変更されたファイルを追跡します
- 確認: "✅ 修正が適用され、コメントされました"
"Defer" の場合:
- 理由を尋ねます (AskUserQuestion)
- 次に進みます
"Modify" の場合:
- ユーザーが手動で変更できることを通知します
- 次に進みます
ステップ 7: Auto-Fix モード
各 "Fix" issue について (CRITICAL が最初):
- 関連するファイルを読みます
- CodeRabbit の agent prompt を直接指示として実行します
- Edit ツールで修正を適用します
- 1 つの統合されたコミットのために、変更されたファイルを追跡します
- レポート:
✅ Fixed: [Issue Title] at
[Location]Agent prompt: [prompt used]
すべての修正後、修正/スキップされた issue の概要を表示します。
ステップ 8: 単一の統合されたコミットを作成する
修正が適用された場合:
git add <all-changed-files>
git commit -m "fix: apply CodeRabbit auto-fixes"
この実行で適用されたすべての修正に 1 つのコミットを使用します。
ステップ 9: プッシュ前にビルド/リントを促す
統合されたコミットが作成された場合:
- プッシュ前に検証を実行するように、ユーザーにインタラクティブに促します (推奨、必須ではありません)。
- ステップ 0 でロードされた
AGENTS.mdの指示をユーザーにリマインドします (存在する場合)。 - ユーザーが同意した場合、要求されたチェックを実行し、結果を報告します。
ステップ 10: 変更をプッシュする
統合されたコミットが作成された場合:
- "変更をプッシュしますか?" と質問します → はいの場合:
git push
すべてが延期された場合 (コミットなし): このステップをスキップします。
ステップ 11: サマリーを投稿する
すべての issue のレビュー後に必須:
gh pr comment <pr-number> --body "$(cat <<'EOF'
## Fixes Applied Successfully
Fixed <file-count> file(s) based on <issue-count> unresolved review comment(s).
**Files modified:**
- `path/to/file-a.ts`
- `path/to/file-b.ts`
**Commit:** `<commit-sha>`
The latest autofix changes are on the `<branch-name>` branch.
EOF
)"
詳細については、github.md § 3 を参照してください。
オプションで、CodeRabbit のメインコメントに 👍 でリアクションします。
重要な注意点
- **Follow agent promp
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
CodeRabbit Autofix
Fetch CodeRabbit review comments for your current branch's PR and fix them interactively or in batch.
Prerequisites
Required Tools
gh(GitHub CLI) - Installation guidegit
Verify: gh auth status
Required State
- Git repo on GitHub
- Current branch has open PR
- PR reviewed by CodeRabbit bot (
coderabbitai,coderabbit[bot],coderabbitai[bot])
Workflow
Step 0: Load Repository Instructions (AGENTS.md)
Before any autofix actions, search for AGENTS.md in the current repository and load applicable instructions.
- If found, follow its build/lint/test/commit guidance throughout the run.
- If not found, continue with default workflow.
Step 1: Check Code Push Status
Check: git status + check for unpushed commits
If uncommitted changes:
- Warn: "⚠️ Uncommitted changes won't be in CodeRabbit review"
- Ask: "Commit and push first?" → If yes: wait for user action, then continue
If unpushed commits:
- Warn: "⚠️ N unpushed commits. CodeRabbit hasn't reviewed them"
- Ask: "Push now?" → If yes:
git push, inform "CodeRabbit will review in ~5 min", EXIT skill
Otherwise: Proceed to Step 2
Step 2: Find Open PR
gh pr list --head $(git branch --show-current) --state open --json number,title
If no PR: Ask "Create PR?" → If yes: create PR (see github.md § 5), inform "Run skill again in ~5 min", EXIT
Step 3: Fetch Unresolved CodeRabbit Threads
Fetch PR review threads (see github.md § 2):
- Threads:
gh api graphql ... pullRequest.reviewThreads ...(see github.md § 2)
Filter to:
- unresolved threads only (
isResolved == false) - threads started by CodeRabbit bot (
coderabbitai,coderabbit[bot],coderabbitai[bot])
If review in progress: Check for "Come back again in a few minutes" message → Inform "⏳ Review in progress, try again in a few minutes", EXIT
If no unresolved CodeRabbit threads: Inform "No unresolved CodeRabbit review threads found", EXIT
For each selected thread:
- Extract issue metadata from root comment
Step 4: Parse and Display Issues
Extract from each comment:
- Header:
_([^_]+)_ \| _([^_]+)_→ Issue type | Severity - Description: Main body text
- Agent prompt: Content in
<details><summary>🤖 Prompt for AI Agents</summary>(this is the fix instruction)- If missing, use description as fallback
- Location: File path and line numbers
Map severity:
- 🔴 Critical/High → CRITICAL (action required)
- 🟠 Medium → HIGH (review recommended)
- 🟡 Minor/Low → MEDIUM (review recommended)
- 🟢 Info/Suggestion → LOW (optional)
- 🔒 Security → Treat as high priority
Display in CodeRabbit's original order (already severity-ordered):
CodeRabbit Issues for PR #123: [PR Title]
| # | Severity | Issue Title | Location & Details | Type | Action |
|---|----------|-------------|-------------------|------|--------|
| 1 | 🔴 CRITICAL | Insecure authentication check | src/auth/service.py:42<br>Authorization logic inverted | 🐛 Bug 🔒 Security | Fix |
| 2 | 🟠 HIGH | Database query not awaited | src/db/repository.py:89<br>Async call missing await | 🐛 Bug | Fix |
Step 5: Ask User for Fix Preference
Use AskUserQuestion:
- 🔍 "Review each issue" - Manual review and approval (recommended)
- ⚡ "Auto-fix all" - Apply all "Fix" issues without approval
- ❌ "Cancel" - Exit
Route based on choice:
- Review → Step 5
- Auto-fix → Step 6
- Cancel → EXIT
Step 6: Manual Review Mode
For each "Fix" issue (CRITICAL first):
- Read relevant files
- Execute CodeRabbit's agent prompt as direct instruction (from "🤖 Prompt for AI Agents" section)
- Calculate proposed fix (DO NOT apply yet)
- Show fix and ask approval in ONE step:
- Issue title + location
- CodeRabbit's agent prompt (so user can verify)
- Current code
- Proposed diff
- AskUserQuestion: ✅ Apply fix | ⏭️ Defer | 🔧 Modify
If "Apply fix":
- Apply with Edit tool
- Track changed files for a single consolidated commit after all fixes
- Confirm: "✅ Fix applied and commented"
If "Defer":
- Ask for reason (AskUserQuestion)
- Move to next
If "Modify":
- Inform user can make changes manually
- Move to next
Step 7: Auto-Fix Mode
For each "Fix" issue (CRITICAL first):
- Read relevant files
- Execute CodeRabbit's agent prompt as direct instruction
- Apply fix with Edit tool
- Track changed files for one consolidated commit
- Report:
✅ Fixed: [Issue Title] at
[Location]Agent prompt: [prompt used]
After all fixes, display summary of fixed/skipped issues.
Step 8: Create Single Consolidated Commit
If any fixes were applied:
git add <all-changed-files>
git commit -m "fix: apply CodeRabbit auto-fixes"
Use one commit for all applied fixes in this run.
Step 9: Prompt Build/Lint Before Push
If a consolidated commit was created:
- Prompt user interactively to run validation before push (recommended, not required).
- Remind the user of the
AGENTS.mdinstructions already loaded in Step 0 (if present). - If user agrees, run the requested checks and report results.
Step 10: Push Changes
If a consolidated commit was created:
- Ask: "Push changes?" → If yes:
git push
If all deferred (no commit): Skip this step.
Step 11: Post Summary
REQUIRED after all issues reviewed:
gh pr comment <pr-number> --body "$(cat <<'EOF'
## Fixes Applied Successfully
Fixed <file-count> file(s) based on <issue-count> unresolved review comment(s).
**Files modified:**
- `path/to/file-a.ts`
- `path/to/file-b.ts`
**Commit:** `<commit-sha>`
The latest autofix changes are on the `<branch-name>` branch.
EOF
)"
See github.md § 3 for details.
Optionally react to CodeRabbit's main comment with 👍.
Key Notes
- Follow agent prompts literally - The "🤖 Prompt for AI Agents" section IS the fix specification
- One approval per fix - Show context + diff + AskUserQuestion in single message (manual mode)
- Preserve issue titles - Use CodeRabbit's exact titles, don't paraphrase
- Preserve ordering - Display issues in CodeRabbit's original order
- Do not post per-issue replies - Keep the workflow summary-comment only