/agent-skills:negative-spacefrom agent-skills
Negative space programming — state what must not happen and make the code fail loudly when it does (assertions, preconditions, invariants, exhaustive matching, no silent fallbacks, negative tests). Use whenever writing, editing, or reviewing code that validates input, handles errors, defaults a missing value, branches over a closed set of cases, or has a catch or fallback path.
Ships in agent-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Code has a positive space (the states the design expects) and a negative space (every state it does not). Bugs live where data crosses from one to the other. Program the negative space: write down what must not happen and make the program stop at the first sign of it, so the fault surfaces where it originates and not three layers later as a wrong answer.
The fault kinds decide the tool, so classify before writing any check:
| Fault | Cause | Response |
|---|---|---|
| Bug | A broken internal assumption: caller passed what the contract forbids, an invariant no longer holds, a case nobody planned for | Assert, and stop |
| Expected failure | The world misbehaving in a way that can be foreseen: bad user input, a timeout, a missing file, a rejected request | Handle: a typed result or a named exception at the boundary |
Assertions guard against bugs. An expected failure that is asserted crashes production on ordinary input; a bug that is handled as an expected failure is swallowed and travels on.
Assert what you expect and what you do not expect, at the edges of every function: arguments, results, and the invariants in between.
require(quantity > 0) { "quantity must be positive, was $quantity" }.check(order.isOpen) { "cannot add a line to a closed order" }.error("unhandled payment kind $kind").require(a); require(b), not require(a && b).The strongest assertion is one the compiler checks. Prefer, in order: a type that cannot express the bad state, a compile-time check (exhaustive when, sealed types), then a runtime assertion.
A default, a swallowed exception or a fallback turns a bug into a wrong answer with no witness.
?: "", ?: 0, ?: emptyList() to get past a value that should exist. Either absence is valid and has its own named representation, or it is a bug and stops.catch, no catch that logs and continues past a broken invariant, no else -> default over a closed set.else, so a new case is a compile error and not a silent fall-through.External input is checked once, where it enters, and becomes a typed value. Inside the boundary the code asserts its invariants and does not re-validate defensively (shotgun parsing: checks scattered through processing code with no systematic justification). An invalid external value gets an explicit outcome: rejected with a named exception, or an explicit case like UNKNOWN. It never travels inward as a bare string or a null.
Tests cover the rejected input, the violated precondition and the unknown case, and cover valid data turning invalid, since that transition is where bugs concentrate. Each assertion you write earns a test that trips it.
catch/except that never references the caught error's content — doesn't inspect it, rethrow it transformed, or act on it — is a swallowed exception even when it superficially "handles" something.try/catch around code with no I/O, no parsing and no external call needs a named exception it's defending against. Can't name one → the wrapper is padding, not handling..find()/.get() result. A callee that reports failure and gets ignored is the same bug either way.a or b or default swallows a genuine 0, "", or false as if it were absent — a sharper, easier-to-miss variant of the defensive default.catch with nothing, or a log line and a return null.else/default returns a generic value instead of erroring — it defeats the exhaustiveness check without looking like it.require(x) with no message, or a message that omits the value.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub joachimwedin/agent-skills --plugin agent-skills32 skills in this plugin
/blackbox-test-casesGenerate exhaustive, non-negotiably rigorous black-box test case descriptions (Given/When/Then, not code) for a public API's external contract — never its implementation. Use for zero-tolerance test coverage, an extremely strict/exhaustive black-box test case sweep, or whenever "thorough" test-case generation isn't thorough enough. Produces an API handoff file, one case file per sub-agent — each is its own source of truth — and a master index file pointing at all of them. Every case carries a checkbox so a later implementing agent can track what's been turned into runnable tests. This skill never writes runnable tests itself./brand-palettePick a primary and accent color that fit a given project and fit each other, or — given an explicit primary — pick three accent candidates that each fit the primary and the project, then generate the full Tailwind v4 color-token system (raw OKLCH scales plus the semantic layer, light and dark) for all three candidates as copy-paste CSS and a visual HTML report written into the project. Use when the user wants brand colors chosen for a project, a Tailwind color system generated from a repo, or a secondary/accent color picked to pair with a primary they already have./codebase-designShared vocabulary for designing deep modules. Use when the user wants to design or improve a module's interface, find deepening opportunities, decide where a seam goes, make code more testable or AI-navigable, or when another skill needs the deep-module vocabulary./cohesionCohesion — the members of a module or class belong together because they share data or jointly accomplish one purpose, not because they were filed under the same name. Use when several functions in a module all take the same parameter (a data clump), when a class's methods don't obviously need each other, when deciding whether to combine loose functions into a class, or when a module's contents are grouped by category or by when they run rather than by what they share./comment-guidelinesWhat makes a code comment worth writing versus noise that will rot — a narrow allow-list plus named anti-patterns (narration, changelog comments, caller-referencing comments, commented-out code, placeholder spam, AI-voice filler). Use whenever writing, editing, or reviewing code that contains or might contain comments./conventions-checkChecks a repo — or just its current diff — against the conventions it states in its own documents and reports each violation as a structured finding. Read-only: no artifact, no fixing; the caller decides what to do with the findings. Use when asked to check conventions programmatically, or as another skill's convention-compliance gate (e.g. `/implement`'s review pass). For a shareable HTML report instead, use `conventions-report`, which wraps this skill.