# Code metrics audit

> Code metrics audit is an open-source agent skill for developer tools. Writes a dated static code metrics report with complexity, duplication, CBO and DIT. It is available on Claude Code.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code
- **Website:** https://github.com/nexadevapp/nexa-claude-skills-marketplace/tree/main/nexa-claude-audit/skills/code-metrics-audit
- **Repository:** https://github.com/nexadevapp/nexa-claude-skills-marketplace
- **GitHub stars:** 7
- **License:** Apache-2.0
- **Skill name:** code-metrics-audit
- **Collection:** https://github.com/nexadevapp/nexa-claude-skills-marketplace
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-04

## About

This skill produces a dated audit report for the current repository that grades four static code metrics: cyclomatic complexity per function, the share of duplicated lines, efferent coupling between objects, and depth of inheritance tree. Each metric gets a pass, warn or fail status against a fixed threshold, along with counts of units in each status and lists of the worst offenders.

The workflow selects production source folders, excludes generated code, tests, migrations and fixtures, and runs analysers such as lizard and jscpd through ephemeral runners, keeping their output in a temporary folder outside the repository. Java coupling and inheritance are measured with CK, while other languages are computed from imports and class declarations. Before the first external run the skill asks the user for approval, and it marks any metric it cannot measure as not measured with a reason.

It expects a repository to audit, the ability to run uvx, npx or Java, and the shared audit contract that ships with the Nexa Claude plugin. The skill is invoked only explicitly through its slash command and writes a single markdown file under docs/audit.

## When your agent uses it

> Writes a dated code metrics audit report for the current repository: cyclomatic complexity, duplicated code percentage, coupling between objects (CBO), and depth of inheritance tree (DIT), each with a pass / warn / fail status against a fixed threshold. Static analysis only; runs no tests and no builds. Works on any repository and any tech stack. Writes only docs/audit/code-metrics-audit/code-metrics-audit-YYYY-MM-DD-<hash>.md. This skill must only be invoked explicitly via /code-metrics-audit — never inferred from user messages.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/nexadevapp/nexa-claude-skills-marketplace/tree/HEAD/nexa-claude-audit/skills/code-metrics-audit)
- [License: Apache-2.0](https://github.com/nexadevapp/nexa-claude-skills-marketplace/tree/HEAD/nexa-claude-audit/skills/code-metrics-audit)

## Features

- **Cyclomatic complexity check:** Measures per-function complexity with lizard and reports average, P90, maximum and the worst functions.
- **Duplication measurement:** Uses jscpd to find duplicated lines across included folders and lists the largest clone pairs.
- **Coupling and inheritance metrics:** Computes efferent CBO and DIT per unit, using CK for Java and source parsing for other languages.
- **Threshold status grading:** Assigns pass, warn or fail to each metric and unit according to a fixed threshold table.
- **Static analysis only:** Runs no tests or builds and writes only the dated report file into the repository.

## Good for

- Audit the complexity of functions across my codebase
- Find duplicated code blocks in this repository
- Report coupling between classes and modules
- Check inheritance depth in an object-oriented project
- Generate a dated code quality metrics report

## Install

### Claude Code

This skill ships in the `nexa-claude-audit` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add nexadevapp/nexa-claude-skills-marketplace
/plugin install nexa-claude-audit@nexa-claude-marketplace
```

Or copy only this skill to `~/.claude/skills/code-metrics-audit`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/nexadevapp/nexa-claude-skills-marketplace.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/code-metrics-audit &&
cp -R "$tmp/nexa-claude-audit/skills/code-metrics-audit" ~/.claude/skills/code-metrics-audit &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/code-metrics-audit` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/code-metrics-audit` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/nexadevapp/nexa-claude-skills-marketplace.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/code-metrics-audit &&
cp -R "$tmp/nexa-claude-audit/skills/code-metrics-audit" ~/.agents/skills/code-metrics-audit &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/code-metrics-audit` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/code-metrics-audit` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/nexadevapp/nexa-claude-skills-marketplace.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/code-metrics-audit &&
cp -R "$tmp/nexa-claude-audit/skills/code-metrics-audit" ~/.cursor/skills/code-metrics-audit &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/code-metrics-audit` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/nexadevapp/nexa-claude-skills-marketplace.git --path nexa-claude-audit/skills/code-metrics-audit
```

Or copy the folder to `~/.gemini/skills/code-metrics-audit` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/code-metrics-audit`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/nexadevapp/nexa-claude-skills-marketplace.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/code-metrics-audit &&
cp -R "$tmp/nexa-claude-audit/skills/code-metrics-audit" ~/.copilot/skills/code-metrics-audit &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/code-metrics-audit` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/nexadevapp/nexa-claude-skills-marketplace.git
```

Then copy `nexa-claude-skills-marketplace/nexa-claude-audit/skills/code-metrics-audit` into your agent's skills folder as `code-metrics-audit`. Agents that support SKILL.md read one folder per skill.

## FAQ

### What does the skill need to run?

It needs a repository and the ability to run ephemeral analysers such as uvx, npx or a Java JAR. If the runner is unavailable or the user declines, affected metrics are reported as not measured.

### Does Code metrics audit change my repository?

No. Analyser output goes to a temporary folder outside the repository, and the only file written is the dated markdown report under docs/audit/code-metrics-audit.

### When does Code metrics audit trigger?

Only when invoked explicitly with the /code-metrics-audit command. It is not inferred from ordinary user messages or run by other skills.

### Which languages are supported?

The skill states it works on any repository and tech stack. Lizard supports many languages, CK handles Java, and Go, Rust and other languages use source-based methods with their own limits.

### How do I install Code metrics audit in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/code-metrics-audit to use it in all your projects, or to .claude/skills/code-metrics-audit in one project. Or install the nexa-claude-audit plugin, which includes it: /plugin marketplace add nexadevapp/nexa-claude-skills-marketplace, then /plugin install nexa-claude-audit@nexa-claude-marketplace.

### Does Code metrics audit run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Code metrics audit?

Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.

### What are the best alternatives to Code metrics audit?

The closest alternatives to Code metrics audit are Code quality audit, QA audit, Skill audit, Test efficacy audit and Quality audit.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Code quality audit](https://ai-powered.com/skills/code-quality-audit): Code quality audit is an open-source agent skill for developer tools.
- [QA audit](https://ai-powered.com/skills/qa-audit): QA audit is an open-source agent skill for developer tools.
- [Skill audit](https://ai-powered.com/skills/skill-audit): Skill audit is an open-source agent skill for developer tools.
- [Test efficacy audit](https://ai-powered.com/skills/test-efficacy-audit): Test efficacy audit is an open-source agent skill for developer tools.
- [Quality audit](https://ai-powered.com/skills/quality-audit): Quality audit is an open-source agent skill for developer tools.
- [CLI audit](https://ai-powered.com/skills/cli-audit): CLI audit is an open-source agent skill for developer tools.
- [Mutation audit](https://ai-powered.com/skills/mutation-audit): Mutation audit is an open-source agent skill for developer tools.
- [Skill review](https://ai-powered.com/skills/skill-review): Skill review is an open-source agent skill for developer tools.

---
Source: https://ai-powered.com/skills/code-metrics-audit
