Agent skill

Crap Analyzer

by swingerman in swingerman/engineer

A skill your agent uses to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods.

MITAuto-check passedTesting & QA

Install Crap Analyzer

skills CLI
$ npx skills add swingerman/engineer --skill crap-analyzer -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install swingerman/engineer crap-analyzer --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/swingerman/engineer.git skills-src && mkdir -p .claude/skills && cp -r skills-src/crap-analyzer/skills/crap-analyzer .claude/skills/crap-analyzer && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
crap-analyzer
GitHub stars
154
Token cost
~1.2k tokens
SKILL.md length
480 words
Files
8 (incl. scripts, references)
Skills in repo
27
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods.

  • Works in 7 steps: Determine the diff. First that works → Locate or generate coverage. Let the… → Run the analyzer. → …
  • — /crap-analyzer
  • SKILL.md covers Workflow, Report format, Config file and When not to use this skill
  • Runs Python scripts from its folder; calls git, gh and python3

What it does

Crap Analyzer is an agent skill from swingerman/engineer. Use to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods. Multi-language — TypeScript, JavaScript, Python, Java, Kotlin, Go, Ruby, C, Rust, PHP — auto-discovers how the repo generates coverage. Triggers — "/crap-analyzer", "analyze CRAP", "compute CRAP", "find risky methods", "find complex untested methods".

Its SKILL.md is about 1.2k tokens, which your agent loads only when the skill is triggered. The skill folder holds 9 other files, including scripts and reference files (for example `references/coverage-discovery.md`, `references/refactor-patterns.md` and `references/script-reference.md`).

It sits in Testing & QA, covering Refactoring, Test generation and Android development. It works with C#, Java, JavaScript and Kotlin. The repository describes itself as: Disciplined Agentic Engineering — a methodology kit for Claude Code: acceptance-test-first specs, explicit checkpoints, and autonomy you can actually leave running. The engineer… The licence is MIT.

When your agent uses it

  • — /crap-analyzer
  • Find risky methods
  • Find complex untested methods

Example prompts

  • “/crap-analyzer”
  • “analyze CRAP”
  • “compute CRAP”
  • “/crap-analyzer”

