Wave 11·Skills.sh · part of AI Dimensie·Why Skills.sh? →·⌘K jump
aidimension UI built-in skill

Test Generator

Generate unit, table, and property tests in the project's framework with meaningful assertions, not coverage padding.

.skills/test-gen/SKILL.md2660 charsagenttestingci
.skills/test-gen/SKILL.md
GitHub
---
name: test-gen
description: >
  Generate unit tests for a function, class, or module in the project's
  existing test framework. Analyzes the target, identifies branches and
  edge cases, and writes tests with meaningful assertions — not just
  coverage padding. Use when onboarding a new module to a codebase, when a
  legacy file has zero coverage, or when adding a feature without tests
  would block merge.
when-to-use:
  - Backfilling tests for an untested module
  - Adding regression tests alongside a new feature
  - Generating table-driven cases for pure functions
  - Producing property-based fuzz tests for parsers/serializers
---

# Test Generator

Point this skill at a function or file and it emits runnable tests that
exercise the meaningful paths.

## Overview

The skill reads the target, infers the language and test framework from
project conventions (`package.json`, `pyproject.toml`, `go.mod`, etc.),
then generates tests across three layers:

1. **Happy path** — each public function with canonical inputs.
2. **Edge cases** — empty inputs, boundary values, unicode, locale, timezones.
3. **Failure modes** — invalid types, missing fields, network/auth errors,
   based on the function's throw / return-error contract.

It never asserts on trivial things like `expect(1).toBe(1)`. Every
assertion is paired with a one-line comment explaining what it guards
against so future readers understand intent.

## Usage examples

```bash
# Generate tests for one function
npx skills run test-gen --target src/utils/slugify.ts --fn slugify

# Generate tests for a whole module
npx skills run test-gen --target src/billing/invoice.ts --framework vitest

# Generate property-based tests for a parser
npx skills run test-gen --target src/parser/json.ts --strategy property
```

## Parameters

| Name | Type | Default | Description |
|---|---|---|---|
| `target` | string | — | File or function path. |
| `fn` | string | — | Optional export name when `target` is a file. |
| `framework` | enum | `auto` | `vitest`, `jest`, `pytest`, `go`, `cargo`. |
| `strategy` | enum | `unit` | `unit`, `table`, `property`, `snapshot`. |
| `cases` | int | `8` | Number of generated cases per strategy. |
| `include_mocks` | bool | `true` | Whether to scaffold network/IO mocks. |
| `output` | string | alongside target | Test file path; defaults to `*.test.ts` next to source. |

## Expected output

A test file written to disk, plus a JSON summary listing each generated
case, the branch it covers, and any fixtures or helpers it relies on. The
skill exits non-zero if the generated tests don't compile or fail on first
run, so a CI gate can refuse the change.

How to use this skill

These files live in the .skills/ directory of the aidimension UI repo. Open Design–compatible agents (Claude Code, Cursor, Cline, etc.) auto-detect them. You can also reference them directly:

# in your agent's config
- name: aidimension-ui
  source: https://github.com/javashn/aidimension-ui/tree/main/.skills