Process CodeRabbit AI code review comments from GitHub PRs and automatically apply suggested fixes to codebases. Includes enhanced AI formatting with psychological conditioning and validation safeguards.
Process CodeRabbit AI code review comments from GitHub PRs and automatically apply suggested fixes to codebases using a Python-based automation toolkit.
This skill provides guidance for working with a Python-based automation toolkit that:
The toolkit uses a three-stage pipeline architecture:
1. **fetch_github_comments.py**: Uses GitHub CLI to fetch PR comments → outputs JSON
2. **parse_coderabbit_comments_v2.py**: Extracts CodeRabbit suggestions → outputs structured fixes JSON
3. **apply_coderabbit_fixes_v2.py**: Applies fixes to the codebase → modifies files
The parser categorizes fixes into types:
To process all CodeRabbit comments from a PR and apply fixes:
```bash
./coderabbit-fix OWNER/REPO PR_NUMBER
```
Or use the Python pipeline directly:
```bash
python coderabbit-tools/coderabbit_pipeline.py OWNER/REPO PR_NUMBER
```
Fetch comments from a PR:
```bash
./coderabbit-fetch OWNER/REPO PR_NUMBER
```
Parse CodeRabbit comments from saved JSON:
```bash
./coderabbit-parse comments.json
```
Apply fixes from parsed output:
```bash
./coderabbit-apply fixes.json
```
Dry-run mode (preview changes without applying):
```bash
python coderabbit-tools/apply_coderabbit_fixes_v2.py fixes.json --dry-run
```
The `coderabbit_ai_formatter.py` was enhanced to prevent Claude Code from:
**Key enhancements:**
1. **Use TodoWrite tool** - Track every fix as a separate todo item. Manual tracking leads to incomplete work.
2. **Sequential processing** - Work on ONE issue at a time. NEVER work on multiple issues simultaneously.
3. **Validate after every change** - Run validation commands after EACH edit. Batching validation leads to hard-to-debug failures.
4. **File creation standards** - Always add EOF newlines. Ensure markdown files pass markdownlint.
5. **Verification checkpoints** - Get human approval before coding to prevent misinterpretation.
ALWAYS run these commands after any changes:
```bash
make lint && coderabbit-linter && make validate && make test
```
The `coderabbit-linter` is a pre-commit linting wrapper for `coderabbit_linter.py`.
When extending the parser to handle new fix types:
1. Add the new category to `parse_coderabbit_comments_v2.py`
2. Update the fix detection logic in the same file
3. Ensure `apply_coderabbit_fixes_v2.py` can handle the new type
Since there's no formal test suite, test changes by:
1. Using dry-run mode to preview changes
2. Testing on a sample PR with known CodeRabbit comments
3. Verifying JSON output at each pipeline stage
Two systematic prompts leverage the enhanced formatter:
**CodeRabbitPrompt.md**: For fixing existing CodeRabbit issues
**Github_Development_Prompt.md**: For implementing new GitHub issues
```bash
./coderabbit-fix owner/repo 123
python coderabbit-tools/apply_coderabbit_fixes_v2.py fixes.json --dry-run
make lint && coderabbit-linter && make validate && make test
```
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/coderabbit-ai-automation/raw