Files
common-skills/skills/codereview/SKILL.md
T
2026-03-26 21:00:51 +08:00

1.1 KiB

name, description
name description
codereview-skill Code review best practices and checklist. Use when reviewing PRs, analyzing code quality, or checking for bugs and anti-patterns.

Code Review Skill

Review Checklist

When reviewing code, check the following:

Correctness

  • Logic is correct and handles edge cases
  • No off-by-one errors in loops
  • Null/None checks where needed

Readability

  • Variable and function names are descriptive
  • Functions do one thing (single responsibility)
  • No magic numbers — use named constants

Security

  • No hardcoded secrets or credentials
  • User inputs are validated/sanitized
  • No SQL injection or command injection risks

Example: Bad vs Good

# Bad
def f(x):
    return x * 86400  # magic number

# Good
SECONDS_PER_DAY = 86400

def to_seconds(days: int) -> int:
    return days * SECONDS_PER_DAY

Common Anti-patterns to Flag

  • Functions longer than 40 lines → suggest splitting
  • Deeply nested conditionals (>3 levels) → suggest early return
  • Duplicate code blocks → suggest extracting to function