/code-quality-plugin:code-derived-factsfrom code-quality-plugin
Verifies codebase facts by executing code rather than grepping: checks if functions are actually called, derived tables are stale, or scripted edits wrote correctly. Use when auditing reachability or batch-editing source.
Ships in code-quality-plugin. 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.
Four ways a codebase reports a fact that its text supports and its execution does not: a tool counted as reachable because its name appears in a comment, a fact derived once with a pattern and then read from a table, a registry whose new kind silently changes every consumer, and a scripted edit that reports success without writing. Each produces a clean report over a broken system.
| Use this skill when... | Use something else when... |
|---|---|
| Deciding whether a script, module, endpoint or flag is still used | Finding unused exports with a dead-code tool → code-dead-code |
| Writing a table of "which items need X" from a scan | Errors swallowed by || true or empty catch → code-hidden-failures |
| Adding a second kind of thing to a registry, enum, tag list or wire format | Classifying matches before a bulk rename → bulk-sweep-classify |
| Editing many sites in a large source file with a throwaway script | Replacing code by AST shape → ast-grep-search |
A tool nothing invokes does not fail. It sits there, unreachable, with no error and no red test. A script is reachable only if something executes it: a recipe, an import, an invocation. A filename in prose is not reachability, and an audit that counts prose certifies exactly the tools it was written to find. A test suite that never imports a module stays green while the module is broken.
# WRONG: a comment mentioning the file counts as a caller
refs = sum(1 for m, t in text.items() if m != n and n in t)
# RIGHT: only an import or an actual invocation makes it reachable
refs = sum(
1 for m, t in text.items()
if m != n and (
re.search(rf"^\s*(?:import|from)\s+{re.escape(stem)}\b", t, re.M)
or re.search(rf"import_module\(\s*['\"]{re.escape(stem)}", t)
or re.search(rf"(?:subprocess|run|check_call|Popen)[^\n]*{re.escape(n)}", t)
)
)
EXPECTED roster with a reason per entry and report only unclassified
orphans. "It was already on the list" is not a reason.The same shape: dead-code detectors keyed on a symbol that also appears in a docstring; "is this endpoint used?" answered by grepping the route string, which hits the API docs; dependency pruning that spares a package named in a comment; feature-flag cleanup that keeps a flag a migration note mentions.
Computing a fact with an ad-hoc pattern, writing the result into a table, and consulting the table makes the pattern's blind spot a property of the table. A fact derived with a regex is a reading, not a record. Put the derivation in the code that consumes it, so the consumer refuses when the reading is wrong.
The same shape: a roster of "files that need X" grepped once and committed; a
coverage or ownership map built by pattern-matching; any EXPECTED_* constant
derived from a scan; a test fixture generated by the parser under test.
When a table that has always held one kind of thing starts holding two, every place that iterated it is now wrong, and most of them do not raise: they compute something plausible from the wrong set. Adding a kind to a registry is not an additive change. The reads that keep working are more dangerous than the reads that break, and the worst sit in another file the change did not touch.
people(tags),
not six inline t not in SETS copies, all of which go wrong when a third kind
arrives).PERSON_TAGS, SET_TAGS, ALL_TAGS),
with a comment saying which question each answers.A wire format gaining a delimiter is the same event:
Length bounds, hand-listed subsets and parallel numbering systems: REFERENCE.md.
A throwaway s.replace(old, new) script is the practical way to change many
sites in a large file. Three failure modes cost time and silently drop edits.
str.replace then does nothing. Anchor on a fragment that fits on one
source line, grep -n it first, and prefer the Edit tool for a handful of
edits: it fails loudly on an absent or non-unique match.assert that
raises on substitution #4 discards #1 to #3, and the traceback reads as "the
first one failed". Never assert inside a batch that writes at the end;
report MISS and continue. Print ok only after the bytes are on disk:
write first, then report.replace() without a count changes every occurrence. Pass count=1
unless a global rename is intended, print s.count(old) first when unsure,
and re-grep the edited region for the words you replaced out.applied = []
for label, old, new in subs:
if old in s:
s = s.replace(old, new, 1); applied.append(label)
else:
print(" MISS", label)
p.write_text(s) # write first
for label in applied: print(" ok ", label) # then report
The gate: after any scripted edit, run the program or generator the file belongs to. Two of the three failures produce syntactically valid code, so neither the interpreter nor a linter is the gate; the program's own checks are.
code-dead-code — tool-driven unused-code detectioncode-hidden-failures — swallowed errors and success on zero resultsbulk-sweep-classify — which matches to change in a sweeptesting-plugin:measurement-controls — a check that cannot fail has tested
nothingdocumentation-plugin:docs-claim-hygiene — readings written into proseDistilled from rules in the laurigates/comfyui-nodes repository, whose dated instances are the provenance for each law.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub laurigates/claude-plugins --plugin code-quality-plugin19 skills in this plugin
/ast-grep-searchFind and replace code patterns structurally with ast-grep. Use when matching code by AST structure, finding functions with specific signatures, or detecting anti-patterns regex cannot match./bulk-sweep-classifyClassify every regex match before a bulk find-replace/syntax-modernization sweep — four match categories, scoped transform, allowlist-aware verification. Use when bulk-renaming commands/tools/paths or migrating syntax across many files./code-antipatternsAnalyze a codebase for anti-patterns using ast-grep. Use when finding magic numbers, console.logs, var usage, excessive any, eval/innerHTML security issues, or deep nesting.Other plugins' skills for the same job