Agent skill
code-review
Code review mode - comprehensive review with security, performance, and maintainability focus
Install this agent skill to your Project
npx add-skill https://github.com/thoreinstein/opencode-config/tree/main/skill/code-review
SKILL.md
CODE REVIEW MODE
Current Time: !date
Git Commit: !git rev-parse --short HEAD
Perform a comprehensive code review using the Principal Engineer agent.
Review Protocol
Phase 1: Context Gathering
First, understand what changed:
git diff [base] -- [files]
git log --oneline -10 -- [files]
Launch exploration if needed:
background_task(agent="explore", prompt="Find related code and tests...")
Phase 2: Multi-Dimensional Review
Request Principal review with full context:
@principal Please perform a thorough code review:
## Changes to Review
$ARGUMENTS
## Review Dimensions
### 1. Correctness
- [ ] Logic is correct for all cases
- [ ] Edge cases are handled
- [ ] Assumptions are valid
- [ ] Error states are managed
### 2. Security
- [ ] No injection vulnerabilities (SQL, XSS, command)
- [ ] Input validation is present and complete
- [ ] Sensitive data is protected
- [ ] Authentication/authorization is correct
- [ ] No secrets in code
- [ ] Dependencies are secure
### 3. Performance
- [ ] No unnecessary operations or loops
- [ ] Efficient algorithms for the scale
- [ ] No memory leaks or resource exhaustion
- [ ] Database queries are optimized (no N+1)
- [ ] Appropriate caching if needed
### 4. Reliability
- [ ] Error handling is comprehensive
- [ ] Failures are graceful
- [ ] Retry logic where appropriate
- [ ] Resource cleanup is guaranteed
### 5. Maintainability
- [ ] Code is readable and self-documenting
- [ ] Functions are focused (single responsibility)
- [ ] Naming is clear and consistent
- [ ] No unnecessary duplication
- [ ] Follows existing patterns
### 6. Testing
- [ ] Tests exist for new functionality
- [ ] Edge cases are tested
- [ ] Error paths are tested
- [ ] Tests are reliable (not flaky)
Phase 3: Specialist Consultation (If Needed)
For specific concerns:
| Concern | Agent | Focus |
|---|---|---|
| Security issues | @security |
Deep vulnerability analysis |
| Reliability concerns | @sre |
Scalability, SLOs, observability |
| Performance concerns | @perf |
Profiling, bottlenecks, optimization |
| Architecture questions | @architect |
Design patterns, structure |
| Test strategy | @testing |
Coverage, approach |
Review Output Format
## Summary
[APPROVE / NEEDS WORK / BLOCK] — [one-line summary]
## Critical Issues (must fix before merge)
- [ ] **[SECURITY]** [Issue] at `file:line`
- Impact: [what could go wrong]
- Fix: [how to fix]
## High Priority (should fix before merge)
- [ ] **[BUG]** [Issue] at `file:line`
- Rationale: [why this matters]
- Suggestion: [how to improve]
## Suggestions (consider for this PR or follow-up)
- [ ] [Suggestion] at `file:line`
## What's Done Well
- [Specific positive observation]
- [Another positive]
## Security Assessment
[Brief security posture of the changes]
## Performance Assessment
[Brief performance impact analysis]
Output
Write to Obsidian via obsidian_append_content at:
$OBSIDIAN_PATH/Reviews/YYYY-MM-DD-target.md
Note:
$OBSIDIAN_PATHmust be a vault-relative path (e.g.,Projects/myapp), set per-project via direnv. Theobsidian_append_contenttool expects paths relative to the vault root.
Document Structure
Use this template for the Obsidian document:
@~/.config/opencode/templates/code-review.md
Review Scope
$ARGUMENTS
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
seo
Implement SEO optimizations for specified pages or entire site
runbook
Generate operational runbooks for services, procedures, or incident response
file-organizer
Intelligently organizes your files and folders across your computer by understanding context, finding duplicates, suggesting better structures, and automating cleanup tasks. Reduces cognitive load and keeps your digital workspace tidy without manual effort.
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.
ultrathink
Ultra-deep multi-perspective analysis for complex architectural and strategic decisions
commit
Analyze unstaged changes and suggest atomic commit groups with messages
Didn't find tool you were looking for?