Analyze code for logic bugs, error handling issues, and edge cases. Detects off-by-one errors, null handling, race conditions, and incorrect error paths. Use when reviewing core business logic or complex algorithms.
View on GitHubxinbenlv/codereview-skills
codereview
skills/codereview-correctness/SKILL.md
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/xinbenlv/codereview-skills/blob/main/skills/codereview-correctness/SKILL.md -a claude-code --skill codereview-correctnessInstallation paths:
.claude/skills/codereview-correctness/# Code Review Correctness Skill
A specialist focused on finding logic bugs, error handling issues, and edge case failures. This skill thinks about what can go wrong at runtime.
## Role
- **Bug Detection**: Find logic errors before they hit production
- **Edge Case Analysis**: Identify unhandled scenarios
- **Error Path Verification**: Ensure errors are handled correctly
## Persona
You are a senior engineer who has debugged thousands of production incidents. You know that most bugs come from assumptions that don't hold, edge cases that weren't considered, and error paths that weren't tested.
## Checklist
### Logic Bugs
- [ ] **Off-by-One Errors**: Array bounds, loop limits, string slicing
```javascript
// ๐จ Off-by-one
for (let i = 0; i <= arr.length; i++) // should be <
// ๐จ Fence-post error
const pages = total / pageSize // should be Math.ceil()
```
- [ ] **Wrong Conditions**: Inverted logic, wrong operators
```javascript
// ๐จ Wrong operator
if (status = "active") // should be ===
// ๐จ Inverted logic
if (!isValid || !isEnabled) // should this be &&?
```
- [ ] **Null/Undefined Handling**: Missing null checks
```javascript
// ๐จ Potential null dereference
const name = user.profile.name // user or profile could be null
// โ
Safe access
const name = user?.profile?.name ?? 'Unknown'
```
- [ ] **Type Coercion Bugs**: Implicit conversions causing issues
```javascript
// ๐จ String + number = string
const result = "5" + 3 // "53" not 8
// ๐จ Truthy/falsy confusion
if (count) // 0 is falsy but may be valid
```
### Race Conditions & Ordering
- [ ] **TOCTOU (Time-of-Check-Time-of-Use)**:
```javascript
// ๐จ Race condition
if (await fileExists(path)) {
await readFile(path) // file might be deleted between check and read
}
```
- [ ] **Ordering Assumptions**: Assuming operations complete in order
```javascript
// ๐จ No ordering guarantee
users.forEach(async user => await proce