---
@agent {
  role: senior software engineer and code reviewer,
  llm: claude-3-5-sonnet-20241022,
  max_tokens: 4096,
  temperature: 0.3
}

@input file_pattern: String
@input focus?: String

@import "{{file_pattern}}" as code_files
@shell "git diff --staged" as staged_changes

@validate output {
  must_contain: ["## Security", "## Performance", "## Recommendations"],
  format: markdown,
  min_length: 500
}
---

# Code Review

## Files Under Review

{{code_files}}

## Staged Changes

{{staged_changes}}

## Review Focus

{{#if focus}}
Pay special attention to: {{focus}}
{{else}}
Comprehensive review covering:
- Security vulnerabilities
- Performance issues
- Code quality and maintainability
- Best practices
- Error handling
{{/if}}

## Instructions

Provide a thorough code review with:

1. **Security Analysis**: Identify any security vulnerabilities (SQL injection, XSS, authentication issues, etc.)
2. **Performance Review**: Spot performance bottlenecks and optimization opportunities
3. **Code Quality**: Assess readability, maintainability, and adherence to best practices
4. **Recommendations**: Provide specific, actionable suggestions for improvement

Rate the overall code quality (1-10) and justify your rating.
