code-derived-facts
БесплатноБез исполняемых скриптовНе проверенVerify code facts by running code, not grepping: is a function really called, is a derived table stale, did a scripted edit write. Use when auditing…
от laurigates★ 61 звезда на GitHubОб этом скилле
Code-Derived Facts
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.
When to Use This Skill
| 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 |
1. A mention is not a caller
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)
)
)
- An orphan is not a defect. Most are one-shot: a migration already run, a
builder used by hand every few months, a probe kept as evidence. Keep an
EXPECTEDroster with a reason per entry and report only unclassified orphans. "It was already on the list" is not a reason. - Prove the audit can fire. Drop a throwaway script into the directory and confirm the check exits non-zero and names it; remove it and confirm exit 0.
- Mount the audit on a recipe or CI step, not on someone remembering it.
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.
2. A derived fact belongs in the consumer
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.
- Derive where the consumer runs. A resolver that reads the source and refuses cannot be out of date with it; a committed table can.
- Make the guard's pattern looser than, and independent of, the one that derived the fact. Its value is catching what the first pattern missed. A guard written from the same regex cannot fail.
- A near-right aggregate is not corroboration. A total within 10% can sit on a per-item map that is wrong about the items you act on.
- Mutation-test the guard and check which check fired. A mutation caught by a different, earlier check proves nothing about the guard.
- Ask the question the consumer needs. "Is it where I put it" passes while "is something already there" fails.
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.
3. A registry that gains a second kind breaks every consumer that assumed one
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.
- Give the filter one home the moment there are two kinds (
people(tags), not six inlinet not in SETScopies, all of which go wrong when a third kind arrives). - Name the namespaces explicitly (
PERSON_TAGS,SET_TAGS,ALL_TAGS), with a comment saying which question each answers. - Grep for the old registry's name and every hand-written membership test,
Установить code-derived-facts в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobEditBash(grep *)TodoWriteВложенные файлы
FAQ
Что делает скилл code-derived-facts?
Verify code facts by running code, not grepping: is a function really called, is a derived table stale, did a scripted edit write. Use when auditing reachability or batch-editing source.
Как установить скилл code-derived-facts?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл code-derived-facts запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic