generate-tests

Generates unit and integration tests following repo-specific runner, mocking, and error-shape conventions.

1|Updated Jun 25, 2026
One-click install
npx skills add https://github.com/curtismu7/AI-DEMO2 --skill generate-tests-curtismu7
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: generate-tests
Source: https://github.com/curtismu7/AI-DEMO2/tree/main/.claude/skills/generate-tests
Command: npx skills add https://github.com/curtismu7/AI-DEMO2 --skill generate-tests-curtismu7

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Writing tests in a multi-service repo means knowing which runner each service uses, where spec files live, and which mocking traps cause false-green or false-red results. This Skill encodes all of that so generated tests match existing conventions instead of silently passing or breaking suites. ## Core Features & Use Cases - Runner routing per service: Maps each service (demo_api_server, demo_api_ui, oauth-mcp, demo_mcp_gateway, langchain_agent, openai_agent, pydantic_agent) to its correct runner — Jest, Vitest, or pytest — and its spec file location. - Convention enforcement: Applies repo rules like the { error } response shape, layer-specific MCP error formats, and normalizeAxiosError assertions. - Trap detection: Flags known pitfalls such as jest moduleNameMapper shims, configStore mock shadowing, StrictMode double-invocation, and pytest-asyncio strict mode silently skipping async tests. - Use Case: When asked to "add tests for the transaction-flows route", the Skill picks Jest with supertest, extends the existing spec file, mocks middleware/auth correctly, and asserts the { error } shape. ## Quick Start Ask the AI to generate tests for a specific function or route in a named service, for example: write unit tests for the authorize-gate middleware in demo_api_server.

Frequently Asked Questions about generate-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write tests for a Node.js Express API with Jest and supertest?▼

Place specs in the service's tests/ directory, use arrange-act-assert with one behavior per test, and assert the { error } response shape. Run scoped with CI=true npx jest <path> --forceExit, since omitting CI=true makes supertest suites flake.

Jest vs Vitest: which test runner should I use for a React UI?▼

Use Vitest for the demo_api_ui service, which is configured with jsdom, globals: true, and src/setupTests.js. Jest is used for the server-side services, and expect() matchers differ slightly, so do not copy jest assertions verbatim into .test.jsx files.

Why does my async pytest test pass without running any assertions?▼

Without a pytest.ini enabling asyncio auto mode, pytest-asyncio runs in strict mode and collects async def tests without awaiting them. Add an explicit @pytest.mark.asyncio decorator so the test body actually executes.

How do I mock HTTP requests in Python async tests?▼

Mock at the transport boundary: use respx for httpx calls, aioresponses for aiohttp, and patch websockets.connect for MCP sockets. This keeps real request-building and response-parsing code under test instead of only verifying call shape.

Why does my Jest test fail with 'Router.use() requires a middleware function'?▼

Several suites hand-mock middleware/auth with a literal object, so adding a new named export to auth.js breaks those mocks at server load. Add the new export to every hand-written auth mock to fix it.

When should I not use this test generation skill?▼

Do not use it to run or verify existing tests, triage flaky suites, or execute full-suite runs — those belong to the verify-ai-demo2 skill. This skill only covers writing new unit and integration tests.