n0an

Swift Crap Check — Testing skill for Claude Code

Testing community

Agent skill that ranks Swift functions by the CRAP metric - cyclomatic complexity weighted against test coverage - and drives the risky ones under threshold.

How to install Swift Crap Check

This entry records only its repository, not the path inside it, so there is no exact command to give. Open n0an/swift-crap-check and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Swift Crap Check does

Agent skill that ranks Swift functions by the CRAP metric - cyclomatic complexity weighted against test coverage - and drives the risky ones under threshold. Install with npx skills add n0an/swift-crap-check.

Alternatives in Testing

  • Deslop Reborn — One iteration of the IronClaw Reborn de-slop loop — take ONE Reborn crate, fan out parallel review sub-agents 12.6k ★
  • AI Contribution Skills (Engram) — branch-pr: clean branch and PR workflow 2.5k ★
  • Add Plugin — Integrate a spec-driven/skill framework as a bundled agtx plugin 1.5k ★

README

Swift CRAP Check

CRAP metric Default threshold 6 SwiftLint or lizard llvm-cov coverage Version 1.0.0 MIT License Agent Skills Compatible

**📐 "Complex" is not actionable. "Dangerous to change" is.** Based on Robert C. Martin's (Uncle Bob) description of how he codes with agents ([interview, 2026](https://www.youtube.com/live/zcLPGC-tvgk)).

An agent skill that helps AI coding agents like Claude Code, Codex, Cursor, and Gemini find the Swift functions that are genuinely risky to modify, and then drive that risk down - by writing the missing tests or splitting the function, whichever the number says.

It uses the [Agent Skills](https://agentskills.io/home) format, so it works smoothly with Claude Code, Codex, Gemini, Cursor, and more.

CRAP (Change Risk Anti-Patterns, Agitar Software, 2007) weighs cyclomatic complexity against test coverage:

crap = complexity² × (1 − coverage)³ + complexity

The cube is the whole idea. A function of complexity 12 scores **156** with no tests and exactly **12** with full coverage. Same code, same complexity - but one of them you can refactor tonight and the other one will bite you. The metric does not say the code is bad, it says the code is *unsafe to touch*, and that is something an agent can actually act on.

   CRAP   CX     COV  LOCATION