/code-metrics:principles [question or concept]from code-metrics
Explains what code metrics mean, where reference values come from, and their limitations. Answers questions like 'what is cyclomatic complexity' or 'what is a good coverage number' without running measurements.
Ships in code-metrics. 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.
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.
| 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.
switch and 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.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.switch, which is
what makes it a readability measure. They disagree on the same function by design.(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: multimetric
reports Halstead per file and radon per function.unknown as typed, so an any-to-unknown sweep
raises it without adding type information.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.
any. unknown, a widened supertype, and a
falsely narrow annotation all count as typed. The TypeScript percentage and the Python
Any-expression figures are different measures over different populations and never compare.This plugin does not measure these. Each one has an owner, and each pointer is gated: when the named plugin is not enabled, the concern is out of this plugin's scope and nothing here substitutes for it, unless the bullet names its own fallback.
/mutation-testing:principles (if enabled) for what a
surviving mutant means, and /mutation-testing:audit (if enabled) to run one. Coverage cannot answer it: a covered line can still be unchecked./testing:audit (if enabled)./code-tidying:audit-dead-code (if enabled). ISO/IEC 5055 files dead code as its own weakness (7.1.5, CWE-561), separate from
every measure here./coupling:reduce (if enabled)./toolchain:lint (if enabled). A lint rule fires a finding; the measures here do not.--json document to /verification:measure metrics (if enabled),
treating a report whose status is empty on either side as INCONCLUSIVE; otherwise keep the
JSON beside your notes and compare by hand.Per-source annotation, including what each does not claim and the confidence behind it, is in literature.md.
This skill is knowledge, not workflow. It measures nothing, runs no collector, and reads no
repository. The audit-* skills in this plugin produce the numbers; this one explains them, and
deciding what to do about a number is the reader's call.
The reference/ files write the plugin's root directory as <plugin-root>, which is
${CLAUDE_PLUGIN_ROOT}. Put that path in place of the placeholder before running a command or
writing it into a brief: a ${…} token in a supporting file is not one this plugin can rely on
being expanded, either in the file or in the Bash tool. Where each plugin variable resolves, and
where it is exported: the plugins reference,
https://code.claude.com/docs/en/plugins/manifest-reference#where-each-variable-resolves.
/code-metrics:audit complexity, or the
audit action or audit-* skill for that measure./code-metrics:setup.null because nothing authoritative sets a value. Treating the four as one
tier is the error thresholds.md exists to prevent.What SKILL.md sets; muted values are Claude Code's defaults
6 skills in this plugin
/auditMeasure code for changed file/diff, path, or tree (`--all`) vs reference (size `--check`): size (lines per file), complexity (per-function cyclomatic complexity, cognitive, Halstead), type-debt (typed ratio, mypy). Use when 'which files are too big', 'how complex is this code', 'how many anys'. Not for CRAP: /code-metrics:audit-coverage./audit-coverageAudit coverageRead coverage artifacts a build already wrote (lcov, Cobertura, coverage.py JSON, Go cover profile) to report line coverage and CRAP per file and function for a change, path, or tree; runs no tests, never gates. Use when 'coverage per function', 'CRAP score', 'read the lcov report'. Not for complexity alone: /code-metrics:audit./audit-duplicationAudit duplicationMeasure duplicated code and redundant copy-paste clone classes (DRY) across a change, path, or tree with instance spans, excluding repo-sanctioned replication. Reports, never gates. Use when 'find copy-paste code', 'clone detection', 'duplication report'. Not for file length: /code-metrics:audit size./audit-suppressionsportability-ok: R6 kept-adapter operation - audit-suppressions.sh C# patternsList lint/type/coverage/security suppression diff/tree: eslint-disable/@ts-expect-error/noqa/type: ignore/pylint/pyright/SuppressMessage/@SuppressWarnings/pragma/shellcheck/nolint/markdownlint/rubocop/istanbul/c8/coverage.py/Stryker/bandit/nosec/nosemgrep/gitleaks; rule/reason/justified/correctness, no gate. Use when 'which noqa have no reason', 'suppressions added in this change'. Not for size: /code-metrics:audit./setupConfigure code-metrics: check probes Python, config layers, and collectors; apply writes docs/conventions/code-metrics.yaml (never installs tools).npx claudepluginhub melodic-software/claude-code-plugins --plugin code-metricsOther plugins' skills for the same job