Principles
Metric literacy for code-metrics: what each measure means, where reference values come from, and what none of them tell a reader; measures nothing. Use when…
от melodic-software★ 34 звезды на GitHub
Установить Principles в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Code metrics knowledge base
The audit skill and its audit-* siblings in this plugin print numbers with their provenance and
stop. This skill says what each number means, where its reference value came from, and where reading
it as a verdict goes wrong. It renders no verdict of its own, and neither does the plugin: a
reference is a value to count against, never a bar, and no skill here turns a measured number into a
finding, a severity, or an exit-code gate, because a finding needs a measured corpus sweep behind it
and none has been run. The one findings file the plugin writes, from
audit-suppressions --findings, holds suppressions missing a reason or a rule id, not measured
numbers. Reference files in reference/ are source-attributed; the sections below answer the
common questions without a load.
Routing table
| Query about... | Load |
|---|---|
| What a measure is, its formula, per-language collector behavior, coverage artifact formats | measures.md |
| Where a reference value came from, which popular numbers have no source, how to set your own | thresholds.md |
| The CRAP formula, its two authorial names, the coverage join, what it does not predict | crap.md |
| Who published what, what a paper claims and does not claim, confidence per source | literature.md |
The report vocabulary (cov_source, not-applicable, partial) and the JSON document shape |
${CLAUDE_PLUGIN_ROOT}/reference/report-schema.md |
Load the one file the question lands in. Load a second only when the first leaves the question open.
Quick decision guide (no file load needed)
- "Which measure should I look at?". Start from the question, not from the report. How much
testing a function needs is cyclomatic complexity: McCabe 1976 defines it as the size of a basis
set of paths, and NIST SP 500-235 makes that the number of tests a module needs. How hard a
function is to read is cognitive complexity: Campbell's measure penalizes nesting and charges a
switchand all its cases once. Whether a diff is too large or copied is lines per file and duplication over the changed files, the two measures ISO/IEC 5055 files as weaknesses (CWE-1080 and CWE-1041). Whether the suite would catch a fault is not a coverage question: coverage records which lines executed, the primary literature disagrees on how well that predicts fault detection, and the owner of that question is behind the mutation-testing gate below. No measure here ranks changes by risk. - "Is 22 the cyclomatic threshold?". No source this plugin cites attributes 22 to anyone. The bundled reference is 20, from ISO/IEC 5055:2021 §8.2.117, with 10 (McCabe 1976) and 15 (NIST SP 500-235) as the cited alternatives you can select.
- "What is a good coverage number?". No standard sets one, so this plugin ships no coverage reference. A percentage counts executed lines; it says nothing about whether anything was checked.
- "Is 8% duplication bad?". No duplication reference ships, so the report counts nothing as
over. The percentage moves with
duplication.min_tokens, so two runs compare only at the same floor, and replication the repository declares in a registry is excluded rather than suppressed. - "Is CRAP a real metric?". It is real and authored (Savoia and Evans, 2007), and it is not a validated change-risk predictor. See crap.md before quoting a CRAP number.
- "Is this file too long at 1200 lines?". The report tells you it is at or above the reference of 1000, which is this plugin's own number. ISO/IEC 5055's normative clause for the same weakness is a percentage on a function, not a line count on a file.
- "Cyclomatic or cognitive?". Cyclomatic counts independent paths through a function, which is
what makes it a testing measure. Cognitive weights nesting and forgives a flat
switch, which is what makes it a readability measure. They disagree on the same function by design. - "Halstead difficulty rose when I split the file. Why?". Difficulty is
(n1/2) * (N2/n2), operator variety times operand reuse, with no explicit length term, so it does not track size. A split changes each half's operator count and reuse ratio, so per-file difficulty legitimately moves on a split, in either direction. Check which collector produced the row:multimetricreports Halstead per file andradonper function. - "Type coverage is 96%. Is that good?". No standard and no CWE anchors the measure, so there is
no external answer. The percentage also counts
unknownas typed, so anany-to-unknownsweep raises it without adding type information.
Cross-metric caveats
The whole plugin carries these once, here; the audit-* skills point at this section rather than
repeating it. Every one of them is a way a true number supports a false conclusion.
- **Coverage responds to tests
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- evals/evals.json
- reference/crap.md
- reference/literature.md
- reference/measures.md
- reference/thresholds.md
FAQ
Что делает скилл Principles?
Metric literacy for code-metrics: what each measure means, where reference values come from, and what none of them tell a reader; measures nothing. Use when: 'what does cyclomatic complexity mean', 'is CRAP a real metric', 'what is a good coverage number'. Not for running measurements: /code-metrics:audit.
Как установить скилл Principles?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл Principles запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…