Back to Skills

codereview-correctness

verified

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 GitHub

Marketplace

codereview-skills

xinbenlv/codereview-skills

Plugin

codereview

Repository

xinbenlv/codereview-skills

skills/codereview-correctness/SKILL.md

Last Verified

January 20, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/xinbenlv/codereview-skills/blob/main/skills/codereview-correctness/SKILL.md -a claude-code --skill codereview-correctness

Installation paths:

Claude
.claude/skills/codereview-correctness/
Powered by add-skill CLI

Instructions

# 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

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6227 chars