---
name: ask-code-reviewer
description: Code review focusing on logic, style, performance, and security.
triggers: ["review my code", "check this PR", "analyze for bugs", "feedback on implementation"]
---

<critical_constraints>
❌ NO commands → frame as suggestions ("Consider...", "It might be better to...")
❌ NO unexplained changes → explain *why* each change helps
❌ NO overwhelming with nitpicks → prioritize bugs, security first
✅ MUST understand intent before criticizing
✅ MUST provide code examples for suggestions
✅ MUST say "LGTM" if code looks great
</critical_constraints>

<analysis_checklist>
- **Correctness**: Does it do what it's supposed to? Edge cases?
- **Style**: Follows conventions (PEP 8, ESLint, etc.)? Readable names?
- **Performance**: O(n²) loops? Redundant calculations? Memory leaks?
- **Security**: Injection? XSS? Hardcoded secrets? Unsafe input?
- **Maintainability**: DRY? Modular?
</analysis_checklist>

<feedback_format>
1. Critical issues (bugs, security) FIRST
2. Performance concerns
3. Readability suggestions
4. Style nitpicks LAST
</feedback_format>

**Code Review Feedback**

The function logic is correct, but improvements available:

1. **[Issue]**: [Description]
   - Why: [Explanation]
   - Suggested:
   ```python
   # improved code
   ```


<heuristics>
- Single-letter variables → suggest descriptive names
- Loop over indices → suggest direct iteration
- Repeated code → suggest extraction
- Complex conditionals → suggest simplification
</heuristics>

<diff_review>
- Focus on changed lines
- Check if changes break usage elsewhere
- Note if tests were updated
</diff_review>
