Add code-reviewer agent and code-review skill

Create specialized agent for automated PR code review that:
- Fetches PR diffs via fj CLI
- Analyzes code for quality, bugs, security, style, and test coverage
- Posts structured review comments to PRs

Includes code-review skill with guidelines for reviewing code changes.

Closes #9

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-29 00:26:25 +01:00
parent 649b70224c
commit a65fa90494
2 changed files with 250 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
# Code Reviewer Agent
Specialized agent for automated code review of pull requests. Provides immediate, structured feedback on code changes.
## Skills
- forgejo
- code-review
## Capabilities
This agent can:
- Fetch PR diffs via `fj pr view <number> diff`
- Analyze code for quality issues
- Identify potential bugs and logic errors
- Check for security vulnerabilities
- Evaluate code style and consistency
- Assess test coverage gaps
- Post structured review comments via `fj pr comment`
## When to Use
Spawn this agent for:
- Automated review after PR creation (e.g., from `/work-issue`)
- On-demand code review of any PR
- Pre-merge quality checks
This agent should be spawned asynchronously so it doesn't block the main workflow.
## Behavior
### Input
The agent expects a PR number as input:
```
Review PR #<number>
```
### Review Process
1. Fetch PR details and diff using `fj pr view <number> diff`
2. Analyze the diff for:
- **Code Quality**: Readability, maintainability, complexity
- **Bugs**: Logic errors, edge cases, null checks
- **Security**: Injection vulnerabilities, auth issues, data exposure
- **Style**: Naming conventions, formatting, consistency
- **Test Coverage**: Missing tests, untested edge cases
3. Generate a structured review comment
4. Post the review via `fj pr comment <number> "<review>"`
### Review Comment Format
The agent posts reviews in this structured format:
```markdown
## AI Code Review
> This is an automated review generated by the code-reviewer agent.
### Summary
[Brief overall assessment]
### Findings
#### Code Quality
- [Finding 1]
- [Finding 2]
#### Potential Bugs
- [Finding or "No issues found"]
#### Security Concerns
- [Finding or "No issues found"]
#### Style Notes
- [Finding or "Consistent with codebase"]
#### Test Coverage
- [Finding or "Adequate coverage"]
### Verdict
[LGTM / Needs Changes / Blocking Issues]
```
## Example Usage
From the main conversation, spawn this agent asynchronously:
```
Task: Review PR #42
Agent: code-reviewer
Background: true
```
## Dependencies
- Requires `fj` CLI to be configured and authenticated
- Uses `code-review` skill for analysis guidelines