coderabbit-sdk-patterns
Apply production-ready CodeRabbit automation patterns using GitHub API and PR comments. Use when building automation around CodeRabbit reviews, processing review feedback programmatically, or integrating CodeRabbit into custom workflows. Trigger with phrases like "coderabbit automation", "coderabbit API patterns", "automate coderabbit", "coderabbit github api", "process coderabbit reviews".
Best use case
coderabbit-sdk-patterns is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Apply production-ready CodeRabbit automation patterns using GitHub API and PR comments. Use when building automation around CodeRabbit reviews, processing review feedback programmatically, or integrating CodeRabbit into custom workflows. Trigger with phrases like "coderabbit automation", "coderabbit API patterns", "automate coderabbit", "coderabbit github api", "process coderabbit reviews".
Teams using coderabbit-sdk-patterns should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/coderabbit-sdk-patterns/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How coderabbit-sdk-patterns Compares
| Feature / Agent | coderabbit-sdk-patterns | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Apply production-ready CodeRabbit automation patterns using GitHub API and PR comments. Use when building automation around CodeRabbit reviews, processing review feedback programmatically, or integrating CodeRabbit into custom workflows. Trigger with phrases like "coderabbit automation", "coderabbit API patterns", "automate coderabbit", "coderabbit github api", "process coderabbit reviews".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
Cursor vs Codex for AI Workflows
Compare Cursor and Codex for AI coding workflows, repository assistance, debugging, refactoring, and reusable developer skills.
SKILL.md Source
# CodeRabbit SDK Patterns
## Overview
CodeRabbit does not have a traditional SDK. You interact with it through `.coderabbit.yaml` configuration, PR comment commands (`@coderabbitai`), and the GitHub/GitLab API to process its review output. These patterns show how to automate around CodeRabbit reviews programmatically.
## Prerequisites
- CodeRabbit installed on repository (see `coderabbit-install-auth`)
- GitHub CLI (`gh`) or GitHub API access via personal access token
- Node.js 18+ for automation scripts
## Instructions
### Step 1: Fetch CodeRabbit Reviews via GitHub API
```typescript
// scripts/fetch-coderabbit-reviews.ts
import { Octokit } from "@octokit/rest";
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
async function getCodeRabbitReview(owner: string, repo: string, prNumber: number) {
const reviews = await octokit.pulls.listReviews({ owner, repo, pull_number: prNumber });
const coderabbitReview = reviews.data.find(
(r) => r.user?.login === "coderabbitai[bot]"
);
if (!coderabbitReview) {
console.log("No CodeRabbit review found yet. Review typically takes 2-5 minutes.");
return null;
}
return {
state: coderabbitReview.state, // "APPROVED" | "CHANGES_REQUESTED" | "COMMENTED"
body: coderabbitReview.body, // Walkthrough summary
submittedAt: coderabbitReview.submitted_at,
};
}
```
### Step 2: Extract Line-Level Comments
```typescript
async function getCodeRabbitComments(owner: string, repo: string, prNumber: number) {
const comments = await octokit.pulls.listReviewComments({
owner, repo, pull_number: prNumber,
});
const coderabbitComments = comments.data
.filter((c) => c.user?.login === "coderabbitai[bot]")
.map((c) => ({
file: c.path,
line: c.line || c.original_line,
body: c.body,
severity: categorizeSeverity(c.body),
url: c.html_url,
}));
return coderabbitComments;
}
function categorizeSeverity(body: string): "critical" | "warning" | "suggestion" {
const lower = body.toLowerCase();
if (lower.includes("security") || lower.includes("vulnerability") || lower.includes("injection")) {
return "critical";
}
if (lower.includes("bug") || lower.includes("error") || lower.includes("issue")) {
return "warning";
}
return "suggestion";
}
```
### Step 3: Post Commands to CodeRabbit via PR Comments
```typescript
// Programmatically trigger CodeRabbit actions
async function sendCodeRabbitCommand(
owner: string, repo: string, prNumber: number, command: string
) {
await octokit.issues.createComment({
owner, repo, issue_number: prNumber,
body: `@coderabbitai ${command}`,
});
}
// Available commands:
// "full review" - Complete review from scratch
// "summary" - Generate walkthrough summary
// "resolve" - Mark all comments resolved
// "generate-docstrings" - Generate docstrings for functions
// "configuration" - Show current config as YAML
// "run <recipe>" - Run a finishing touch recipe
```
### Step 4: Build a Review Dashboard Script
```bash
#!/bin/bash
# scripts/coderabbit-dashboard.sh - Review metrics for last 50 PRs
set -euo pipefail
ORG="${1:?Usage: $0 <org> <repo>}"
REPO="${2:?Usage: $0 <org> <repo>}"
echo "=== CodeRabbit Review Dashboard ==="
echo "Repository: $ORG/$REPO"
echo ""
# Count PRs with CodeRabbit reviews
TOTAL=$(gh api "repos/$ORG/$REPO/pulls?state=closed&per_page=50" --jq 'length')
REVIEWED=0
for PR_NUM in $(gh api "repos/$ORG/$REPO/pulls?state=closed&per_page=50" --jq '.[].number'); do
HAS_CR=$(gh api "repos/$ORG/$REPO/pulls/$PR_NUM/reviews" \
--jq '[.[] | select(.user.login=="coderabbitai[bot]")] | length' 2>/dev/null || echo "0")
[ "$HAS_CR" -gt 0 ] && REVIEWED=$((REVIEWED + 1))
done
echo "Review Coverage: $REVIEWED/$TOTAL PRs reviewed ($(( REVIEWED * 100 / TOTAL ))%)"
```
### Step 5: GitHub Actions Automation
```yaml
# .github/workflows/coderabbit-gate.yml
# Block merge until CodeRabbit has reviewed
name: CodeRabbit Review Gate
on:
pull_request_review:
types: [submitted]
jobs:
check-coderabbit:
if: github.event.review.user.login == 'coderabbitai[bot]'
runs-on: ubuntu-latest
steps:
- name: Check review state
uses: actions/github-script@v7
with:
script: |
const { data: reviews } = await github.rest.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
});
const crReview = reviews.find(r => r.user.login === 'coderabbitai[bot]');
if (crReview?.state === 'CHANGES_REQUESTED') {
core.setFailed('CodeRabbit requested changes. Address feedback before merging.');
} else {
core.info(`CodeRabbit review state: ${crReview?.state || 'pending'}`);
}
```
## Output
- GitHub API integration for fetching CodeRabbit review data
- Automated command posting to trigger CodeRabbit actions
- Review metrics dashboard script
- CI gate that enforces CodeRabbit approval before merge
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Review not found | PR too new | Wait 2-5 minutes for review to complete |
| 403 from GitHub API | Token missing scopes | Ensure `repo` scope on personal access token |
| Bot login doesn't match | Different app slug | Check with `coderabbitai[bot]` (includes `[bot]` suffix) |
| Rate limited by GitHub | Too many API calls | Use pagination and caching for bulk queries |
## Resources
- [CodeRabbit Review Commands](https://docs.coderabbit.ai/reference/review-commands)
- [GitHub REST API - Pull Reviews](https://docs.github.com/en/rest/pulls/reviews)
- [Octokit.js](https://github.com/octokit/octokit.js)
## Next Steps
Apply patterns in `coderabbit-core-workflow-a` for real-world review workflows.Related Skills
workhuman-sdk-patterns
Workhuman sdk patterns for employee recognition and rewards API. Use when integrating Workhuman Social Recognition, or building recognition workflows with HRIS systems. Trigger: "workhuman sdk patterns".
wispr-sdk-patterns
Wispr Flow sdk patterns for voice-to-text API integration. Use when integrating Wispr Flow dictation, WebSocket streaming, or building voice-powered applications. Trigger: "wispr sdk patterns".
windsurf-sdk-patterns
Apply production-ready Windsurf workspace configuration and Cascade interaction patterns. Use when configuring .windsurfrules, workspace rules, MCP servers, or establishing team coding standards for Windsurf AI. Trigger with phrases like "windsurf patterns", "windsurf best practices", "windsurf config patterns", "windsurfrules", "windsurf workspace".
windsurf-reliability-patterns
Implement reliable Cascade workflows with checkpoints, rollback, and incremental editing. Use when building fault-tolerant AI coding workflows, preventing Cascade from breaking builds, or establishing safe practices for multi-file AI edits. Trigger with phrases like "windsurf reliability", "cascade safety", "windsurf rollback", "cascade checkpoint", "safe cascade workflow".
webflow-sdk-patterns
Apply production-ready Webflow SDK patterns — singleton client, typed error handling, pagination helpers, and raw response access for the webflow-api package. Use when implementing Webflow integrations, refactoring SDK usage, or establishing team coding standards. Trigger with phrases like "webflow SDK patterns", "webflow best practices", "webflow code patterns", "idiomatic webflow", "webflow typescript".
vercel-sdk-patterns
Production-ready Vercel REST API patterns with typed fetch wrappers and error handling. Use when integrating with the Vercel API programmatically, building deployment tools, or establishing team coding standards for Vercel API calls. Trigger with phrases like "vercel SDK patterns", "vercel API wrapper", "vercel REST API client", "vercel best practices", "idiomatic vercel API".
vercel-reliability-patterns
Implement reliability patterns for Vercel deployments including circuit breakers, retry logic, and graceful degradation. Use when building fault-tolerant serverless functions, implementing retry strategies, or adding resilience to production Vercel services. Trigger with phrases like "vercel reliability", "vercel circuit breaker", "vercel resilience", "vercel fallback", "vercel graceful degradation".
veeva-sdk-patterns
Veeva Vault sdk patterns for REST API and clinical operations. Use when working with Veeva Vault document management and CRM. Trigger: "veeva sdk patterns".
vastai-sdk-patterns
Apply production-ready Vast.ai SDK patterns for Python and REST API. Use when implementing Vast.ai integrations, refactoring SDK usage, or establishing coding standards for GPU cloud operations. Trigger with phrases like "vastai SDK patterns", "vastai best practices", "vastai code patterns", "idiomatic vastai".
twinmind-sdk-patterns
Apply production-ready TwinMind SDK patterns for TypeScript and Python. Use when implementing TwinMind integrations, refactoring API usage, or establishing team coding standards for meeting AI integration. Trigger with phrases like "twinmind SDK patterns", "twinmind best practices", "twinmind code patterns", "idiomatic twinmind".
together-sdk-patterns
Together AI sdk patterns for inference, fine-tuning, and model deployment. Use when working with Together AI's OpenAI-compatible API. Trigger: "together sdk patterns".
techsmith-sdk-patterns
TechSmith sdk patterns for Snagit COM API and Camtasia automation. Use when working with TechSmith screen capture and video editing automation. Trigger: "techsmith sdk patterns".