Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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:

  1. The service being tested (to understand input/output types and logic)
  2. The controller (to understand the Zod schema / endpoint contract)
  3. The route (to confirm the HTTP method and path)
  4. The test helpers file for that domain (packages/backend/src/tests/helpers/<domain>.ts)
  5. 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 the raw parameter
  • Pass query params via payload for 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)

  1. Happy path — the main use case returns correct data
  2. Empty state — what happens when there's no data (e.g., no subscriptions yet returns zeros)
  3. Error case — at least one: invalid input, not-found resource, or unauthorized access (use raw: false for 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 — success
  • 404 — not found
  • 409 — conflict (e.g.,
Полный SKILL.md на GitHub

Установить e2e-test-creator в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Read
Write
Edit
Grep
Glob
Bash
AskUserQuestion

FAQ

Что делает скилл 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), без исполняемых скриптов.

Похожие скиллы

Сравнить e2e-test-creator с