agentleFS
codebygarvcodebygarv/Ai-skills/skills/testing/test-generator/SKILL.md

test-generator

Skill26 starsChanged 4 months agoMITView on GitHub

Creates meaningful unit, integration, and component tests based on implementation and requirements. Use when code needs test coverage and you want tests that verify behavior, not just tests that pad a coverage number.

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use git-doc-updater, git-precommit and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • u9401066Skill

    git-doc-updater

    Auto-check and update key documentation before Git commits to keep docs in sync with code. Triggers: docs, 文檔, 更新文檔, sync docs, release, 發布.

    Also in 3 projects that use this

  • u9401066Skill

    git-precommit

    Orchestrate pre-commit workflow including Memory Bank sync, README/CHANGELOG/ROADMAP updates. Triggers: GIT, gc, push, commit, 提交, 準備 commit, 要提交了, git commit, pre-commit, 推送.

    Also in 3 projects that use this

  • nilecuiSkill

    code-refactor

    Perform bulk code refactoring operations like renaming variables/functions across files, replacing patterns, and updating API calls. Use when users request renaming identifiers, replacing deprecated code patterns, updating method calls, or making consistent changes across multiple locations.

    Also in 3 projects that use this

  • +7 more from u9401066

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 13 edited versions we read keep these.

  • 2

    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:

    Before refactoring, to lock in current behavior first.

    line 13
  2. Distinctive:

    Cover integration points: if relevant — mocked dependencies behave as expected, and the unit under test handles both success and failure …

    line 22

“Common” is measured: kept by at least 6 in 10 of the 13 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

Purpose

Generate tests that actually verify behavior — correctness under normal input, boundary conditions, and failure modes — rather than tests that exist only to move a coverage percentage.

When to Use

  • Code has no tests, or existing tests don't cover the behavior that matters.
  • Before refactoring, to lock in current behavior first.
  • The user asks for tests for a specific function/module/component.

What to Analyze / Do

  1. Understand actual behavior — read the implementation (not just the function name/docstring) to know what it really does, including edge cases it may or may not handle.
  2. Cover the happy path — normal, expected input produces the expected output.
  3. Cover boundary conditions — empty input, zero, single-element, max-size, exactly-at-a-threshold.
  4. Cover failure modes — invalid input, missing dependencies/data, error paths — verify the function fails the way it's supposed to (throws, returns an error value, etc.), not just that it doesn't crash unpredictably.
  5. Cover integration points if relevant — mocked dependencies behave as expected, and the unit under test handles both success and failure responses from them.
  6. One behavior per test — each test should have a clear, singular reason to fail; avoid mega-tests asserting many unrelated things.

Output Format

  • Tests in the project's actual testing framework/convention (ask or infer from existing test files — don't assume Jest if the project uses Vitest, etc.).
  • Descriptive test names that state the behavior being verified ("returns empty array when input is empty," not "test 1").
  • Grouped logically (describe blocks or equivalent) by function/scenario.
  • A brief note on what's intentionally not covered and why, if anything significant was left out (e.g. requires a live network call, out of scope for unit tests).

Avoid

  • Writing tests that just re-assert the implementation's own logic back at it (a test that would still pass if a bug were introduced isn't testing anything).
  • Testing implementation details that aren't part of the actual contract (internal variable names, private helper call counts) instead of observable behavior.
  • Generating tests purely to inflate a coverage number without verifying real behavior.

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.