/code-metrics:setup [check|apply] [<key>=<value> ...]from code-metrics
Check and apply code-metrics configuration: verify Python, config layers, and collectors; persist settings to docs/conventions/code-metrics.yaml. Does not install tools.
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, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Every reference the plugin prints, every language's collector order, the scope exclusions, and the
coverage artifact paths resolve through one consumer surface whose layers and per-key override
${CLAUDE_PLUGIN_ROOT}/reference/config.md lists. The team file of earlier releases,
.claude/code-metrics.yaml, is retired and never read; apply moves its keys. Old
~/.claude/code-metrics.yaml and .claude/code-metrics.local.yaml files are not read. Every
layer absent is a valid state: every key has a bundled default. This skill is the check-centric
setup for that surface and for the external collectors the audits probe: check inspects and
verifies, apply persists, and neither installs anything. Keys, defaults, and provenance:
${CLAUDE_PLUGIN_ROOT}/reference/config.md.
Action routing: no argument or check runs the check; apply runs the check first, then
persists. apply is non-interactive when complete <key>=<value> arguments are supplied
(automation and headless use pass them and are never prompted); with none, it interviews one key
at a time, recommendation first.
check (read-only)Run and present the table as printed:
"${CLAUDE_SKILL_DIR}/scripts/setup-check.sh" --user-file '${user_config.config_file}'
Keep --user-file exactly as written here: it names the userConfig layer's file, and an empty
or unsubstituted value means the option is unset.
Rows, each PASS, FAIL, WARN, or INFO:
python3, python, or py -3) and the plugin's floor.
FAIL stops the table: Python is required for correctness, so name the remediation.userConfig is INFO unset when the config_file
option names no file, and WARN when its value is not an absolute path. Each file layer is
absent (INFO), or present and parsed in the YAML subset the plugin reads (block mappings, block
sequences, flow sequences of scalars, scalars, comments). A flow mapping, anchor, tag, or block
scalar is FAIL with its line; the operator rewrites the file in block style.
layer team location is WARN when the retired .claude/code-metrics.yaml exists: the
plugin does not read it, so apply moves its keys, or, once the docs file exists, the
operator deletes it.git check-ignore -v on the team file reports no match (a match is
FAIL with the rule: an ignored team layer never reaches the team) and git ls-files --error-unmatch sees it (untracked is WARN: written but uncommitted).docs/conventions/**/*.local.*. Recommend the line; never edit the consumer's
.gitignore.<language>.yaml: each consumer ecosystem file parses. PASS when its language is in the
resolved languages mapping (a bundled language, or one a layer lists): its globs and enabled
override language detection. WARN naming the missing languages.<language> entry when no layer lists the
language: the resolver ignores that record. WARN asking for a rename when the file name is not a
lowercase kebab-case language id, since no languages entry can name it. WARN when the configuration
does not resolve, since the language list is then unknown.<measure>: the resolved value with the layer that supplied it and its
provenance, so a personal layer that changed a value is visible.<tool>: the adapter's probe, then one measure from the ladder run on a bundled
fixture. PASS <version>; measured <measure> on <fixture> when the measure returns rows; FAIL
when the probe passed but the measure exited non-zero or returned no rows, with the first
stderr line (a tool that resolves but cannot measure); WARN probe only: <reason> when no
bundled fixture can exercise it (a tool bound to the project's own configuration, or one with
no fixture for its language); INFO missing with the install hint when the probe fails. Missing
is not a failure: the language reports unavailable at audit time and the run continues.Exit 0 with no FAIL row, 1 with one, 2 on a usage or environment error.
apply (idempotent)Run check and read its table.
Resolve the values. With complete <key>=<value> arguments, use them directly. Otherwise
interview one key at a time, recommendation first, walking the key reference
${CLAUDE_PLUGIN_ROOT}/reference/config.md (every key with its default and provenance;
${CLAUDE_SKILL_DIR}/templates/config-template.yaml holds the defaults in the subset):
the cyclomatic reference (10 and 15 are the cited alternatives to the default),
the file-length reference (500 selectable) and size.mode,
scope exclusions, coverage artifact paths, per-language opt-outs and collector order, duplication
registries. Offer every declared key, preserve every key the existing file carries, and never
invent a key beyond the contract. A key outside the contract is written but reported, because
unknown keys are inert to the plugin.
Persist. One call per run, every value as <key>=<value> in the YAML subset:
"${CLAUDE_SKILL_DIR}/scripts/setup-apply.py" size.file_lines=500 'scope.exclude=["vendor/**"]'
The script merges per key into the repository root's docs/conventions/code-metrics.yaml
(the root git reports from the current directory; --dir <root> or --file <path> overrides
it), writes block style, and prints already configured without touching the file when
nothing changes. When that file does not exist yet and .claude/code-metrics.yaml does, the
first write carries every declared key of the retired file, so the docs file holds the values
the retired one set, and drops and names any key the contract does not declare; with no
<key>=<value> the run is that move alone. The retired file stays in place and is not read;
tell the operator to delete it. A symlinked, hard-linked or non-regular target or retired
file, or a symlinked docs/, docs/conventions/ or .claude/, is refused with exit 1 and
nothing written.
Verify. Re-run check; report the persisted values from its table, never from the write
alone. The tracked-file pair decides the outcome: a WARN written but untracked means "commit
it to share with the team", never success; an ignored team file is FAIL and the operator's
.gitignore is theirs to fix.
check: the table. apply: the table before and after, the written path, and one line on how
to re-run this skill to reconfigure. Say which layer supplied each reference that differs from the
bundled default.
npx-fetch a collector. It prints install hints; the operator installs.userConfig file; personal files are the operator's to edit.pluginConfigs; the operator sets config_file in /config..gitignore; it recommends the one recursive line./code-metrics:audit complexity. The other audit actions and audit-* skills cover the rest.
apply leaves it untracked on purpose and
the check row says so until it is committed.apply judges idempotence on parsed content, so hand-written comments never force a rewrite
by themselves; a value that differs does, and the file is rewritten in block style.{ enabled: true }) is outside the subset; every audit
warns that the file was ignored, with the line, and check shows it as a FAIL row. A value of
the wrong shape is dropped by file, key and value and the audit keeps running.size.mode: iso-8.2.115 needs a collector that reports function ranges (lizard, radon);
Bash has none, and its row says so.What SKILL.md sets; muted values are Claude Code's defaults
bashThree short reads, in order
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./npx claudepluginhub melodic-software/claude-code-plugins --plugin code-metricsOther plugins' skills for the same job