Authors negative-knowledge scars (deadend/fence/landmine) to prevent repeating failed approaches, protect intentionally odd code, and document non-obvious coupling. Use when abandoning an approach, keeping suspicious code, or discovering hidden breakage.
Ships in scar. 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.
Read when SKILL.md points to them.
A scar records negative knowledge: a thing that was tried and failed, code that looks wrong but is intentional, or a non-obvious coupling. Scars fire automatically — the next editor sees the relevant scar injected before they touch anchored code. Your job here is to write a good one.
First test, before anything else: "Would this mistake plausibly recur in a different context?" If yes, it qualifies; if it could only ever happen once, it does not (heuristic from arXiv:2607.13091, a production field report on accumulated behavioral rules). Then pick the type:
deadendfencelandmineNot a scar: routine debugging that eventually succeeded. If you tried something, it worked, and you moved on — there is nothing to record.
deadend — tried and failed. Protects against re-attempting a dead path.
Primary anchor is usually pattern (the shape of the failed approach).
Example (scar #2): an agent tried to install Claude Code hooks by writing
~/.claude/settings.json directly; the permission classifier denies it. Anchor
path: src/scar/installer.py; body says the user must run scar hook install.
fence — looks wrong, is intentional. Protects existing code from a
"cleanup" that would break it. Primary anchor is path.
Example (scar #3): the installer deliberately ignores an active virtualenv so
hooks bind to a stable scar on PATH, not a venv shim that disappears. Anchor
path: src/scar/installer.py; body says "do not 'simplify' this to plain
shutil.which."
landmine — touching A breaks B. Anchor the trigger site; the body names
the blast radius. Example (scar #6): a regex in a scar's pattern: field passes through the
parser verbatim, so a doubled \\b stays two characters and matches nothing
real — the anchor silently self-matches only its own .scars/ body, and the
protection is dead while the gauge reads green.
.scars/template.md (or this skill's assets/template.md) — do not
edit the template itself..scars/candidates/<slug>.md with status: candidate..scars/*.md directly. A human promotes via
scar promote. (The literature agrees this gate is load-bearing:
arXiv:2607.13091 warns that "a noisy review culture can poison the rule
set faster than the validation step can catch" — bad scars amplify, so
promotion stays human.)scar_draft tool — it enforces the
path and runs lint before writing.A file without ----fenced YAML frontmatter is not a scar at all — it never
fires. Minimum valid block: type, title, severity, confidence,
created, authors, at least one anchors entry, and status: candidate.
authors is the runtime that drafted the scar (claude-code, codex,
cursor, windsurf, opencode), replacing the template's <your-runtime>
placeholder. It must never hold the human reviewer: the reviewer is recorded
in promoted_by by scar promote. Role words such as agent or
maintainer name no runtime. scar lint rejects a candidate that keeps the
placeholder or uses a role word.
Write anchors as a block list, one - kind: value line per anchor. A flow-style
list (anchors: [...]) is not read, so the scar loads with no anchors.
Prefer a path: anchor — it cannot self-match and needs no escaping. If you
must use a pattern: regex, know that the value reaches the matcher
verbatim — this reader is not a YAML parser and nothing un-escapes. Write
the regex exactly as it must execute: \b stays \b, \( stays \(.
Doubling backslashes "for YAML" yields a literal backslash and a dead anchor.
scar lint rejects it as an error. The value matches a literal backslash
followed by the next character, which lint cannot tell from a slip, so the
message prints two respellings. The halved form (\\w becomes \w) is for
when you meant the escape. The class form, with each doubled pair written as
[\\], is for when the target text really holds a backslash, such as regex
source inside a raw string. To guard r"[\w-]*(?:api|key)" write
\[[\\]w-\]\*\(\?:api, not \[\w-\]\*\(\?:api, which does not match it.
Lint accepts the class form.
The pattern is also matched against all tracked content including the scar's
own body, so a broken pattern keeps itself alive by self-reference. Run
scar lint and confirm the scar does NOT appear under partial-rot — which
also reports a dead branch inside an alternation, where a live branch would
otherwise mask it.
Wrong: pattern: "\\bwiden\\b" → Right: path: src/widen/ (no escaping, no
self-match).
path: = repo-relative prefix (file or directory). pattern: =
case-insensitive regex over path + new content.symbol: = path::name or a bare name. Use it for code likely to move or be
renamed: it follows the definition, not the path. Needs the [symbols] extra
(uv tool install "scar-cli[symbols]"), Python, TypeScript and JavaScript.low | medium | high | critical.violation: "<regex>" turns a scar from advisory into measurable: after an
edit to anchored code, the regex runs against the added lines — a match means
the forbidden thing was done anyway, and the violation is logged (this feeds
the fired→violated compliance metric).
time\.sleep\(, except \(KeyError, a banned API call), write
it. Prose-level deadends ("don't retry this architecture") stay
advisory-only — a tripwire that cannot be expressed as a regex honestly
should not exist.\b stays \b, \(
stays \(. Doubling backslashes "for YAML" is the over-escape trap that
kills pattern anchors, and it kills violation regexes the same way. The
same lint error and the same two respellings (halved or [\\]) apply
(see Anti-Over-Escape).scar check --diff twice: once with a diff that MUST fire the violation,
once with an innocent diff that must NOT. A tripwire verified only on the
firing case is untested on the case it will see most.scar lint must pass.evidence receipt (commit / pr / incident / note) — without it
the scar is challengeable on sight.violation: regex, both check --diff cases above proved out.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
negative-knowledge, scars, deadend, fence, landmine, behavioral-rules
Other plugins' skills for the same job
/scar:scar-authoringfrom scar
npx claudepluginhub daily-nerd/scar --plugin scar