create-test

Use when user wants to create tests, generate test coverage, audit test quality, find untested code, or improve weak assertions. Use when user says write tests, test coverage, missing tests, or untested code.

Best use case

create-test is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Use when user wants to create tests, generate test coverage, audit test quality, find untested code, or improve weak assertions. Use when user says write tests, test coverage, missing tests, or untested code.

Teams using create-test should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/create-test/SKILL.md --create-dirs "https://raw.githubusercontent.com/reidemeister94/development-skills/main/skills/create-test/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/create-test/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How create-test Compares

Feature / Agentcreate-testStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Use when user wants to create tests, generate test coverage, audit test quality, find untested code, or improve weak assertions. Use when user says write tests, test coverage, missing tests, or untested code.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

Related Guides

SKILL.md Source

# Create Test — Intelligent Test Design

ultrathink

Apply [Iron Rules](../../shared/iron-rules.md) — Principle 3 (simplicity: plain pytest before any library; refactor measurably improves a named dimension), Principle 7 (TDD Red → Green → Refactor — tests must find bugs, not just exist), and Principle 8 (no claim without fresh test output).

## Rules (apply to ALL modes)

- **Simplicity first.** Use the simplest approach that catches the bug. Plain pytest + assert before any library. Add a dependency only when the concept cannot be expressed without it.
- **Tests must find bugs, not just exist.** Every test must target a specific failure mode.
- **Test through the public API.** Do not test private/internal functions directly.
- **Strong assertions only.** Never generate `assertNotNull(x)` as sole assertion. Assert specific values, shapes, invariants.
- **Random data over fixed data.** Prefer property-based tests over hardcoded cases. Fixed cases only for boundary values.
- **Fast by default.** Property tests: 100 examples. Parametrize, don't duplicate.
- **Run every test you write.** Never present tests as done without executing them.
- **Never modify source code.** Only create/modify test files, conftest, and fixtures.
- **Match project conventions.** Use existing test directory, naming, markers, fixture patterns.

## Argument Routing

Parse `$ARGUMENTS`:

1. **No arguments** → **Mode A: Strategic Analysis** of the full project
2. **Arguments resolve to existing file(s) or directory** → **Mode B: Targeted Generation** for those paths
3. **Arguments are natural language** (not a valid path) → **Mode A: Strategic Analysis** with `$ARGUMENTS` as the goal. Analysis and recommendations are directed toward achieving that goal.

To distinguish case 2 from 3: use Glob/Bash to check if `$ARGUMENTS` matches existing paths. If yes → Mode B. If no → Mode A with goal.

---

## Mode A: Strategic Analysis

Read `references/explorer-prompt.md`. Spawn an analysis subagent (Agent tool) with its contents as the prompt.

If `$ARGUMENTS` contains a goal (case 3 above), append to the subagent prompt:

```
## USER GOAL
"$ARGUMENTS"
Focus your analysis and recommendations on what is most relevant to this goal.
Prioritize strategies that directly serve this objective.
Explain WHY each recommendation helps achieve the goal.
```

After the subagent returns, display the full analysis inline to the user.

The user will either:
- Select items by number or priority level → run **Mode B** for each selected item
- Ask a follow-up question → answer using the analysis context
- Say "skip" → end

---

## Mode B: Targeted Generation

Read `references/testing-strategies.md` now. Keep its principles active throughout.

### Step 0: Verify Test Infrastructure

1. Identify project language from config files (pyproject.toml, package.json, pom.xml, build.gradle, Package.swift)
2. Check test framework is installed and configured:
   - Python: pytest in requirements/pyproject.toml, `tests/` or `test/` directory
   - TypeScript: vitest/jest in package.json, test script defined
   - Java: JUnit in pom.xml/build.gradle, `src/test/` exists
   - Swift: XCTest/swift-testing target in Package.swift
3. If test framework **missing**: stop and ask — "No test framework detected. Should I set up [pytest/vitest/JUnit] first?"
4. If test directory **missing**: create it following language conventions

### Step 1: Read and Understand

