Test

From mbwsims/claude-universe · View interactive version

Test is an AI agent skill from the GitHub repository mbwsims/claude-universe. Use when the user wants new tests authored for a specific file, function, or module: "write tests", "add tests", "generate tests for", "test this function", "test this file", or "/test". This skill writes high-quality tests; it is not the default for running an existing test suite, debugging a faili

How to use this skill

Skill file

Test

Generate tests that catch real bugs. Runs autonomously — detects the framework, analyzes

the code, and writes the test file. No intermediate questions or planning steps.

Complements the superpowers TDD skill. If TDD discipline is active (red-green-refactor

cycle), defer to superpowers for the PROCESS of when to write vs. run vs. refactor. This

skill provides the CONTENT — what to test, how to assert, what edge cases to consider.

Workflow

Run all phases in sequence without stopping for user input.

1. Detect Context (silently)

Do all of this automatically without asking the user:

It returns the project's test framework, all test files mapped to source files, untested

source files ranked by criticality, and a coverage ratio. Use this data to skip manual

discovery and focus on what matters.

context (last file discussed, last file edited). If truly ambiguous, ask — but this

should be rare.

jest.config.*, pytest.ini, Cargo.toml), or existing test files. Match the project's

conventions (describe/it vs test, file naming, directory structure).

read it — build on what's there rather than starting from scratch.

it as the blueprint and implement every "must" and "should" row.

If no test framework exists at all, pick the standard one for the stack (vitest for

TypeScript, pytest for Python, go test for Go) and set it up.

Scope guard — framework setup: If you need to set up a test framework from scratch,

do only the minimum: install the package, create a minimal config file, verify it runs.

Do NOT refactor the project's build system, add CI configuration, or configure coverage

tools. Those are separate concerns. Write the tests and move on.

Fallback — no test runner available: If the test runner cannot be executed (e.g.,

missing dependencies, Docker-only environment, or CI-only test setup), write the test

file anyway and note at the end: "Tests written but not verified — run {command} to

execute." Do not block on runner availability.

2. Analyze the Code (internally)

Read the target and extract:

boundary, invalid, null, adversarial). Use references/input-space-analysis.md.

Use references/test-architecture.md.

file upload, webhooks, etc.

Do NOT present the analysis to the user or ask for confirmation. This is internal

reasoning that produces better tests. The user sees the output — the tests.

3. Write the Tests

Write the complete test file following these rules:

Assert VALUES, not existence.

Assert EFFECTS, not internals.

Test names are specifications.

Error tests are first-class. For every success path, write at least one corresponding

failure test. Assert specific error type AND message.

One behavior per test. Each test verifies one input-to-output mapping.

Consult references/assertion-depth.md for deep assertion patterns.

Organize the test file as: setup → happy path → error paths → edge cases → cleanup.

4. Write the File and Verify

Write the test file to the appropriate location (match the project's convention for test

file placement — co-located, __tests__/, or test/ directory).

Then run the tests:

# Detect and run the appropriate test command
npm test -- --run {test-file}  # or vitest run, pytest, go test, etc.

If tests fail due to implementation issues (not test issues), note what needs fixing.

If tests fail due to test issues, fix the tests.

Output

Write the test file directly. After writing, provide a brief summary:

Wrote {n} tests to {test-file-path}
  {n} happy path · {n} error paths · {n} edge cases
  {pass/fail status if tests were run}

No input space tables, no planning artifacts, no intermediate steps shown to the user

unless they asked for them (use /test-plan for that).

Guidelines

by reading the project.

should all match what the project already does.

key boundaries). Skip adversarial/combinatorial unless the code is security-critical

or user-facing.

Related Skills

Additional Resources

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.