agentleFS
PradnyeshpPradnyeshp/Claude-Skills/.claude/skills/test-gen/SKILL.md

test-gen

Skill2 starsChanged 5 months agoMITView on GitHub

Generate unit tests for changed or untested code, matching the project's existing test style. Use when the user asks to write tests, add test coverage, says "test this", "generate unit tests", "cover the changes with tests", or "what's untested".

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use review.

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.
  • SentrySkill

    review

    Fixture review skill.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

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

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 4

    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:

    Focus on what changed: Test new and modified functions/branches.

    line 28
  2. Distinctive:

    Use existing fixtures, factories, or mocks where the project already provides them.

    line 31
  3. Distinctive:

    If you cannot determine the framework with confidence, ask which one to use rather than guessing.

    line 33
  4. Distinctive:

    After writing, print the exact command to run the new tests.

    line 34

“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

Changed code (working tree + staged)

!git diff HEAD --stat 2>/dev/null || echo "No git changes detected"

!git diff HEAD 2>/dev/null | head -400

Detected test setup

!ls package.json pyproject.toml Cargo.toml go.mod pom.xml build.gradle 2>/dev/null

!find . -type d \( -name node_modules -o -name .git -o -name dist -o -name build \) -prune -o -type f \( -name '*.test.*' -o -name '*.spec.*' -o -name 'test_*.py' -o -name '*_test.go' -o -name '*_test.rs' \) -print 2>/dev/null | head -15

Instructions

Generate unit tests for the changed code shown above (or for $ARGUMENTS if a file/path was provided).

Rules

  1. Detect the framework first. Infer the test runner and style from the detected setup and an existing test file (Jest/Vitest for JS/TS, pytest for Python, go test for Go, cargo test for Rust, JUnit for Java). Match the existing imports, assertion style, file naming, and directory layout exactly — do not introduce a new framework.
  2. Focus on what changed. Test new and modified functions/branches. Do not regenerate tests for unrelated existing code.
  3. Cover meaningfully: the happy path, at least one edge case (empty/null/boundary), and error handling where the code can throw. Skip trivial getters.
  4. Name tests descriptively — state the behavior under test, not the function name (e.g. returns 0 for an empty cart, not test_total).
  5. Use existing fixtures, factories, or mocks where the project already provides them. Read a neighboring test file before inventing helpers.
  6. Place tests in the conventional location for this project. State the file path before each test block.
  7. If you cannot determine the framework with confidence, ask which one to use rather than guessing.
  8. After writing, print the exact command to run the new tests.

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.