1. Read the target file completely
2. If a directory, read all source files in it
3. Read the **relevant language section** from `references/language-templates.md` (Python, Java, TypeScript, or Swift — not the entire file)
4. For **Python** projects, also consult `../python-dev/patterns.md` (Testing section) for team-canonical patterns: the 4-tier layout (Unit / Golden / E2E Replay / Integration), `asyncio_mode="auto"`, `TestClient(raise_server_exceptions=False)`, autouse `dependency_overrides` reset, and `MagicMock(spec=Class)` + `AsyncMock` conventions.

### Step 2: Implementation Analysis

For each public function/method/endpoint:

**Boundaries:** numeric comparisons → extract thresholds, test N-1/N/N+1. String length limits, array sizes, enum ranges. Type coercion points (int/float, null).

**State space:** if/else chains, switch/match, state machines. Focus on fragile states: error paths, fallbacks, retry, timeout. Which states are NOT reachable from current tests?

**Invariants:** round-trip, idempotence, monotonicity, ordering preservation. Can a simpler reference implementation verify the result? Do aggregation totals match?

**API surface** (endpoints): request/response schemas, status code branches, CRUD lifecycle, error formats.

### Step 3: Strategy Selection

Refer to `references/testing-strategies.md` strategy matrix to select strategies.

If the target involves **refactoring**, also read `references/refactoring-workflow.md`.
If the target involves **regression detection infrastructure**, also read `references/regression-detection.md`.
If the user asks for **TDD / red-green-refactor / test-first**, read `references/tdd-workflow.md` for the vertical-slice loop and "no horizontal slicing" anti-pattern.

| Code characteristic | Primary strategy | Secondary | Reference |
|-------------------|-----------------|-----------|-----------|
| Numeric thresholds | Boundary stress | Property-based | testing-strategies.md #1 |
| Data transformation | Property-based (round-trip, invariant) | Boundary | testing-strategies.md #2 |
| Parser / serializer | Fuzz + property-based | Boundary | testing-strategies.md #2 |
| API endpoint (read) | Golden fixture regression | Boundary | testing-strategies.md #4 |
| API endpoint (write) | CRUD lifecycle | Golden fixture | testing-strategies.md #5 |
| State machine | State transition coverage | Boundary | testing-strategies.md #1 |
| Algorithm / computation | Invariant (reference impl) | Property-based | testing-strategies.md #3 |
| Pure function, few params | Boundary exhaustive | — | testing-strategies.md #1 |
| DB queries / repositories | Real DB integration | Factory fixtures | integration-patterns.md |
| Browser UI / user flows | Playwright E2E | Visual regression | e2e-browser-patterns.md |
| Legacy code, pre-refactoring | Characterization (golden master) | Approval test | refactoring-workflow.md |
| Concurrent / async operations | Concurrency stress | Property-based | testing-strategies.md #10 |
| Microservice boundary | Contract test (Pact) | CRUD lifecycle | testing-strategies.md #11 |
| DB migrations | Up/down verification | Rollback test | integration-patterns.md |
| Migration legacy to new | Live comparison | Characterization | testing-strategies.md #6 |

### Step 4: Generate Tests

Generate the test file. For each test function:

1. **Descriptive name** — describes behavior, not method name
2. **AAA structure** — Arrange, Act, Assert (clearly separated)
3. **Strong assertions** — specific values, check `references/weak-assertion-patterns.md`
4. **Boundary tests** — N-1, N, N+1 at every threshold
5. **Property-based tests** — for data transformations (hypothesis, jqwik, fast-check)
6. **Random stress tests** — for complex logic, verify invariants over many iterations
7. **Error path tests** — invalid inputs, null/empty, type mismatches

For golden fixture / e2e patterns, generate BOTH the capture script and the regression test.

**Apply reference patterns by type:**
- DB integration → `references/integration-patterns.md`
- Playwright E2E → `references/e2e-browser-patterns.md`
- Characterization → `references/refactoring-workflow.md`
- Concurrency → `references/testing-strategies.md` #10 + `references/language-templates.md`
- Contract → `references/language-templates.md` Pact scaffolds

