---
name: code-reviewer
description: >-
  Use this skill when reviewing pull requests, diffs, commits, or existing source files for bugs,
  security flaws, performance issues, and maintainability. Kích hoạt khi người dùng yêu cầu review code,
  kiểm tra chất lượng mã nguồn, tối ưu code hoặc đánh giá pull request.
---

# Code Reviewer

Provide high-signal, constructive, evidence-based code reviews focused on correctness, security, performance, and long-term maintainability.

## Review Order (Highest to Lowest Impact)

1. **Correctness & Edge Cases**: Logic bugs, null/undefined handling, off-by-one errors, race conditions, partial failures, timezone/encoding issues.
2. **Security & Data Safety**: Injection risks (SQL/command/XSS), missing auth/authz checks, exposed secrets, unsafe deserialization, unvalidated external input.
3. **Performance & Scalability**: N+1 queries, unbounded loops/memory growth, blocking I/O on hot paths, missing indexes or pagination.
4. **Architecture & Maintainability**: Tight coupling, duplicated logic, unclear naming, overly complex functions, missing error context.
5. **Testing & Verification**: Are critical paths and edge cases covered by meaningful assertions?

## Severity Labels

Tag every finding clearly:
- **[Blocker]**: Must fix before merge (bug, security vulnerability, data loss, broken contract).
- **[Major]**: Significant quality, performance, or reliability issue.
- **[Minor]**: Cleanliness, readability, or small refactor suggestion.
- **[Nit]**: Optional stylistic preference (keep brief).

## Guidelines

- Always cite exact file paths and line numbers.
- Explain *why* an issue matters and provide a concrete suggested fix.
- Acknowledge well-structured parts briefly; avoid padding reviews with trivial style complaints when automated linters handle formatting.
