dist/claude/plugins/dev-flow/skills/improving-tests/SKILL.md
Improve test design, speed, and coverage with behavior-focused tests, useful seams, characterization tests, TDD, and test refactoring. Use when improving tests, optimizing slow suites, adding coverage, refactoring brittle tests, removing test waste, or working test-first. NOT for fixing production bugs (use fixing-code), production-code refactors (use refactoring-code), or reviewing non-test code quality (use reviewing-code).
npx skillsauth add alexei-led/claude-code-config improving-testsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Follow the base skill. This Claude overlay only defines tool use and execution details.
Improve tests through public behavior seams. Treat suite latency as a quality attribute. Do not inflate coverage with low-value assertions. Do not change production behavior unless the selected TDD slice requires it.
Detect capability from tools:
Use an interactive question tool when available for mode selection, missing scope, missing framework approval, or unsafe test-stack choices.
Do not use this for:
fixing-coderefactoring-codereviewing-codebrowser-automationDetect languages from files in scope and read only the matching reference:
references/csharp.mdreferences/go.md; for slow-suite or feedback-loop work, also read references/go-performance.mdreferences/java-kotlin.mdreferences/python.md; for slow-suite or feedback-loop work, also read references/python-performance.mdreferences/typescript.md; for slow-suite or feedback-loop work, also read references/typescript-performance.mdreferences/rust.mdreferences/web.mdUse generic rules only for unsupported languages.
review: find weak, duplicate, brittle, missing, slow, or flaky testsrefactor: simplify tests without changing covered behaviorcoverage: add tests for uncovered business behavior or error pathstdd: one red-green-refactor slice at a timeperformance: measure test latency and remove speed waste without weakening behaviorfull: review, refactor, performance, and add coverageIf mode is missing, ask one question with these options.
Test through the contract that users or adjacent modules rely on:
Use graph tools only when available and when they help choose the seam or risk:
For performance mode or any slow-suite work:
Prefer focused deterministic checks during edits and the broader relevant suite before final output. Do not hide failures, delete edge cases, or skip important fast tests to make a number look better.
TDD:
Characterization tests:
Look for:
Prefer each language's table-driven or parameterized pattern from references/<lang>.md when cases share setup and assertions. Do not force consolidation when separate tests make distinct behavior clearer.
Run the relevant project command after changes, for example pytest -q --maxfail=1 --tb=short. Exact commands per language live in references/<lang>.md.
Use coverage commands only when coverage mode or review needs them. Report skipped checks with exact reasons.
Engineer:
TEST IMPROVEMENT COMPLETE
=========================
Mode: review | refactor | coverage | tdd | performance | full
Tests changed: N
Waste removed: N
Coverage: before → after | not measured
Performance: baseline → after | not measured
Status: CLEAN | NEEDS ATTENTION
Key improvements:
- path:line — change
Verification:
- <command> — pass/fail/skipped with reason
Reviewer or blocked:
## Proposed Changes | BLOCKED
Blocker:
- <missing artifact, framework, tool, permission, or safe seam>
### Change 1: <brief description>
File: `path/to/test_file`
Action: CREATE | MODIFY | DELETE
Code: <complete test code or changed region with enough context>
Rationale: <weak, missing, brittle, slow, or duplicate test this fixes>
Verification: <command the applier should run>
If no test framework exists, ask before adding one. Do not claim clean without a passing check or an explicit skipped-check reason.
review: find weak, duplicate, brittle, missing, slow, or flaky tests.refactor: simplify tests without changing covered behavior.coverage: add useful tests for uncovered business behavior or error paths.tdd: one red-green-refactor slice at a time.performance: measure slow tests and remove speed waste without weakening behavior.full: review, refactor, performance, and add coverage.If mode is missing, use AskUserQuestion with those options. Ask before adding a
new test framework.
Use TaskCreate and TaskUpdate when the session has more than two steps:
Read, Grep, Glob, and LS to find tests, fixtures, helpers, and nearby patterns.performance mode or slow-suite work, also load the matching references/<language>-performance.md when present.Edit for existing tests and Write only for new files.Use direct reads/search for small scopes. Spawn read-only agents only for broad or mixed-language audits.
Use only commands supported by the repo and available tools. Examples:
go test ./pkg -run TestName
go test ./...
go tool cover -func=/tmp/coverage.out
golangci-lint run ./...
vitest run path/to/file.test.ts
jest path/to/file.test.ts --runInBand
pytest -q --maxfail=1 --tb=short
pytest -q --durations=10 --durations-min=0.5
uv run pytest -q --maxfail=1 --tb=short
bun test
bun run tsc --noEmit
npm test
npx playwright test --list
bunx playwright test --list
If a referenced command is unavailable, report it as skipped with the exact reason. Do not install a test framework or tool without user approval.
For tdd, write one failing test for one behavior, confirm it fails for the expected
reason, implement the smallest passing code, then refactor only while green. Do not
write a bulk suite for imagined future behavior.
it.each consolidation when separate tests make distinct behavior clearer.BLOCKED or Proposed Changes.tools
Use when planning, executing, checkpointing, finishing, or inspecting lightweight spec-driven work. Runs one task at a time using `.spec/` markdown files and the bundled `specctl` helper. NOT for broad product discovery beyond a short requirement interview. NOT for generic implementation planning that does not read or write `.spec/` files.
development
Simple web development with HTML, CSS, JS, and HTMX. Use when working with .html, .css, or .htmx files, web templates, stylesheets, or vanilla JS scripts. NOT for React/Vue/Angular (use writing-typescript) or Node.js backends.
tools
Idiomatic TypeScript development. Use when writing TypeScript code, Node.js services, React apps, or TypeScript design advice. Emphasizes strict typing, boundary validation, composition, fast feedback, behavior tests, and project-configured tooling. NOT for Go, Python, Rust, plain HTML/CSS/JS, or server-rendered templates (use writing-web).
tools
Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`, `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, CI `run:` shell bodies, or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python, Rust, TypeScript, Go, web code, or GitHub Actions workflow/job/permissions semantics; use operating-infra.