ensure-test-coverage
БесплатноБез исполняемых скриптовНе проверенEnsure test coverage for a single evaluation - both reviewing existing tests and creating missing ones. Analyzes testable components, checks tests against…
от UKGovernmentBEIS★ 763 звезды на GitHubОб этом скилле
Ensure Test Coverage
Analyze a single evaluation's test coverage against repository testing conventions. This skill can both review existing tests and create missing ones.
Expected Arguments
When invoked, this skill expects:
- eval_name (required): The name of one or more evaluations to check (e.g.,
gpqa,healthbench)
If not provided, ask the user.
Workflow
Phase 1: Discover Testable Components
Analyze the eval's source code in src/inspect_evals/<eval_name>/ to build a complete inventory of what needs testing.
1.1 Scan for decorated functions
Use AST analysis or grep to find all functions decorated with:
@task- Task entry points (and their parameters/variants)@solver- Custom solvers@scorer- Custom scorers@tool- Custom tools
For each, record: function name, file path, line number, parameters.
1.2 Scan for dataset patterns
Look for:
record_to_samplefunctions (named exactly or as a lambda/callable passed tohf_dataset/csv_dataset/json_dataset)hf_dataset()orload_dataset()calls (indicates HuggingFace datasets)csv_dataset()orjson_dataset()calls- Dataset URLs or paths (for understanding data sources)
1.3 Scan for sandbox usage
Look for:
compose.yamlordocker-compose.yamlfiles in the eval'sdata/directorysandbox()calls in source codeSandboxEnvironmentSpecreferences
1.4 Scan for utility functions
Look for non-trivial helper functions that contain meaningful logic (not just thin wrappers). Functions with:
- Complex branching (if/elif chains)
- Data transformations
- String parsing/formatting
- Score calculations
- File I/O operations
1.5 Identify task variants
Check if the eval has multiple @task functions or a single task with parameters that create meaningfully different variants (e.g., different subsets, different Docker environments, different scorers).
Phase 2: Run Autolint and Measure Coverage
2.1 Run autolint
Run all autolint checks in one command to get a baseline of structural test coverage:
uv run inspect-evals-lint <eval_name>
This checks: tests_exist, tests_init, e2e_test, record_to_sample_test, custom_solver_tests, custom_scorer_tests, custom_tool_tests (plus non-test checks). You do not need to report to the user specific details of this beyond what the autolint tool itself tells them.
If autolint reports failures, those become Priority 1 items to fix in Phase 4.
2.2 Measure line coverage with pytest-cov
Run pytest-cov to get line-level coverage percentages. Include --runslow to run slow tests — they often exercise significantly more code:
uv run pytest tests/<eval_name>/ --cov=src/inspect_evals/<eval_name> --cov-report=term-missing -q --runslow
This shows per-file coverage and which specific lines are missed. Record:
- Overall coverage percentage
- Per-file coverage percentages
- Which lines are missed (the
Missingcolumn)
Read the source code for missed lines to understand what they do. Categorize them as:
- Testable: Logic that can be exercised with unit tests or mocked E2E tests (branches, calculations, parsing, error handling)
- Requires LLM/sandbox: Lines that only run with a real model response or Docker container (acceptable to miss in fast tests)
- Dead code or error handlers: Defensive code that's hard to trigger (lower priority)
There is no fixed coverage threshold. Instead, use judgment: all major branches and behaviors should have tests. Focus on whether important logic paths are exercised, not on hitting a number. When evaluating gaps, ask: "If this code path broke, would we catch it?" If the answer is no and the path contains meaningful logic (not just framework glue), it's a gap worth addressing. It is entirely plausible that some decently large gaps include the same code that is checked elsewhere, but if so, this should be justified to the user. Do not assume a gap is fine because testing it would be difficult - that likely indicates a gap in our ability to mock relevant entities for testing. Let the user decide what's worth doing.
Reference points from existing evals as of 13/02/2026:
gpqa(simple eval, 17 statements, no custom scorer/solver): 100% coveragehealthbench(complex eval, 317 statements, LLM-graded scorer): 91% overall with--runslow. The remaining gaps are the LLM judge call path — testing it would require mocking the judge model, which is valuable but not trivial. This likely requires a few new tests.gdm_self_reasoning(complex eval, 945 statements, Docker-heavy): 51% overall with--runslow. Most missed code is in solver files that only execute inside Docker sandboxes with real model interactions — these should be mocked with our utility functions, and if this is not possible that indicates a problem. This should be tested more thoroughly.
When evaluating gaps, ask: "If this code path broke, would we catch it?"
Установить ensure-test-coverage в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ensure-test-coverage?
Ensure test coverage for a single evaluation - both reviewing existing tests and creating missing ones. Analyzes testable components, checks tests against repository conventions, reports coverage gaps, and creates or improves tests. Use when user asks to check/review/create/add/ensure tests for an eval. Use whenever you are asked to review an evaluation that contains tests, or whenever you need to write a suite of tests. Do NOT use for fixing a specific failing CI test (use ci-maintenance-workflow instead).
Как установить скилл ensure-test-coverage?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ensure-test-coverage запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic