agentleFS
shinzoxDshinzoxD/knackbox/skills/coding/test-generation/SKILL.md

test-generation

Skill0 starsChanged 5 months agoApache-2.0View on GitHub

Design and write focused automated tests for new code, bug fixes, and risky behavior. Use whenever the user asks for tests, shares untested code, fixes a defect that needs regression coverage, mentions coverage gaps, or wants help deciding what to test, even if they do not name a testing framework.

6 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

10 rules. 0 are common, 10 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 10

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Create tests that protect observable behavior and likely failure modes.

    line 18
  2. Distinctive:

    Read the repository's existing test framework, fixtures, naming, and helper patterns before writing code.

    line 25
  3. Distinctive:

    Write deterministic tests with an explicit arrange, act, assert structure.

    line 30
  4. Distinctive:

    Run the smallest relevant test command, then the broader suite when the change affects shared behavior.

    line 31
  5. Distinctive:

    When code can be edited, provide the tests and summarize:

    line 48
  6. Distinctive:

    When only planning tests, return a table with case, level, setup, assertion, and priority.

    line 61
  7. Distinctive:

    Do not use snapshots for volatile or security-sensitive values unless the snapshot is intentionally reviewed and stable.

    line 67
  8. Distinctive:

    Avoid sleeps, network access, wall-clock assumptions, and random data without a fixed seed.

    line 69
  9. Distinctive:

    Keep one reason for failure per test where practical.

    line 71
  10. Distinctive:

    Never claim a test passes unless it was run.

    line 74

“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Test Generation

Create tests that protect observable behavior and likely failure modes. A small set of high-signal tests is better than broad coverage coupled to implementation details.

Workflow

  1. Identify the public contract, invariants, side effects, and failure modes.
  2. Read the repository's existing test framework, fixtures, naming, and helper patterns before writing code.
  3. Rank cases by risk: regression, boundaries, permissions, malformed input, concurrency, and external failures.
  4. Choose the narrowest test level that proves the behavior.
  5. Write deterministic tests with an explicit arrange, act, assert structure.
  6. Run the smallest relevant test command, then the broader suite when the change affects shared behavior.

Case selection

Include cases from these groups when relevant:

  • Representative success path.
  • Boundary values immediately below, at, and above a limit.
  • Empty, missing, malformed, duplicated, and unexpectedly large input.
  • Authorization and tenant isolation.
  • Dependency timeout, partial failure, retry, and cancellation.
  • State transitions, repeated calls, and idempotency.
  • A regression test that fails for the reported bug before the fix.

Output format

When code can be edited, provide the tests and summarize:

## Coverage added
- `<test name>`: behavior and risk protected

## Command
`<exact test command>`

## Remaining gaps
- Anything requiring integration infrastructure or unavailable context

When only planning tests, return a table with case, level, setup, assertion, and priority.

Rules

  1. Assert externally meaningful results, not private method call sequences.
  2. Do not use snapshots for volatile or security-sensitive values unless the snapshot is intentionally reviewed and stable.
  3. Avoid sleeps, network access, wall-clock assumptions, and random data without a fixed seed.
  4. Keep one reason for failure per test where practical.
  5. Reuse local factories and fixtures, but do not hide the behavior under test behind excessive helpers.
  6. Never claim a test passes unless it was run; report the exact blocker if it could not be executed.

Edge cases

  • For legacy code with no test seam, first add a characterization test around current behavior.
  • For generated code, test the generator or schema rather than generated lines.
  • For flaky failures, preserve diagnostics and isolate nondeterminism before weakening assertions.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.