autofix by coderabbitai/skills
npx skills add https://github.com/coderabbitai/skills --skill autofix获取当前分支 PR 的 CodeRabbit 评审意见,并以交互方式或批量方式修复它们。
gh (GitHub CLI) - 安装指南git验证:gh auth status
coderabbitai, coderabbit[bot], coderabbitai[bot]) 评审过AGENTS.md)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
在执行任何自动修复操作之前,在当前仓库中搜索 AGENTS.md 并加载适用的说明。
检查:git status + 检查未推送的提交
如果有未提交的更改:
如果有未推送的提交:
git push,告知"CodeRabbit 将在约 5 分钟后进行评审",退出技能否则: 继续步骤 2
gh pr list --head $(git branch --show-current) --state open --json number,title
如果没有 PR: 询问"是否创建 PR?" → 如果选择是:创建 PR (参见 github.md § 5),告知"约 5 分钟后再次运行此技能",退出
获取 PR 评审讨论串 (参见 github.md § 2):
gh api graphql ... pullRequest.reviewThreads ... (参见 github.md § 2)筛选条件:
isResolved == false)coderabbitai, coderabbit[bot], coderabbitai[bot]) 发起的讨论串如果评审正在进行中: 检查是否有"请几分钟后再回来"的消息 → 告知"⏳ 评审正在进行中,请几分钟后再试",退出
如果没有未解决的 CodeRabbit 讨论串: 告知"未找到未解决的 CodeRabbit 评审讨论串",退出
对于每个选中的讨论串:
从每条评论中提取:
_([^_]+)_ \| _([^_]+)_ → 问题类型 | 严重性<details><summary>🤖 Prompt for AI Agents</summary> 中的内容 (这是修复指令)
* 如果缺失,则使用描述作为后备映射严重性:
按 CodeRabbit 的原始顺序显示 (已按严重性排序):
PR #123 的 CodeRabbit 问题: [PR 标题]
| # | 严重性 | 问题标题 | 位置与详情 | 类型 | 操作 |
|---|----------|-------------|-------------------|------|--------|
| 1 | 🔴 CRITICAL | 不安全的身份验证检查 | src/auth/service.py:42<br>授权逻辑颠倒 | 🐛 Bug 🔒 Security | 修复 |
| 2 | 🟠 HIGH | 数据库查询未等待 | src/db/repository.py:89<br>异步调用缺少 await | 🐛 Bug | 修复 |
使用 AskUserQuestion:
根据选择路由:
对于每个"修复"类问题 (先处理 CRITICAL):
如果选择"应用修复":
如果选择"推迟":
如果选择"修改":
对于每个"修复"类问题 (先处理 CRITICAL):
✅ 已修复: [问题标题] 位于
[位置]智能体提示: [使用的提示]
在所有修复完成后,显示已修复/已跳过问题的摘要。
如果应用了任何修复:
git add <所有更改的文件>
git commit -m "fix: apply CodeRabbit auto-fixes"
本次运行中所有应用的修复使用一个提交。
如果创建了合并提交:
AGENTS.md 说明 (如果存在)。如果创建了合并提交:
git push如果全部推迟 (无提交):跳过此步骤。
在所有问题评审完毕后必需执行:
gh pr comment <pr-number> --body "$(cat <<'EOF'
## 修复已成功应用
基于 <问题数量> 个未解决的评审评论,修复了 <文件数量> 个文件。
**已修改的文件:**
- `path/to/file-a.ts`
- `path/to/file-b.ts`
**提交:** `<提交哈希>`
最新的自动修复更改位于 `<分支名称>` 分支。
EOF
)"
详情参见 github.md § 3。
可选地对 CodeRabbit 的主评论做出 👍 反应。
每周安装量
93
仓库
GitHub 星标数
38
首次出现
8 天前
安全审计
安装于
cursor82
codex81
gemini-cli78
opencode78
kimi-cli77
github-copilot77
Fetch CodeRabbit review comments for your current branch's PR and fix them interactively or in batch.
gh (GitHub CLI) - Installation guidegitVerify: gh auth status
coderabbitai, coderabbit[bot], coderabbitai[bot])AGENTS.md)Before any autofix actions, search for AGENTS.md in the current repository and load applicable instructions.
Check: git status + check for unpushed commits
If uncommitted changes:
If unpushed commits:
git push, inform "CodeRabbit will review in ~5 min", EXIT skillOtherwise: Proceed to Step 2
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
Fetch PR review threads (see github.md § 2):
gh api graphql ... pullRequest.reviewThreads ... (see github.md § 2)Filter to:
isResolved == false)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 from each comment:
_([^_]+)_ \| _([^_]+)_ → Issue type | Severity<details><summary>🤖 Prompt for AI Agents</summary> (this is the fix instruction)
Map severity:
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 |
Use AskUserQuestion:
Route based on choice:
For each "Fix" issue (CRITICAL first):
If "Apply fix":
If "Defer":
If "Modify":
For each "Fix" issue (CRITICAL first):
✅ Fixed: [Issue Title] at
[Location]Agent prompt: [prompt used]
After all fixes, display summary of fixed/skipped issues.
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.
If a consolidated commit was created:
AGENTS.md instructions already loaded in Step 0 (if present).If a consolidated commit was created:
git pushIf all deferred (no commit): Skip this step.
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 👍.
Weekly Installs
93
Repository
GitHub Stars
38
First Seen
8 days ago
Security Audits
Gen Agent Trust HubPassSocketWarnSnykWarn
Installed on
cursor82
codex81
gemini-cli78
opencode78
kimi-cli77
github-copilot77
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装