handle-edge-cases

handle-edge-cases is a skill for Claude Code from jimmc414/claude-code-plugin-marketplace. It costs 27 tokens per session (695 once invoked), scanned A, original, MIT.

A coding guide for handling boundary conditions, situations such as empty lists, zero values, missing data, and recursive stopping points.

In plain words
What is it for?
Adding checks around empty collections, zero division, array or string indexes, loop limits, null values, and recursive base cases.
Why use it?
It helps prevent crashes and incorrect results when code reaches unusual or smallest-case inputs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the norvig-patterns plugin — 54 skills shipped together

Good fit Adding checks around empty collections, zero division, array or string indexes, loop limits, null values, and recursive base cases.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jimmc414/claude-code-plugin-marketplace/handle-edge-cases
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add jimmc414/claude-code-plugin-marketplace --skill handle-edge-cases
Clone the repo
git clone --depth 1 https://github.com/jimmc414/claude-code-plugin-marketplace

Made for: Claude Code.

Or install norvig-patterns, the plugin that ships this one along with the rest of its 54 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for handle-edge-cases

README.md
[![agentmods](https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/handle-edge-cases/github.svg)](https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/handle-edge-cases)
Your own site
<a href="https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/handle-edge-cases"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/handle-edge-cases/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for handle-edge-cases

Your own site · 80×15
<a href="https://agentmods.dev/skills/jimmc414/claude-code-plugin-marketplace/handle-edge-cases"><img src="https://agentmods.dev/badge/skills/jimmc414/claude-code-plugin-marketplace/handle-edge-cases.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 695 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00027 $0.00695
Opus 5 $0.00014 $0.00347
Sonnet 5 $0.00005 $0.00139
Haiku 4.5 $0.00003 $0.00069

Measured 9d ago against content hash 5749b86d9fb5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

handle-edge-cases scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/norvig-patterns/skills/handle-edge-cases/SKILL.md · 97 lines

How it starts

The opening of the file, as written. The whole thing — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.

handle-edge-cases

When to Use

  • Loop boundaries
  • Empty collections
  • Recursive base cases
  • Division or modulo operations
  • Array/string indexing

When NOT to Use

  • Already validated at boundary
  • Edge case can't happen
  • Over-defensive code

The Pattern

Explicitly check boundary conditions before operations.

def process(items):
    # Handle empty
    if not items:
        return default_value

    # Handle single element
    if len(items) == 1:
        return items[0]

    # Now safe to assume len >= 2
    return combine(items[0], process(items[1:]))

def divide(a, b):
    if b == 0:
        return None  # or raise, or return infinity
    return a / b

Example (from pytudes)

# Sudoku constraint propagation (sudoku.py)
def eliminate(values, s, d):
    """Eliminate d from values[s]; propagate."""
    if d not in values[s]:
        return values  # Already eliminated - edge case

    values[s] = values[s].replace(d, '')

    # Edge case: no values left
    if len(values[s]) == 0:
        return False  # Contradiction

    # Edge case: exactly one value left
    if len(values[s]) == 1:
        d2 = values[s]
        if not all(eliminate(values, s2, d2) for s2 in peers[s]):
            return False

    # Edge case: only one place for d in unit
    for u in units[s]:
        dplaces = [s for s in u if d in values[s]]
        if len(dplaces) == 0:
            return False  # No place for this value
        if len(dplaces) == 1:
            if not assign(values, dplaces[0], d):
                return False

    return values

# SET.py - zero division guard
def show(tallies, label):
    for size in sorted(tallies):
        y, n = tallies[size][True], tallies[size][False]
        ratio = ('inft' if n == 0 else int(round(float(y)/n)))
        print(f'{size:4d} |{y:7,d} |{n:7,d} | {ratio:4}:1')

# spell.py - word not found case
def candidates(word):
    """Generate possible spelling corrections for word."""
    return (known([word]) or          # Word itself if known
            known(edits1(word)) or    # 1 edit away
            known(edits2(word)) or    # 2 edits away
            [word])                   # Fallback: return original

Read the full file on GitHub · 97 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 97 lines · 27 tokens per session scan A 5749b86d9fb5

Subscribe to this mod's changes

handle-edge-cases is a skill published in the GitHub repository jimmc414/claude-code-plugin-marketplace (4 stars, last pushed yesterday), licensed MIT. It adds 27 tokens to every session and 695 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

audit-dead-code

Hunt dead code across a whole repository through four labelled lanes of unequal confidence. Knip (TS/JS unused files, exports, types, enum members), vulture (Python symbols), gopls (Go unexported symbols), and a portable grep lane (shell and other symbol languages), then adjudicate every candidate against the…

melodic-software/claude-code-plugins · 254 tokens

devils-advocate

Stress-test plans and proposals via systematic adversarial review. Assumption extraction, evidence check, failure scenarios, operational gotchas. Before implementation begins. Use when: asked to attack a plan or proposal ('devil's advocate', 'stress test', 'poke holes', 'what could go wrong'), or before implementation…

melodic-software/claude-code-plugins · 139 tokens

write

Produce a structured 5-field bug report (title, steps to reproduce, expected vs actual, severity with justification, suggested fix location) from an informal description. Read-only, never modifies code, never opens PRs, never files issues by default. Use when the user names a defect they observed ('there is a bug in…

melodic-software/claude-code-plugins · 168 tokens

reduce

Iteratively reduce coupling at any altitude — documents, code modules, applications, or repositories: scan for change-transmitting dependencies typed against a coupling model, verify each finding, apply a budgeted batch of safe behavior-preserving reductions, and ledger structural candidates for design routing so…

melodic-software/claude-code-plugins · 192 tokens

known-issues

Looks up and tracks known Claude product issues. Searches known GitHub bugs, checks service health and model quality, and maintains a persistent registry of tracked issues. Use when: 'is this broken', 'known CC bugs', 'troubleshoot Claude Code', 'any workarounds', 'feature behaves unexpectedly', 'scan repo for…

melodic-software/claude-code-plugins · 94 tokens

diagnose

Diagnose unexpected behavior from Claude Code's built-in computer-use MCP server (desktop screen control). Use when: 'computer use', 'control my screen', 'screenshot is blurry', 'why is the screenshot low resolution', 'zoom in on the screen', 'screenshot capture failed', 'empty capture', 'clicks are landing in the…

melodic-software/claude-code-plugins · 184 tokens