/nexa-claude-audit:code-metrics-auditfrom nexa-claude-audit
Generates a dated static code metrics audit report covering cyclomatic complexity, duplicated code percentage, CBO, and DIT with pass/warn/fail thresholds. Runs no tests or builds.
Ships in nexa-claude-audit. 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.
None: SKILL.md is the whole skill.
/code-metrics-audit.This skill owns the static code metrics. It does not run tests, and it does not measure coverage
or mutation score; /test-efficacy-audit and /mutation-audit do that.
This skill may run static analysers (lizard, jscpd, CK) with an ephemeral runner: uvx,
pipx run, npx, or a JAR in a temporary folder. Put every analyser output in a temporary folder
outside the repository. All other contract scope rules apply: no tests, no builds, no installs into
the repository, and the report is the only file that the skill writes.
Before the first ephemeral run, tell the user which analysers you will run and ask for approval.
When the user declines, or the runner is not available, write Not measured and the reason for
each affected metric.
| Metric | Unit | Pass | Warn | Fail |
|---|---|---|---|---|
| Cyclomatic complexity (CCN) | function | ≤ 10 | 11–20 | > 20 |
| Duplicated lines | repository | ≤ 3 % | > 3 % and ≤ 5 % | > 5 % |
| CBO (efferent) | class or module | ≤ 9 | 10–14 | > 14 |
| DIT | class | ≤ 4 | 5–6 | > 6 |
The complexity limit of 10 is the same limit as /code-quality in the stack plugins.
The status of a per-unit metric is the status of its worst unit. Also give the count of units in each status.
Read and follow ${CLAUDE_PLUGIN_ROOT}/shared/AUDIT_CONTRACT.md: establish the report context,
detect the stack, and select the report path. Skill name: code-metrics-audit.
Title: Code Metrics Audit.
src/, app/, lib/, internal/,
pkg/, cmd/, src/main/, the package folders in pyproject.toml)./qa-audit), generated code
(*_templ.go, *.pb.go, *.gen.*, sqlc output, __generated__/, files with a
Code generated … DO NOT EDIT header), migrations, and fixtures.TMP="$(mktemp -d)". Remove it at the end.Tools used.lizard on the included folders, for example
uvx lizard --csv -x "<exclude glob>" <folders> > "$TMP/lizard.csv", with one -x for each
exclude pattern. lizard supports most
languages (C/C++, C#, Go, Java, JavaScript, TypeScript, Kotlin, PHP, Python, Ruby, Rust, Swift).jscpd on the included folders, for example
npx jscpd --silent --min-tokens 50 --reporters json --output "$TMP/jscpd" --ignore "<exclude globs>" <folders>.statistics.total.percentage (duplicated lines, percent) from jscpd-report.json.This skill measures efferent CBO: the number of distinct other classes or modules that one class
or module uses. DIT is the number of ancestor classes, without the language root class
(Object, object). A class with no base class has DIT 0.
Select the method by language, and record it in each row:
com.github.mauricioaniche:ck, the jar-with-dependencies artifact from
Maven Central, in a temporary folder):
java -jar "$TMP/ck.jar" <source folder> false 0 false "$TMP/ck/". Read cbo and dit from
class.csv. CK counts java.lang.Object, so subtract 1 from dit. Method: tool: CK.Not applicable: Go has no class inheritance. Method:
computed from source.import, require, from … import, using, use). Exclude third-party
packages and the standard library. Method: computed from source.extends, class A(B), class A : B,
< B). Follow the chain inside the repository. When the chain reaches a class outside the
repository, write ≥ n and name that base class. Rust has no class inheritance: write
Not applicable. Method: computed from source.Record the 20 units with the highest CBO and the 20 classes with the highest DIT.
Use this template after the contract header, ## Summary, and ## Gaps. Gaps include every
metric with a warn or fail status, every Not measured metric, and every metric with weak
evidence (for example a DIT chain that leaves the repository).
## Tools used
| Metric | Tool or method | Version | Command | Included folders | Exclude patterns |
|--------|----------------|---------|---------|------------------|------------------|
## Metrics and thresholds
| Metric | Value | Threshold (pass) | Status | Units: pass / warn / fail |
|--------|-------|------------------|--------|---------------------------|
| Cyclomatic complexity | avg <n>, P90 <n>, max <n> | ≤ 10 per function | | |
| Duplicated lines | <n> % | ≤ 3 % | | — |
| CBO (efferent) | avg <n>, max <n> | ≤ 9 per unit | | |
| DIT | avg <n>, max <n> | ≤ 4 per class | | |
## Complexity hotspots
| Function | File#line | CCN | Status |
|----------|-----------|-----|--------|
## Duplicate blocks
| Location A | Location B | Lines |
|------------|------------|-------|
## Coupling (CBO)
| Unit | Kind (class / file / package) | CBO | Method | Status |
|------|-------------------------------|-----|--------|--------|
## Inheritance depth (DIT)
| Class | File#line | DIT | Chain | Method | Status |
|-------|-----------|-----|-------|--------|--------|
Confirm the contract checklist, then:
Metrics and thresholds has a value and a status, or Not measured with
the reason.Coupling (CBO) and Inheritance depth (DIT) names its method.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
code-metrics, static-analysis, complexity, duplication, audit-report
8 skills in this plugin
/architecture-auditWrites a dated architecture audit report for the current repository: links to the existing architecture documents, diagrams, and ADRs; the dependencies found in the implementation; C4 context, container, and component diagrams, sequence diagrams, and entity relationship diagrams in Mermaid, drawn from the code; a 4+1 view coverage map; and a trace of the non-functional requirements. Works on any repository and any tech stack. Writes only docs/audit/architecture-audit/architecture-audit-YYYY-MM-DD-<hash>.md. This skill must only be invoked explicitly via /architecture-audit — never inferred from user messages.
/cicd-auditWrites a dated CI/CD audit report for the current repository: the CI/CD system and local gates, a table of every pipeline with its triggers, jobs, test categories, and deploy target, a Mermaid flowchart of the main pipeline, the quality gates, and the gaps. Works on any repository and any CI system (GitHub Actions, GitLab CI, Jenkins, CircleCI, Azure Pipelines, Bitbucket, and others). Writes only docs/audit/cicd-audit/cicd-audit-YYYY-MM-DD-<hash>.md. This skill must only be invoked explicitly via /cicd-audit — never inferred from user messages.
Other plugins' skills for the same job
/infra-auditWrites a dated infrastructure audit report for the current repository: where and how the infrastructure is defined (Terraform, Pulumi, CDK, Helm, Kubernetes, Dockerfiles, Compose, serverless configs), the environments and how one is selected, the secret references (names only), and the local development infrastructure. Works on any repository and any tech stack. Writes only docs/audit/infra-audit/infra-audit-YYYY-MM-DD-<hash>.md. This skill must only be invoked explicitly via /infra-audit — never inferred from user messages.
npx claudepluginhub nexadevapp/nexa-claude-skills-marketplace --plugin nexa-claude-audit