"Verify or configure the code-metrics plugin for this repository: `check` probes the interpreter, every configuration layer (user-global, team, local overlay, and the consumer's ecosystem files) for the YAML subset and the tracked-file guard, prints every reference with the layer that supplied it, and probes each collector adapter (a version, or missing with its install hint); `apply` writes the tracked `.claude/code-metrics.yaml` team layer per key, idempotently, never installing a tool and never editing `.gitignore`. Use when: 'set up code-metrics', 'configure code metrics', 'is code-metrics configured', 'which collectors are installed', 'set the cyclomatic reference', 'change the file length reference', 'code-metrics setup', or an audit skill reports a configuration layer it could not read."
Recursos
3Instal·la
npx skillscat add melodic-software/claude-code-plugins/plugins-code-metrics-skills-setup Instal·la des del registre de SkillsCat.
Purpose
Every reference the plugin prints, every lane's collector order, the scope exclusions, and the
coverage artifact paths resolve through one consumer surface, .claude/code-metrics.yaml,
layered as user-global (~/.claude/code-metrics.yaml), team (tracked), and local overlay
(.claude/code-metrics.local.yaml, gitignored) with per-key override. All three layers 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"Rows, each PASS, FAIL, WARN, or INFO:
- python: the interpreter resolved (
python3,python, orpy -3) and the plugin's floor.
FAIL stops the table: Python is required for correctness, so name the remediation. - layer user-global / team / local: 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 tracked:
git check-ignore -von the team file reports no match (a match is
FAIL with the rule: an ignored team layer never reaches the team) andgit ls-files --error-unmatchsees it (untracked is WARN: written but uncommitted). - layer local ignored: the overlay is gitignored, else WARN with the recommended consumer
line.claude/**/*.local.*. Recommend the line; never edit the consumer's.gitignore. - ecosystem
<lane>.yaml: each consumer ecosystem file parses; itsglobsandenabled
override lane detection. - reference
<measure>: the resolved value with the layer that supplied it and its
provenance, so a personal layer that changed a value is visible. - collector
<tool>: PASS with the version when the adapter's probe resolves the tool onPATH; INFOmissingwith the install hint otherwise. Missing is not a failure: the lane
reportsunavailableat 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
checkand 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 annotated template${CLAUDE_SKILL_DIR}/templates/config-template.yaml(every key with its default and
provenance, in the subset; the key reference is${CLAUDE_PLUGIN_ROOT}/reference/config.md):
the cyclomatic reference (20, ISO/IEC 5055 §8.2.117; 10 and 15 are the cited alternatives),
the file-length reference (1000, the plugin's own number; 500 selectable) andsize.mode,
scope exclusions, coverage artifact paths, per-lane 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
.claude/code-metrics.yaml(the root
git reports from the current directory;--dir <root>or--file <path>overrides it),
writes block style, and printsalready configuredwithout touching the file when nothing
changes.Verify. Re-run
check; report the persisted values from its table, never from the write
alone. The tracked-file pair decides the outcome: a WARNwritten but untrackedmeans "commit
it to share with the team", never success; an ignored team file is FAIL and the operator's.gitignoreis theirs to fix.
Output
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.
What this skill does NOT do
- Install, download, or
npx-fetch a collector. It prints install hints; the operator installs. - Write the user-global or local layers. Those are personal files the operator edits.
- Write Claude Code user settings or
pluginConfigs; the plugin has nouserConfig. - Edit the consumer's
.gitignore; it recommends the one recursive line. - Run an audit. The audit skills read the same resolved document at run time.
Next
/code-metrics:audit-complexity. The sibling audit-* skills cover the other measures.
Gotchas
- The team file must be committed to reach the team;
applyleaves it untracked on purpose and
thecheckrow says so until it is committed. applyjudges 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.- A layer written with a flow mapping (
{ enabled: true }) is outside the subset; every audit
reports the file as unreadable with the line, andcheckshows the same row. size.mode: iso-8.2.115needs a collector that reports function ranges (lizard,radon);
Bash has none, and its row says so.