crap4clj

Compute CRAP scores for Clojure functions using cyclomatic complexity and test coverage.

34|4|Updated Feb 24, 2026
One-click install
npx skills add https://github.com/unclebob/crap4clj --skill crap4clj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: crap4clj
Source: https://github.com/unclebob/crap4clj/tree/main
Command: npx skills add https://github.com/unclebob/crap4clj --skill crap4clj

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

CRAP metrics help you identify functions that are both complex and under-tested by combining cyclomatic complexity with test coverage, enabling targeted risk remediation in Clojure projects.

Core Features & Use Cases

  • Compute and rank CRAP scores for defn/defn- forms across a codebase.
  • Read Cloverage-derived coverage data to blend with CC metrics.
  • Generate a sorted, actionable report that highlights highest-risk functions.

Quick Start

Run clj -M:crap to analyze all source files and generate a CRAP report.

Frequently Asked Questions about crap4clj

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I identify high-risk Clojure functions that are complex and under-tested?

To identify high-risk Clojure functions, compute CRAP scores by combining cyclomatic complexity with test coverage data. This highlights defn and defn- forms that carry the most risk, producing a prioritized report for targeted remediation.

Do I need Cloverage output to calculate CRAP scores for my codebase?

Yes, you need Cloverage output to calculate CRAP scores. The tool parses Cloverage-derived coverage data to blend with cyclomatic complexity metrics, applying the CRAP formula to generate a sorted risk report.

What is the best way to rank code quality risk in a Clojure project?

The best way to rank code quality risk is applying the CRAP formula across all defn and defn- forms. It combines cyclomatic complexity and test coverage into a descending report that highlights highest-risk functions.

How do I generate a CRAP report for a Clojure project?

To generate a CRAP report for a Clojure project, run clj -M:crap. This analyzes all source files, computes coverage and complexity metrics, and presents a descending report for remediation.

Can I use this to measure cyclomatic complexity for private functions in Clojure?

Yes, you can measure cyclomatic complexity for private functions. The analysis specifically targets both defn and defn- forms across the codebase to ensure private functions are included in the risk report.

Why does my CRAP score report show certain functions as high priority?

Your CRAP score report shows functions as high priority because they have high cyclomatic complexity combined with low test coverage. The CRAP formula mathematically penalizes untested complexity, sorting these functions to the top.