test-focus
FreeNo executable scriptsNot checkedOne test file, fail-fast — Playwright, Vitest, Jest, pytest, cargo, go test. Use when running a single spec file, headed/debug mode, or serial single-worker…
by laurigates★ 61 GitHub starsAbout this skill
When to Use This Skill
| Use this skill when... | Use test-run instead when... |
|---|---|
| Iterating on a single failing spec with fail-fast feedback | Running the full test suite for a project |
| Forcing serial execution for WebGL or shared-state tests | Running tests in watch mode across many files (use test-quick) |
| Running one test file in headed/debug mode | Triaging a directory of test results (use test-analyze) |
| Sub-30s feedback on a known-broken file | Choosing which tier to run (use test-tier-selection) |
Context
- Project files: !
find . -maxdepth 1 \( -name 'pyproject.toml' -o -name 'package.json' -o -name 'Cargo.toml' -o -name 'go.mod' \) - Playwright config: !
find . -maxdepth 1 -name 'playwright.config.*' - Vitest config: !
find . -maxdepth 1 \( -name 'vitest.config.*' -o -name 'vite.config.*' \) - Jest config: !
find . -maxdepth 1 -name 'jest.config.*' - Pytest config: !
find . -maxdepth 1 \( -name pyproject.toml -o -name setup.cfg \) -exec grep -l 'pytest' {} + - Package.json exists: !
find . -maxdepth 1 -name 'package.json' -type f
Parameters
$1(required): Test file path or pattern (e.g.,login.spec.ts,tests/e2e/auth.spec.ts)--serial: Force sequential execution with single worker (useful for WebGL, database tests)--debug: Run in debug/headed mode for visual debugging
Your task
Run a single test file in fail-fast mode for rapid development iteration. Stop immediately on first failure to minimize feedback time.
1. Detect test framework and construct command
Playwright (if playwright.config.* exists):
# Standard fail-fast
bunx playwright test "$FILE" --max-failures=1 --reporter=line
# With --serial (WebGL, shared state)
bunx playwright test "$FILE" --max-failures=1 --workers=1 --reporter=line
# With --debug
bunx playwright test "$FILE" --max-failures=1 --headed --debug
Vitest (if vitest.config.* or vite.config.* exists):
# Standard fail-fast
bunx vitest run "$FILE" --bail=1 --reporter=dot
# With --serial
bunx vitest run "$FILE" --bail=1 --pool=forks --poolOptions.threads.singleThread --reporter=dot
# With --debug
bunx vitest run "$FILE" --bail=1 --inspect-brk
Jest (if jest.config.* exists):
# Standard fail-fast
bunx jest "$FILE" --bail --silent
# With --serial
bunx jest "$FILE" --bail --runInBand --silent
# With --debug
bunx jest "$FILE" --bail --runInBand
pytest (Python projects):
# Standard fail-fast
python -m pytest "$FILE" -x -v --tb=short
# With --serial (already serial by default)
python -m pytest "$FILE" -x -v --tb=short
# With --debug
python -m pytest "$FILE" -x -v --tb=long -s
Cargo test (Rust projects):
# Standard fail-fast
cargo test --test "$FILE" -- --test-threads=1
# With --debug
cargo test --test "$FILE" -- --test-threads=1 --nocapture
Go test:
# Standard fail-fast
go test -v -failfast "$FILE"
# With --debug
go test -v -failfast "$FILE" -count=1
2. Execute the test
Run the constructed command. Capture and display output.
3. Analyze results
If the test passes:
[FILE]: PASSED
Duration: Xs
Ready for next iteration or file.
If the test fails:
[FILE]: FAILED (stopped at first failure)
Duration: Xs
First failure:
Test: [test name]
Error: [brief error message]
Location: [file:line]
Quick actions:
- Fix the issue and re-run: /test:focus [same file]
- Debug visually: /test:focus [file] --debug
- See full output: /test:run [file]
4. Provide rerun command
Always show the exact command to rerun:
Rerun: /test:focus $FILE
Time savings context
Focused testing dramatically reduces feedback time:
| Approach | Typical Duration | Use Case |
|---|---|---|
/test:focus |
2-30 seconds | Iterating on single file |
/test:quick |
30 seconds | Unit tests after changes |
/test:full |
5-30 minutes | Before commit/PR |
Agentic optimizations
| Context | Flags |
|---|---|
| Playwright fast | --max-failures=1 --reporter=line |
| Playwright WebGL | --max-failures=1 --workers=1 --reporter=line |
| Vitest fast | --bail=1 --reporter=dot |
| Jest fast | --bail --silent |
| pytest fast | -x -v --tb=short |
Error handling
- If file not found: List similar test files with
globand suggest corrections - If framework not detected: Show available package.json scripts containing "test"
- If test times out: Suggest
--serialflag or increasing timeout
Install test-focus in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
Bash(find *)Bash(bunx playwright test *)Bash(bunx vitest run *)Bash(bunx jest *)Bash(cargo test *)Bash(go test *)ReadGrepGlobTodoWriteFAQ
What does the test-focus skill do?
One test file, fail-fast — Playwright, Vitest, Jest, pytest, cargo, go test. Use when running a single spec file, headed/debug mode, or serial single-worker WebGL tests.
How do I install the test-focus skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the test-focus skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
by Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
by Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
by Anthropicmcp-integration
This 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…
by Anthropic