Skip to content
Agentmart
Submit a tool

clean-crap

Measure JavaScript and TypeScript function complexity, join LCOV test coverage, compute CRAP scores, and gate delivery on a threshold.

Skill by pedrosatin

IndexedMIT
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/pedrosatin-clean-crap

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Measure JavaScript and TypeScript function complexity, join LCOV test coverage, compute CRAP scores, and gate delivery on a threshold. Use when running /clean-crap or as a deterministic complexity-and-coverage check before code review.

Use cases: testing

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Node.js package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/clean-crap

What's inside

Skill name
clean-crap
Description
Measure JavaScript and TypeScript function complexity, join LCOV test coverage, compute CRAP scores, and gate delivery on a threshold. Use when running /clean-crap or as a deterministic complexity-and-coverage check before code review.
License
MIT
Instructions
38 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (7)

  • .gitignore
  • SKILL.md
  • example.ts · fixtures/
  • package-lock.json
  • package.json
  • clean-crap.mjs · scripts/
  • cli.test.mjs · test/

SKILL.md (first lines)

# clean-crap

Run the bundled CLI against the target project. Install the skill-local dependency once, then run from any directory:

```sh
npm ci --prefix /path/to/skills/clean-crap
node /path/to/skills/clean-crap/scripts/clean-crap.mjs --root /path/to/project
```

Flags, coverage modes, threshold, positional path filters, and exit codes live in `node /path/to/skills/clean-crap/scripts/clean-crap.mjs --help`.

CRAP = complexity² × (1 − coverage)³ + complexity. Only entries with numeric CRAP gate; null-CRAP entries never fail.

## Parser

The TypeScript parser reports top-level functions, variable-assigned functions/arrows, and class methods/accessors/constructors/property arrows. Nested callbacks and local functions increment the enclosing entry; they are not separate report rows. Complexity starts at 1 and increments for each if, loop, catch, ternary, switch label including default, logical `&&`, `||`, `??`, and explicit `?.` operation.

Sources include `.ts`, `.tsx`, `.js`, `.jsx`, `.mts`, `.cts`, `.mjs`, and `.cjs`. Dependencies, generated output, declarations, test files, and `.worktrees/` copies are excluded by default.

## Coverage join

LCOV is discovered as `*.info` files under any directory named `coverage` below the root. Multiple files merge per source path; later files win on overlapping line and function records. `SF:` paths may be absolute, or relative to the directory that contains the `coverage` folder.

Per-entry coverage prefers `DA:` line records inside the entry's line range (covered lines / total instrumented lines in range). When the file has no DA records in range, it falls back to binary `FNDA:` function hit counts (exact name or last `.`/`#` segment match). Entries whose file has no LCOV section keep null coverage.

## Git selection

`--changed` limits analysis to files added, modified, untracked, or unmerged in git. The root must be inside a git repository. Deletions are excluded. Renamed files count under their new path. The filter intersects with positional path arguments.

`--since <revision>` selects files changed from the revision’s merge-base with HEAD through HEAD, plus current staged, unstaged, and untracked changes. Use it for committed delivery work and subsequent corrections. It excludes deletions, uses rename destinations, and intersects positional filters. Choose either `--since` or `--changed`.

## Report

The CLI writes `<root>/.metrics/crap.json`. `.metrics/` is a local untracked artifact: keep it ignored and never commit it.

Use the report to choose a small refactor, then run the project's existing tests and regenerate. Reduce CRAP by splitting complex functions or adding tests that exercise uncovered branches.

From pedrosatin/skills, MIT.

More from pedrosatin/skills

Signals

Stars
0
Forks
0
Open issues
0
Last commit (this folder)
Oct 12, 2026 (16 days ago)

From GitHub (fetched Oct 24, 2026).

Details

License
MIT
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from pedrosatin

Cite this page

clean-crap skill. Agent Mart. https://agentmart.dev/skills/pedrosatin-clean-crap (last updated 2026-10-24)