java-coverage
Measure backend test coverage from the terminal — JaCoCo line coverage reported as the exact uncovered lines, and PIT mutation coverage reported as the…
от victorrentea★ 17 звёзд на GitHub
Установить java-coverage в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Java coverage
Two scripts in this skill's own scripts/ — spell the path from the repo root, since the
repo has an unrelated scripts/ of its own. Both run from anywhere in the repo and print
only the gaps, as clickable File.java:12-15,20 refs.
Line coverage — what never ran
.claude/skills/java-coverage/scripts/coverage.sh # full run, uncovered lines per class
.claude/skills/java-coverage/scripts/coverage.sh -n # reuse the last run, don't re-run tests
.claude/skills/java-coverage/scripts/coverage.sh -c OwnerMapper -b # one class, incl. half-covered branches
JaCoCo is already wired in petclinic-backend/pom.xml (agent + report bound to the test
phase), so a plain mvn test writes the very report IntelliJ's "Run with Coverage" shows:
target/site/jacoco/index.html. coverage.sh drives that same mvn test and reduces the
jacoco.xml beside it — it adds the gap extraction, not the instrumentation.
Mutation coverage — what ran but nothing asserted on
.claude/skills/java-coverage/scripts/mutation.sh rest.error # a package (seconds)
.claude/skills/java-coverage/scripts/mutation.sh ValidationErrorExtractor # a class, by simple name
.claude/skills/java-coverage/scripts/mutation.sh # everything — minutes, avoid
mutation.sh is self-contained: PIT is not in pom.xml. The script resolves the PIT
jars from a throwaway POM under target/pit-work/ and drives PIT's command-line entry
point against the module's compiled classes — so nothing in the project changes, and
mvn test / CI never pay for mutation testing. Keep it that way; do not add
pitest-maven to the POM.
PIT is slow: always pass a scope. A package took ~10s, the whole base package takes
minutes. By default only the scope's own tests may kill its mutants; -T lets the whole
suite try (truer score, much slower). --help for the rest.
Reading the output: SURVIVED = a test executed that line but asserted nothing that the
mutation broke. NEVER REACHED = no test touches it at all — that is a line-coverage
hole, fix it with a test before worrying about the mutant.
Rules
- Never
mvn testwhile the IDE is building or running tests. Both writetarget/classes; the collision fakesNoClassDefFoundErrorand "Unable to find @SpringBootConfiguration" failures that look like real bugs. - A subset run gives partial coverage —
coverage.sh -t/--test, or a baremvn test -Dtest=.... Everything the subset never loads reads as 0%, so the numbers look falsely low.coverage.shlabels such a runPARTIAL— repeat that label when reporting. - Report the numbers and the gaps. Do not propose a test for every gap: hand-written
accessors and
equals/hashCode/toStringare noise, andcoverage.shalready filters them (--keep-generatedto see them).
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- scripts/coverage.sh
- scripts/mutation.sh
FAQ
Что делает скилл java-coverage?
Measure backend test coverage from the terminal — JaCoCo line coverage reported as the exact uncovered lines, and PIT mutation coverage reported as the surviving mutants. Use whenever asked about test coverage, "what isn't tested", "run tests with coverage", uncovered/untested lines or branches, how good the tests are, mutation testing / pitest, or before adding tests to a class — instead of asking the user to click "Run with Coverage" in IntelliJ.
Как установить скилл java-coverage?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл java-coverage запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…