Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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)
    )
)
  1. 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 EXPECTED roster with a reason per entry and report only unclassified orphans. "It was already on the list" is not a reason.
  2. 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.
  3. 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.

  1. Derive where the consumer runs. A resolver that reads the source and refuses cannot be out of date with it; a committed table can.
  2. 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.
  3. 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.
  4. Mutation-test the guard and check which check fired. A mutation caught by a different, earlier check proves nothing about the guard.
  5. 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 inline t not in SETS copies, 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,
Полный SKILL.md на GitHub

Установить code-derived-facts в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Grep
Glob
Edit
Bash(grep *)
TodoWrite

Вложенные файлы

REFERENCE.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить code-derived-facts с