### Step 5: Run and Verify

1. Run generated tests with project's test command
2. Read output completely
3. If tests fail: fix the TEST (not source code), re-run
4. **Mutation check** — for each critical assertion:
   - Temporarily change expected value to something wrong
   - Run test — confirm it FAILS
   - Restore correct assertion
   - If test passes with wrong value → assertion is tautological, rewrite it

### Step 6: Quality Report

```
## Test Generation Report: [target]

| Metric | Value | Target | Status |
|--------|-------|--------|--------|
| Tests generated | N | — | — |
| Assertion density | X/test | >= 2 | OK/WARN |
| Boundary tests | N | >= 1 per threshold | OK/WARN |
| Property-based tests | N | >= 1 per transform | OK/WARN |
| Weak assertions | N | 0 | OK/WARN |
| Random/fuzz tests | N | >= 1 for complex logic | OK/WARN |
| Integration tests (real DB) | N | >= 1 per repository/query | OK/WARN/N/A |
| E2E browser tests | N | >= 1 per critical flow | OK/WARN/N/A |
| Characterization tests | N | >= 1 per legacy module | OK/WARN/N/A |
| Concurrency tests | N | >= 1 per shared resource | OK/WARN/N/A |

### Strategies Applied
[list each strategy and what it covered]

### NOT Tested (and why)
[Functions/paths deliberately excluded with justification]
```

Related Skills

using-development-skills

8
from reidemeister94/development-skills

Use when starting any conversation - establishes how the development-skills plugin works and how to invoke its components on each platform (Claude Code, Codex). Read first.

update-reqs

8
from reidemeister94/development-skills

Use when user wants to update requirements.in with latest PyPI versions while preserving version patterns

update-reqs-dev

8
from reidemeister94/development-skills

Use when user wants to update requirements-dev.in with latest PyPI versions while preserving version patterns

update-precommit

8
from reidemeister94/development-skills

Use when user wants to update .pre-commit-config.yaml hooks to their latest versions from GitHub

typescript-dev

8
from reidemeister94/development-skills

TypeScript development. Use for TypeScript, Node.js, Express, Fastify, Zod, vitest, jest. Backend, CLI, libraries only — no frontend frameworks.

swift-dev

8
from reidemeister94/development-skills

Swift development. Use for Swift, SwiftUI, UIKit, Vapor, SPM, XCTest, Combine.

staff-review

8
from reidemeister94/development-skills

Use when user wants a code review, deep code review, or staff-level code review of a local branch, repo, directory, or file. Use when user says code review, deep code review, review this branch, review the branch X, review my code, staff review, review locally, or /staff-review.

roast-my-code

8
from reidemeister94/development-skills

Use when user wants a brutally honest code roast, quality critique, or AI-readiness audit. Use when user says roast, roast my code, critique my code, tear apart my code, review quality, or AI-readiness check. Supports --fix flag to auto-fix CRITICAL and HIGH issues via core-dev workflow.

resolve-merge

8
from reidemeister94/development-skills

Use when the user asks to resolve merge conflicts, fix a failed merge, rebase conflict, or run /resolve-merge. Use when git status shows UU/AA/DD conflicts, when there are <<<<<<< conflict markers, when git merge or git pull failed with CONFLICT, or when numbered docs/plans need renumbering after merge. Triggers on: merge conflict, conflict markers, both modified, git merge failed, rebase conflict, resolve conflicts.

python-dev

8
from reidemeister94/development-skills

Python development. Use for Python, FastAPI, Pydantic, asyncpg, pytest, pandas, SQLAlchemy.

produce-feedback

8
from reidemeister94/development-skills

Use when user wants to produce a factual chronicle of development-skills plugin interactions in the current conversation for later ingestion, or runs /produce-feedback. Pure record, no judgment.

java-dev

8
from reidemeister94/development-skills

Java development. Use for Java, Spring Boot, Maven, Gradle, JPA, Hibernate.