Requirements

  • Python 3

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Determine the diff. First that works
  2. Locate or generate coverage. Let the script auto-discover coverage files first (lcov, Cobertura, JaCoCo, Clover, Go coverage.out…
  3. Run the analyzer.
  4. Present the report. Show the markdown table. For each finding, link file:start_line. If more than ~8 findings, surface the top 5 and…
  5. Propose fixes per finding, worst-first. For each function above threshold
  6. Present the wrap-up menu. Dispatch refactor / test-stub work via AskUserQuestion. Menu structure and apply loop…
  7. Never auto-apply

What it can do on your machine

Read from SKILL.md and the folder at commit 32947eb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • git
    • gh
    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use git and gh, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Crap Analyzer loads about 1.2k tokens when it runs, and up to ~10k if it reads all its reference files. Until then it costs about 106 tokens; SKILL.md has 480 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~106
When it runs · the whole SKILL.md, loaded when a task matches
~1.2k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~10k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from swingerman/engineer at commit 32947eb, republished under its MIT licence (© swingerman). 480 words, ~1,190 tokens.

Download SKILL.mdSave it as .claude/skills/crap-analyzer/SKILL.md (or your agent's skills folder). This skill also uses 7 other files; get the full folder from GitHub.
name
crap-analyzer
description
Use to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods. Multi-language — TypeScript, JavaScript, Python, Java, Kotlin, Go, Ruby, C#, Rust, PHP — auto-discovers how the repo generates coverage. Triggers — "/crap-analyzer", "analyze CRAP", "compute CRAP", "find risky methods", "find complex untested methods".

CRAP Analyzer

CRAP (Change Risk Anti-Patterns) flags functions that are both complex and poorly tested — the worst-risk code to ship.

CRAP(m) = comp(m)² × (1 − cov(m))³ + comp(m)

This skill scopes analysis to a diff, ranks findings worst-first, and turns each finding into a concrete refactor + test-stub proposal.

Workflow

  1. Determine the diff. First that works:

    • gh pr diff / gh pr diff <number> if a GitHub PR is referenced.
    • git diff --merge-base <main-branch> — detect the main branch with git remote show origin | grep 'HEAD branch'.
    • git diff --cached for staged changes.
    • git diff HEAD~N..HEAD for a named commit range.
    • Explicit file list if the user names files.

    Pipe the diff to scripts/compute_crap.py --diff -.

  2. Locate or generate coverage. Let the script auto-discover coverage files first (lcov, Cobertura, JaCoCo, Clover, Go coverage.out, coverage.py JSON). If nothing is found, follow references/coverage-discovery.md to detect the toolchain, then ask before running it. On decline, proceed with coverage=0% and flag it in the report header.

  3. Run the analyzer.

    bash
    python3 <skill-dir>/scripts/compute_crap.py --diff - --repo-root <repo> --threshold <N> --format both

    Default threshold is 20. Read .crap-analyzer.json at repo root if present and pass its threshold through. Full flag list and output JSON shape: references/script-reference.md.

  4. Present the report. Show the markdown table. For each finding, link file:start_line. If more than ~8 findings, surface the top 5 and mention the rest.

  5. Propose fixes per finding, worst-first. For each function above threshold:

    • Read the function. Score alone is not enough — look at the code.
    • Refactor proposal. Extract-method diff or guard-clause rewrite. Patterns: references/refactor-patterns.md.
    • Test stubs. Cover each uncovered branch in the repo's test framework. Templates: references/test-stub-templates.md.
    • Respect codebase conventions. Read nearby code and match naming, error handling, DI, async patterns.

    When len(findings) >= 3, dispatch one subagent per finding in a single message — per-finding work is independent so parallelizing drops wall-clock from O(n) to O(1). Prompt template + aggregation rules: references/subagent-prompt.md. After subagents return, sort by CRAP descending and sanity-check every "safe to auto-apply" claim against step 7.

  6. Present the wrap-up menu. Dispatch refactor / test-stub work via AskUserQuestion. Menu structure and apply loop: references/wrap-up-menu.md. "Safe refactor" = pure extract-method with no behavior change (same inputs → same outputs, same side effects, same order). One Edit per action; confirm each before applying.

  7. Never auto-apply:

    • Changes that reorder side effects or async operations (await, .then, subscribe, promise chains, RxJS / coroutine / goroutine ordering).
    • Changes to constructors, initializers, or lifecycle hooks.
    • Changes to reactive / stream operator ordering.
    • Template / markup / view changes — the script doesn't analyze those.
Show full SKILL.md (85 more words)Show less

Report format

markdown
### 1. `file.py:42` — `do_thing` (CRAP 240)

**Why it's flagged:** complexity 15, coverage 0% (no tests touching body).

**Refactor proposal:**
<unified diff or code block>

**Test stubs to add:**
<framework-appropriate test block>

Keep each section tight — one paragraph of "why", diff, stubs. No preamble.

Config file

Optional .crap-analyzer.json at repo root:

json
{ "threshold": 20 }

Read if present, pass --threshold to the script. No other keys for now.

When not to use this skill

  • Analyzing a full codebase unprompted — scope is diff-only by design.
  • Running as a blocking gate in CI — this is a Claude-driven review, not a deterministic check.
  • Files the script doesn't recognize. Supported extensions listed in references/script-reference.md; binaries, generated code, and config files are skipped automatically.

© swingerman, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 7 other files (scripts, references) in crap-analyzer/skills/crap-analyzer of swingerman/engineer.

  • SKILL.md
  • references/coverage-discovery.md
  • references/refactor-patterns.md
  • references/script-reference.md
  • references/subagent-prompt.md
  • references/test-stub-templates.md
  • references/wrap-up-menu.md
  • scripts/compute_crap.py

Open the folder on GitHubat commit 32947eb

Compare with similar skills

Crap Analyzer next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Crap Analyzer compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Crap Analyzer this skillswingerman/engineer154—~1.2kAutomated safety check: PassMIT
Code Revieweralirezarezvani/claude-skills28k1 repos~1.6kAutomated safety check: PassMIT
Find Untested Sourcesdotnet/skills5.6k1 repos~3.3kAutomated safety check: PassMIT
Selenium Skillsickn33/agentic-awesome-skills47k1 repos~2.4kAutomated safety check: PassMIT
Polyglot Test Agentboshi-xixixi/TraeSkill274—~1.7kAutomated safety check: PassMIT
Build Teaql Appteaql/teaql-agent-kit2.8k—~4.6kAutomated safety check: PassMIT

Similar skills

  • Code Reviewer

    alirezarezvani/claude-skills

    Code review automation for TypeScript, JavaScript, Python, Go, Swift, Kotlin, C, .NET, Java, C, C++, Rust, Ruby, PHP, and Dart/Flutter.

    28k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Official

    Statically pairs source files with test files to list code that no test references, using Roslyn for C# or tree-sitter for many languages, with no build.

    5.6k GitHub starsUsed in 1 repo~3.3k tokens
    Testing & QAAuto-check passed
  • Selenium Skill

    sickn33/agentic-awesome-skills

    Generates production-grade Selenium WebDriver automation scripts and tests in Java, Python, JavaScript, C, Ruby, or PHP.

    47k GitHub starsUsed in 1 repo~2.4k tokens
    Testing & QAAuto-check passed
  • Polyglot Test Agent

    boshi-xixixi/TraeSkill

    Generates comprehensive, workable unit tests for any programming language using a multi-agent pipeline.

    274 GitHub stars~1.7k tokensUpdated 4 mo ago
    Testing & QAAuto-check passed
  • Build Teaql App

    teaql/teaql-agent-kit

    Build or change a TeaQL application in Java, Rust, Go, Swift, Python, C/.NET, or TypeScript, including Kotlin/JVM applications that consume Java-generated libraries.

    2.8k GitHub stars~4.6k tokensUpdated 10 days ago
    MobileAuto-check passed
  • Run profile-driven bottleneck optimization across Apache Fory implementations (Java, C++, Python/Cython, Go, Rust, Swift, C, JavaScript/TypeScript, Dart, Kotlin, Scala).

    4.6k GitHub stars~2.2k tokensUpdated today
    MobileAuto-check passed

More from swingerman/engineer

All 27 skills in this repo
  • Atdd Mutate

    swingerman/engineer

    A skill your agent uses to add a third validation layer to the ATDD workflow — after acceptance tests verify WHAT and unit tests verify HOW, mutation testing verifies the tests actually catch bugs.

    154 GitHub stars~2.7k tokensUpdated 14 days ago
    Auto-check passed
  • Fix

    swingerman/engineer

    A skill your agent uses to drive a bug fix from first report through close, with a "why didn't we catch it?" loop at the end.

    154 GitHub stars~3k tokensUpdated 14 days ago
    Auto-check passed
  • Atdd

    swingerman/engineer

    A skill your agent uses to drive feature work through the Acceptance Test Driven Development workflow — Given/When/Then specs before code, a project-specific test pipeline, and two parallel test…

    154 GitHub stars~2.8k tokensUpdated 14 days ago
    Auto-check passed
  • Harden

    swingerman/engineer

    Use after a feature passes Light Verify (CP7), to prove the tests actually catch bugs and, where the code warrants it, to formally check its invariants — Checkpoint 8.

    154 GitHub stars~1.8k tokensUpdated 14 days ago
    Auto-check passed
  • Next

    swingerman/engineer

    Use at the start of a work session, or any time the question is "what should I pick up now" across the whole project.

    154 GitHub stars~3k tokensUpdated 14 days ago
    Auto-check passed
  • Post Merge

    swingerman/engineer

    Use immediately after a PR is merged to clean up the local feature branch and resync main.

    154 GitHub stars~1.4k tokensUpdated 14 days ago
    Auto-check passed

Questions about Crap Analyzer

What does Crap Analyzer do?

A skill your agent uses to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods. Crap Analyzer is an agent skill from swingerman/engineer. Use to produce a risk-based refactor + test plan for recently-changed code on a diff/branch/PR by computing CRAP (complexity × untested) on changed methods.

When should I use Crap Analyzer?

Crap Analyzer fits situations like: — /crap-analyzer; find risky methods; find complex untested methods.

How do I install Crap Analyzer in Claude Code?

Run `npx skills add swingerman/engineer --skill crap-analyzer -a claude-code`. Or copy the skill folder (crap-analyzer/skills/crap-analyzer in swingerman/engineer) into .claude/skills/crap-analyzer in your project. Claude Code loads it when a task matches its description.

How do I install Crap Analyzer in Codex?

Run `npx skills add swingerman/engineer --skill crap-analyzer -a codex`. Or copy the skill folder (crap-analyzer/skills/crap-analyzer in swingerman/engineer) into .agents/skills/crap-analyzer in your project. Codex loads it when a task matches its description.

Can I use Crap Analyzer in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add swingerman/engineer --skill crap-analyzer -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/crap-analyzer, .gemini/skills/crap-analyzer, .github/skills/crap-analyzer and .opencode/skills/crap-analyzer in your project.

What does Crap Analyzer need to run?

Going by SKILL.md and its folder, Crap Analyzer needs Python for the scripts in its folder and the command-line tools its instructions call (git, gh and python3). Our summary lists: Python 3.

Does Crap Analyzer access the network?

SKILL.md contains no URLs. Its commands use git and gh, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Crap Analyzer safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Crap Analyzer use?

Crap Analyzer is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Crap Analyzer use?

About 1.2k tokens (SKILL.md is roughly 4.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 9.2k tokens, read only when the agent opens those files.

What are the alternatives to Crap Analyzer?

Skills that share tags, products or a category with Crap Analyzer: Code Reviewer (alirezarezvani/claude-skills, 28k stars), Find Untested Sources (dotnet/skills, 5.6k stars), Selenium Skill (sickn33/agentic-awesome-skills, 47k stars) and Polyglot Test Agent (boshi-xixixi/TraeSkill, 274 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Crap Analyzer?

swingerman (a GitHub user) maintains it in swingerman/engineer, which has 154 GitHub stars. The repository holds 27 skills in this directory. The repository was last updated on September 23, 2026.

Source: swingerman/engineer on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.