Code Review Skill
Relevant source files
The following files were used as context for generating this wiki page:The Code Review skill provides an automated mechanism for analyzing code changes using the CodeRabbit CLI. It is designed to catch bugs, security vulnerabilities, and code quality issues either before code is committed or as part of a comprehensive pull request review. The skill is a core component of the AI Dev Atelier, integrating with other skills like code-quality and docs-check to form a complete development and finalization workflow.
The primary function is exposed through the review-run.sh script, which operates in two distinct modes: task mode for reviewing uncommitted local changes, and pr mode for reviewing all changed files in a branch against the main branch. This dual-mode approach allows for both iterative, work-in-progress checks and holistic pre-merge validation.
Sources: skills/code-review/SKILL.md, skills/README.md:1-12, README.md:25-35
Architecture and Modes
The skill's architecture is centered around the CodeRabbit CLI and is invoked via shell scripts. It operates in one of two modes, determined by a command-line argument.
Sources: skills/code-review/SKILL.md:1-10
This diagram illustrates the decision flow for an agent using the Code Review skill.
Sources: skills/code-review/SKILL.md:12-30
Task Mode
Task mode is designed for quick, iterative reviews of work-in-progress code. It analyzes only the uncommitted files in the current working directory. This is ideal for developers or agents working on a subtask who want feedback before creating a commit.
- Command:
bash skills/code-review/scripts/review-run.sh task - Scope: Uncommitted files (modified/untracked according to
git status). - Use Case: Reviewing changes during a task, before committing.
Sources: skills/code-review/SKILL.md:12-18
PR Mode
PR mode provides a comprehensive review of all changes within a feature branch compared to the main branch. This is intended for use when a pull request is being prepared for merging, ensuring all modifications are vetted.
- Command:
bash skills/code-review/scripts/review-run.sh pr - Scope: All changed files in the current branch versus the
mainbranch. - Use Case: Complete review of a pull request before it is submitted or merged.
Sources: skills/code-review/SKILL.md:20-26
Workflow
The skill defines distinct workflows for both task and PR modes, which involve running the review, reading the results, and addressing the feedback.
Sources: skills/code-review/SKILL.md:38-63
Task Mode Workflow
The following sequence diagram shows the typical interaction flow for the task mode review.
Sources: skills/code-review/SKILL.md:40-48
PR Mode Workflow
This sequence diagram illustrates the more comprehensive PR mode workflow.
Sources: skills/code-review/SKILL.md:50-57
Commands and Tools
The skill provides several scripts and ada:: aliases for interaction.
| Command / Tool | Description |
|---|---|
bash skills/code-review/scripts/review-run.sh task | Runs a review on uncommitted files. Alias: ada::review:task. |
bash skills/code-review/scripts/review-run.sh pr | Runs a review on all changed files against the main branch. Alias: ada::review:pr. |
bash skills/code-review/scripts/review-read.sh | Displays the most recent review results from the output directory. Alias: ada::review:read. |
bash skills/code-review/scripts/review-cleanup.sh | Removes old review files from the .ada/data/reviews/ directory. Alias: ada::review:cleanup. |
Sources: skills/code-review/SKILL.md:32-36, 65-70, 60
Example usage:
# Run a task mode review and then read the results
bash skills/code-review/scripts/review-run.sh task
bash skills/code-review/scripts/review-read.sh
Sources: skills/code-review/SKILL.md:76-77
Dependencies
The Code Review skill has a critical dependency on the CodeRabbit CLI. The CLI must be installed globally and authenticated for the skill to function.
- Installation:
npm install -g @coderabbitai/cli - Authentication:
coderabbit auth login
Sources: INSTALL.md:103-115
Output Structure
All outputs from the Code Review skill are stored in the .ada/data/reviews/ directory. This location is consistent across the AI Dev Atelier project for runtime data.
For each review run, two files are generated:
- Markdown Report:
{type}-review-{timestamp}.mdcontains the human-readable review content with issues and suggestions. - JSON Metadata:
{type}-review-{timestamp}.jsoncontains metadata, including statistics like the number of files reviewed and issues found.
Sources: skills/code-review/SKILL.md:83-86, AGENTS.md:104-105
This diagram shows the output directory structure.
Integration with Other Skills
The Code Review skill is designed to be part of a larger workflow, often followed by code-quality and docs-check to ensure a contribution is complete and meets all project standards.
This flowchart shows a recommended workflow for finalizing code changes.
Summary
The Code Review skill automates code analysis using CodeRabbit, providing a structured way to identify potential issues early and often. Its dual-mode design supports both rapid, iterative development (task mode) and thorough pre-merge validation (pr mode). By integrating with other quality and documentation skills, it forms a crucial part of a robust, automated workflow for maintaining high-quality code within the AI Dev Atelier ecosystem.
Sources: skills/code-review/SKILL.md, skills/README.md