Generates a thorough test suite for a specified file, analyzing exports, detecting the project's testing framework, and producing organized tests covering happy paths, edge cases, and error scenarios.
Ships in recipe-commands. Installing the plugin adds it to Claude Code.
Generate a thorough test suite for the file or module specified in $ARGUMENTS.
Read the file specified in $ARGUMENTS. If a file path is not provided, ask the user which file to test.
Identify:
Search the project for testing configuration:
package.json for jest, vitest, mocha, @testing-library/*jest.config.*, vitest.config.*, .mocharc.*pytest.ini, pyproject.toml [tool.pytest], conftest.py_test.go files, Cargo.toml [dev-dependencies]Match the project's existing conventions: import style, describe/it vs test(), assertion library, file naming (*.test.ts vs *.spec.ts vs test_*.py), and directory structure (__tests__/ vs co-located).
Organize tests into these categories:
Write the test file following these principles:
it("returns empty array when input list is empty").Place the test file in the correct location following the project's conventions.
Run the test suite to confirm all new tests pass:
## Test Generation Report
**File under test:** path/to/file
**Test file created:** path/to/test/file
**Framework:** jest / vitest / pytest / etc.
**Tests written:** (count)
- Happy path: X
- Edge cases: Y
- Error scenarios: Z
**Test results:** all passing / X failures
**Coverage gaps:** List any functions or branches that are difficult
to test and why (e.g., requires integration test, hardware dependency).
If $ARGUMENTS includes "coverage", also run the coverage tool and report line/branch coverage percentages.
Files this command reads when invoked
What the command file sets; muted values are Claude Code's defaults
sonnet7-day visitors to each command page
/recipe-commands:test-genfrom recipe-commands
npx claudepluginhub sagargupta16/claude-code-recipes --plugin recipe-commands15 commands in this plugin
/api-genStep 1 -- Understand the RequirementsGenerate REST API endpoints with routes, validation, error handling, and tests/audit-reposStep 1 -- List the ReposAudit all your GitHub repos for CI health, hygiene, security alerts, and staleness/check-all-prsStep 1 -- Find the PRsCheck all your open PRs across GitHub repos for CI, reviews, and merge readiness/code-reviewStep 1 -- Gather the DiffReview staged git changes for bugs, security issues, and style violations/commit-messageStep 1 -- Get the Staged DiffGenerate a conventional commit message from staged changes/component-genStep 1 -- Parse the RequestGenerate React or Vue components with prop types, styling, accessibility, and testsOther plugins' commands for the same job