# code-analyzer

code-analyzer measures cyclomatic complexity, lines of code, maintainability and duplicates, then points at the files worth touching first.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 138 installs · ★ 45 repo stars
- Author: oimiragieo
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/oimiragieo/agent-studio/tree/HEAD/.claude/skills/code-analyzer/SKILL.md
- Updated: 2026-07-14
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/code-analyzer

## What it does

The skill runs a static pass over a repository and reports cyclomatic complexity, lines of code, a maintainability index and duplicated blocks. The work happens through one Node script kept in the project at `.claude/tools/analysis/project-analyzer/analyzer.mjs`, driven by Bash; files are read with Read, Glob and Grep. Actions are split by job: `analyze-file` and `analyze-project` for scope, `complexity`, `loc`, `cyclomatic`, `maintainability` and `duplicates` for numbers, `summary`, `hotspots` and `trends` on top.

Start project-wide, narrow down to hotspots, and only then refactor or add tests. It is built to sit beside `code-reviewer` and `c4-code` as primary partners, with `developer` and `qa` in support; a pre-commit or CI gate goes through `project-analyzer/doctor`. Results are meant to land in `.claude/context/memory/learnings.md`, `issues.md` and `decisions.md`.

You need Node.js v18+ and the analyzer script present in the project, since that is what gets called. On thresholds the skill is blunt: keep the ESLint `complexity` rule at 15 or below and never let it pass 20. A one-off snapshot tells you little, so the trend across runs is the number that counts.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill code-analyzer -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/code-analyzer/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/code-analyzer/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill code-analyzer -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/code-analyzer/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill code-analyzer -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/code-analyzer/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install oimiragieo/agent-studio .claude/skills/code-analyzer
```

2. **Manually: put the files in place**
- File: `.github/skills/code-analyzer/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill code-analyzer -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/oimiragieo/agent-studio --path .claude/skills/code-analyzer
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/code-analyzer/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add oimiragieo/agent-studio --skill code-analyzer -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/oimiragieo/agent-studio/tree/HEAD/.claude/skills/code-analyzer/SKILL.md

## When to use it
- find the most tangled files before a refactor
- get LOC and maintainability figures for the whole repo
- spot duplicated blocks across the codebase
- catch complexity creeping up between runs
- add a complexity gate to pre-commit or CI

## Example prompts
- Analyze the whole project and list the complexity hotspots.
- Run the cyclomatic check on `src/parser.ts` and tell me what to simplify.
- Compare this week's metrics with the last run and flag what got worse.

## Similar
- [smell](https://affpapa.org/en/nevibecode/skills/smell.md) — skill · 862 installs
- [rust-symbol-analyzer](https://affpapa.org/en/nevibecode/skills/rust-symbol-analyzer.md) — skill · 3500 installs
- [tldr-router](https://affpapa.org/en/nevibecode/skills/tldr-router.md) — skill · 480 installs
- [callidescope-trace](https://affpapa.org/en/nevibecode/skills/callidescope-trace.md) — skill · 361 installs
- [vanity-engineering-review](https://affpapa.org/en/nevibecode/skills/vanity-engineering-review.md) — skill · 3400 installs
- [thinking-via-negativa](https://affpapa.org/en/nevibecode/skills/thinking-via-negativa.md) — skill · 665 installs

From the same set: [oimiragieo/agent-studio](https://affpapa.org/en/nevibecode/by/oimiragieo/agent-studio.md) — 8 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
