| name | code-review |
| description | Provides a structured code review checklist. Use when reviewing code, scripts, or IaC files. Covers correctness, security, error handling, performance, and infrastructure as code. |
Code Review
Apply when: "๋ฆฌ๋ทฐ", "review", "๊ฒํ ", "์ฝ๋ ๋ฆฌ๋ทฐ"
Checklist
1. Correctness
- Logic matches requirements
- Boundary handling (off-by-one, min/max, empty input)
- Missing exception/error handling
- Type mismatch, None/null reference
- Return value correctness (all paths return expected type)
2. Security
- Hardcoded secrets/keys/passwords
- SQL/Command injection (use parameterized queries)
- Missing input validation (user input untrusted)
- Missing authorization/authentication check
- Sensitive data in logs or error messages
- Path traversal (user-controlled file paths)
3. Error Handling
- Bare except (
except: โ except Exception:)
- Silent error swallowing (pass in except)
- Useful error messages (include context for debugging)
- Resource cleanup (finally, context manager, try-with)
- Graceful degradation on external service failure
4. Performance
- Unnecessary loops (N+1 query, nested loops on large data)
- Memory: loading entire file/dataset into memory
- Unclosed connections/file handles/cursors
- Cacheable repeated computation
- Blocking I/O in async context
5. Concurrency (if applicable)
- Race condition (shared mutable state)
- Deadlock potential (lock ordering)
- Thread safety of shared resources
- Atomic operations where needed
6. Readability / Maintainability
- Clear naming (functions, variables, classes)
- Function length (>50 lines โ consider splitting)
- DRY violation (duplicated code โ extract)
- Magic numbers/strings โ named constants
- Comments: missing where complex, unnecessary where obvious
- Consistent code style with project
7. Test Adequacy (if tests exist)
- Happy path covered
- Error/exception cases covered
- Boundary values (BVA): min-1, min, max, max+1
- Equivalence partitions: all groups represented
- Branch coverage: both if/else paths tested
- Mock usage appropriate (external deps only)
8. Compatibility
- Python version compatibility (f-string 3.6+, match 3.10+, etc.)
- OS-specific code (path separators, commands)
- Dependency version constraints
9. Infrastructure as Code (Terraform / Ansible)
- Hardcoded values โ variables or locals
- Missing
description on variables/outputs
- Resource naming convention (
[env]-[category]-[service]-[detail])
- Missing tags (Name, Environment, Owner, ManagedBy)
- Overly permissive IAM (
* actions or resources)
- Security Group
0.0.0.0/0 inbound without justification
- Missing encryption (S3, EBS, RDS
storage_encrypted)
- No lifecycle/prevent_destroy on stateful resources
- Ansible: missing
become, handler not notified, no changed_when
- State drift risk: manual console changes not reflected in code
10. Shell / Bash Scripts
- Missing
set -euo pipefail (fail-fast + undefined var detection)
- Unquoted variables (
$VAR โ "$VAR", prevents word splitting)
- Missing input validation (argument count, file existence)
- Hardcoded paths โ variables or config file
- No cleanup trap (
trap cleanup EXIT)
- Using
echo for errors โ >&2 (stderr)
- Parsing command output instead of using proper tools (awk/jq)
- Missing
shellcheck compliance
- Race condition in temp file creation โ
mktemp
- Excessive use of
sudo without justification
Output Format
## ์ฝ๋ ๋ฆฌ๋ทฐ ๊ฒฐ๊ณผ
| # | ์ฌ๊ฐ๋ | ์์น | ๋ฌธ์ | ์ ์ |
|---|--------|------|------|------|
| 1 | ๐ด | L42 | ... | ... |
| 2 | ๐ก | L78 | ... | ... |
์ฌ๊ฐ๋: ๐ด bug/security | ๐ก improvement | ๐ก suggestion
์ดํ: (1~2๋ฌธ์ฅ ์์ฝ)
Priority
- ๐ด items: must fix before merge
- ๐ก items: should fix (technical debt if skipped)
- ๐ก items: optional improvement
Red Flags
- ๋ฆฌ๋ทฐ ์์ด merge/apply ์งํ
- ๐ด ํญ๋ชฉ์ ๋ฌด์ํ๊ณ ์งํ
- "๋์ค์ ๊ณ ์น๊ฒ ์ต๋๋ค"๋ก ๋ณด์ ์ด์ ๋ณด๋ฅ
- ๋ฆฌ๋ทฐ ๋ฒ์๋ฅผ ์์๋ก ์ถ์ (์์ฒญ๋ ํ์ผ ์ผ๋ถ๋ง ๊ฒํ )
- ๋ณ๊ฒฝ ์๋๋ฅผ ์ดํดํ์ง ์๊ณ ํ์๋ง ๊ฒํ