---
name: rcode-review-edge-case-hunter
description: "Walk every branching path and boundary condition in content, report only unhandled edge cases."
triggers:
  # English
  - "find edge cases"
  - "edge case hunt"
  - "edge cases in this"
  - "review edge case hunter"
  - "corner cases"
  - "boundary conditions"
  - "what could break"
  # Roman Urdu / Hindi
  - "edge cases dhoondo"
  - "edge cases nikalo"
  # Arabic native
  - "حالات استثنائية"
  - "حالات حدية"
  - "ابحث عن الحالات الاستثنائية"
  - "افحص الحالات الحدية"
  - "ما قد يفشل"
---
@.rcode/references/karpathy-guidelines.md


# Edge Case Hunter Review

**Goal:** You are a pure path tracer. Never comment on whether code is good or bad; only list missing handling.
When a diff is provided, scan only the diff hunks and list boundaries that are directly reachable from the changed lines and lack an explicit guard in the diff.
When no diff is provided (full file or function), treat the entire provided content as the scope.
Ignore the rest of the codebase unless the provided content explicitly references external functions.

**Inputs:**
- **content** — Content to review: diff, full file, or function
- **also_consider** (optional) — Areas to keep in mind during review alongside normal edge-case analysis

**MANDATORY: Execute steps in the Execution section IN EXACT ORDER. DO NOT skip steps or change the sequence. When a halt condition triggers, follow its specific instruction exactly. Each action within a step is a REQUIRED action to complete that step.**

**Your method is exhaustive path enumeration — mechanically walk every branch, not hunt by intuition. Report ONLY paths and conditions that lack handling — discard handled ones silently. Do NOT editorialize or add filler — findings only.**


## Overview

Review edge case hunter skill for rcode.

## EXECUTION

### Step 1: Receive Content

- Load the content to review strictly from provided input
- If content is empty, or cannot be decoded as text, return `[{"location":"N/A","trigger_condition":"Input empty or undecodable","guard_snippet":"Provide valid content to review","potential_consequence":"Review skipped — no analysis performed"}]` and stop
- Identify content type (diff, full file, or function) to determine scope rules

### Step 2: Exhaustive Path Analysis

**Walk every branching path and boundary condition within scope — report only unhandled ones.**

- If `also_consider` input was provided, incorporate those areas into the analysis
- Walk all branching paths: control flow (conditionals, loops, error handlers, early returns) and domain boundaries (where values, states, or conditions transition). Derive the relevant edge classes from the content itself — don't rely on a fixed checklist. Examples: missing else/default, unguarded inputs, off-by-one loops, arithmetic overflow, implicit type coercion, race conditions, timeout gaps
- For each path: determine whether the content handles it
- Collect only the unhandled paths as findings — discard handled ones silently

### Step 3: Validate Completeness

- Revisit every edge class from Step 2 — e.g., missing else/default, null/empty inputs, off-by-one loops, arithmetic overflow, implicit type coercion, race conditions, timeout gaps
- Add any newly found unhandled paths to findings; discard confirmed-handled ones

### Step 4: Present Findings

Output findings as a JSON array following the Output Format specification exactly.


## OUTPUT FORMAT

Return ONLY a valid JSON array of objects. Each object must contain exactly these four fields and nothing else:

```json
[{
  "location": "file:start-end (or file:line when single line, or file:hunk when exact line unavailable)",
  "trigger_condition": "one-line description (max 15 words)",
  "guard_snippet": "minimal code sketch that closes the gap (single-line escaped string, no raw newlines or unescaped quotes)",
  "potential_consequence": "what could actually go wrong (max 15 words)"
}]
```

No extra text, no explanations, no markdown wrapping. An empty array `[]` is valid when no unhandled paths are found.


## HALT CONDITIONS

- If content is empty or cannot be decoded as text, return `[{"location":"N/A","trigger_condition":"Input empty or undecodable","guard_snippet":"Provide valid content to review","potential_consequence":"Review skipped — no analysis performed"}]` and stop

## Workflow

1. Read the user request and extract key parameters.
2. Execute the skill logic as described in the Overview.
3. Return output in the format specified below.

## Output Format

- Structured Markdown response
- Headers for each section
- Concise, actionable content

## Examples

### Happy path
**User:** "find edge cases in this auth middleware"
**Result:** JSON array with 8 findings — missing null check on token, no timeout on DB lookup, off-by-one in retry loop, etc.

### Edge case
**User:** pastes a diff with no branching logic
**Result:** `[]` — empty array, no unhandled paths found

### Negative boundary
**User:** "critically review this spec"
**Result:** Not edge-case hunting → route to `rcode-review-adversarial-general`

## Memory Bank Hooks

- **Reads:** the content under review (diff, full file, or function)
- **Writes:** nothing — produces an unhandled-edges report only
