e2e-test-creator
БесплатноБез исполняемых скриптовНе проверенCreates backend e2e tests for new or existing endpoints. Auto-triggers after implementing a new API endpoint. Also runs when asked to add test coverage or…
от letehaha★ 280 звёзд на GitHubОб этом скилле
E2E Test Creator
Creates properly structured e2e tests for backend API endpoints following this project's exact conventions.
Mode
This skill is primarily a reference guide — read the conventions below and write tests directly based on the endpoint just implemented. However, if there's ambiguity about what scenarios to cover (e.g., complex business logic, unclear edge cases), it's fine to ask the user a brief clarifying question before writing.
When to Use
- Auto-trigger: After implementing any new backend endpoint (route + controller + service), always write e2e tests as part of the implementation workflow
- When user explicitly asks to add e2e test coverage
- When triggered via
/e2e-test-creator
Step 1: Gather Context
Before writing any test, read these files to understand what you're testing:
- The service being tested (to understand input/output types and logic)
- The controller (to understand the Zod schema / endpoint contract)
- The route (to confirm the HTTP method and path)
- The test helpers file for that domain (
packages/backend/src/tests/helpers/<domain>.ts) - Any existing e2e tests for the same domain (to colocate or extend)
Step 2: Ensure Test Helper Exists
Every endpoint needs a corresponding test helper function. If one doesn't exist, create it first.
Test Helper Pattern
Location: packages/backend/src/tests/helpers/<domain>.ts
import type { myService as apiMyService } from '@services/<domain>/my-service';
import { makeRequest } from './common';
export async function myEndpoint<R extends boolean | undefined = undefined>({
raw,
// ... endpoint-specific params
}: {
raw?: R;
// ... param types
} = {}) {
return makeRequest<Awaited<ReturnType<typeof apiMyService>>, R>({
method: 'get', // or post, put, patch, delete
url: '/<domain>/endpoint',
raw,
});
}
Key rules:
- Use type-only import for the service function (for return type inference)
- Use the generic
<R>pattern for therawparameter - Pass query params via
payloadfor GET requests (makeRequest converts them to query string)
Step 3: Write the Test File
File Location & Naming
- Colocate with the service:
packages/backend/src/services/<domain>/<feature>.e2e.ts - Or extend an existing test file if there's already one for that domain
- Naming:
kebab-case.e2e.ts
Test Structure
import { describe, expect, it } from '@jest/globals';
import * as helpers from '@tests/helpers';
// Import enums/types needed for test data
import { SOME_ENUM } from '@bt/shared/types';
describe('Feature Name', () => {
// Group by logical concern
describe('GET /endpoint', () => {
it('returns expected data for happy path', async () => {
// ARRANGE: create prerequisite data via helpers
const account = await helpers.createAccount({ raw: true });
// ACT: call the endpoint being tested
const result = await helpers.myEndpoint({ raw: true });
// ASSERT: verify the response
expect(result.someField).toBe(expectedValue);
});
it('returns empty/default when no data exists', async () => {
const result = await helpers.myEndpoint({ raw: true });
expect(result.count).toBe(0);
});
it('filters by query parameter', async () => {
// Create mixed data
await helpers.createThing({ type: 'a', raw: true });
await helpers.createThing({ type: 'b', raw: true });
// Filter
const result = await helpers.myEndpoint({ type: 'a', raw: true });
expect(result.length).toBe(1);
});
});
});
Required Minimum Coverage (every endpoint)
- Happy path — the main use case returns correct data
- Empty state — what happens when there's no data (e.g., no subscriptions yet returns zeros)
- Error case — at least one: invalid input, not-found resource, or unauthorized access (use
raw: falsefor status code checks)
Additional Coverage (add when relevant)
- Filtering — if the endpoint accepts query params, test each filter
- Cross-currency — if the endpoint does currency conversion, test with a non-base currency
- Edge cases — boundary values, null fields, inactive records
- Data isolation — the endpoint only returns data for the authenticated user
Key Rules
NEVER call services directly
// WRONG
const result = await getSubscriptionsSummary({ userId: 1 });
// CORRECT
const result = await helpers.getSubscriptionsSummary({ raw: true });
Use raw: true for happy path, raw: false for error checks
// Happy path — get extracted data directly
const data = await helpers.getSomething({ raw: true });
expect(data.name).toBe('expected');
// Error case — check HTTP status code
const res = await helpers.getSomething({ id: 'nonexistent' });
expect(res.statusCode).toBe(404);
HTTP status codes
200— success404— not found409— conflict (e.g.,
Установить e2e-test-creator в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteEditGrepGlobBashAskUserQuestionFAQ
Что делает скилл e2e-test-creator?
Creates backend e2e tests for new or existing endpoints. Auto-triggers after implementing a new API endpoint. Also runs when asked to add test coverage or triggered by "/e2e-test-creator". Follows project conventions for test structure, helpers, and assertions.
Как установить скилл e2e-test-creator?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл e2e-test-creator запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic