gen-test
Generates unit and integration tests with support for testcontainers.
Install
mkdir -p .claude/skills/gen-test && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14500" && unzip -o skill.zip -d .claude/skills/gen-test && rm skill.zipInstalls to .claude/skills/gen-test
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Generate a Jest test file for a source module, with testcontainers setup for integration testsKey capabilities
- →Ask for the source file to generate tests for
- →Read the source file to understand exports and dependencies
- →Determine the appropriate test type (unit or integration)
- →Generate Jest test files for source modules
- →Set up testcontainers for integration tests
- →Follow existing test patterns and import order conventions
How it works
The skill reads a source file, determines if a unit or integration test is needed, and then generates a Jest test file following conventions, including testcontainers setup for integration tests.
Inputs & outputs
When to use gen-test
- →Generating unit tests
- →Writing containerized integration tests
- →Mocking module dependencies
About this skill
Generate Test File
Generate a Jest test file for a given source module in this project.
Workflow
- Ask which source file to generate tests for (if not specified)
- Read the source file to understand exports, interfaces, and dependencies
- Read an existing sibling spec first —
src/file-store.gcs.spec.tsis the clearest model — and follow its shape rather than inventing a new one
Conventions
- Test files live alongside source:
src/foo.ts→src/foo.spec.ts. Provider-specific specs are suffixed:file-store.<provider>.spec.ts ts-jestpreset,testEnvironment: "node"- Cloud SDKs are mocked in unit specs —
jest.mock("@google-cloud/storage")and friends. The one exception issrc/file-store.minio.integration.spec.ts, which talks to a real MinIO over the S3 wire protocol; it self-skips unlessMINIO_TEST_ENDPOINTis set and runs viapnpm run test:integration. Notestcontainersdependency; do not add one - Behavioural changes to S3/MinIO paths need cases in the integration spec too — mocked tests cannot catch SDK behaviour changes (see CLAUDE.md, Testing)
LocalFileStoreis the exception: test it against the real filesystem usingfs.promises.mkdtempunderos.tmpdir(), and clean up inafterEach- Save and restore
process.envaround tests that set provider env vars - Import order follows the Prettier config: node builtins → third-party → relative
- Coverage is 100% and must stay there — every branch, including error paths and
||/??fallbacks
Reaching the provider classes
None of the FileStore implementations are exported. Get one by registering the
plugin and reading the decoration:
const fastify = Fastify();
await fastify.register(FileStorePlugin, { type: "gcs" });
const store = fastify.FileStore;
The cloud SDKs are lazily require()d inside each Configure* function rather than
imported at module scope. jest.mock() still intercepts those require() calls
normally. If a test needs a different mock shape than one already established in the
file, use jest.resetModules() and re-require("./file-store").
Unit Test Template
import Fastify from "fastify";
import FileStorePlugin, { FileStore } from "./file-store";
jest.mock("@google-cloud/storage");
describe("moduleName", () => {
let fastify: ReturnType<typeof Fastify>;
const ORIGINAL_ENV = process.env;
beforeEach(() => {
process.env = { ...ORIGINAL_ENV };
jest.clearAllMocks();
fastify = Fastify();
});
afterEach(async () => {
process.env = ORIGINAL_ENV;
await fastify.close();
});
it("should do X when Y", async () => {
// arrange, act, assert
});
});
When not to use it
- →When the task is not to generate a Jest test file for a source module
- →When testcontainers setup is not required for integration tests
- →When the user does not specify a source file and cannot be prompted
Limitations
- →The skill is limited to generating Jest test files
- →The skill is designed for `ts-jest` preset with `testEnvironment: "node"`
- →The skill requires Docker for testcontainers-based integration tests (implied by testcontainers usage)
How it compares
This skill automates the generation of Jest test files, including specialized setup for containerized integration tests, which is more efficient and consistent than writing tests manually.
Compared to similar skills
gen-test side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| gen-test (this skill) | 0 | 4mo | No flags | Intermediate |
| testing-workflow | 16 | 9mo | Review | Intermediate |
| playwright-pro | 8 | 3mo | Review | Intermediate |
| e2e-test-developer | 4 | 6mo | Review | Advanced |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
testing-workflow
amo-tech-ai
Comprehensive testing workflow for E2E, integration, and unit tests. Use when testing applications layer-by-layer, validating user journeys, or running test suites.
playwright-pro
alirezarezvani
Production-grade Playwright testing toolkit. Use when the user mentions Playwright tests, end-to-end testing, browser automation, fixing flaky tests, test migration, CI/CD testing, or test suites. Generate tests, fix flaky failures, migrate from Cypress/Selenium, sync with TestRail, run on BrowserStack. 55 templates, 3 agents, smart reporting.
e2e-test-developer
eclipse-che
Comprehensive E2E test development guidance for Eclipse Che / Red Hat OpenShift Dev Spaces. Use this skill when writing, modifying, or reviewing TypeScript Mocha Selenium tests, page objects, utilities, or test infrastructure. Provides code style rules, patterns, dependency injection setup, and best practices.
s2-lint
antvis
After modifying S2 project code, you must run lint to ensure there are no errors, avoiding issues when pushing to git.
testrail
alirezarezvani
Sync tests with TestRail. Use when user mentions "testrail", "test management", "test cases", "test run", "sync test cases", "push results to testrail", or "import from testrail".
azure-microsoft-playwright-testing-ts
microsoft
Run Playwright tests at scale using Azure Playwright Workspaces (formerly Microsoft Playwright Testing). Use when scaling browser tests across cloud-hosted browsers, integrating with CI/CD pipelines, or publishing test results to the Azure portal.