본문으로 건너뛰기
cccskills
무료GitHub에 공개

saas-test-helpers

Generate stack-specific test helper libraries — assertion utilities, mock session factories, API test clients in tests/helpers/. Reduces test boilerplate.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md3.7 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

!bash "${CLAUDE_SKILL_DIR}/../../hooks/yaml-helper.sh" resolve_config --keys locale,automation

SaaS Test Helpers

Interaction Localization Rule: When locale: pt-BR (or user speaks Portuguese), ALL questions (AskUserQuestion / ask_question), confirmation prompts, and selectable options MUST be translated and presented in Brazilian Portuguese (PT-BR). Any English question text or options in this skill are illustrative examples — NEVER display English questions or options to a Portuguese developer. Internal reasoning, code synthesis, tests, and documentation files MUST remain in English.

Generates reusable test utilities, mock tenant factories, authenticated request clients, and custom test assertions in tests/helpers/ to reduce boilerplate across unit, integration, and E2E test suites.


Phase 1: Detect Stack & Test Runner

Read project.yaml:

  • TypeScript / Next.js: Vitest or Jest. Helpers written in TypeScript (tests/helpers/*.ts).
  • Python / FastAPI: Pytest. Helpers written in Python (tests/conftest.py, tests/helpers/*.py).

Phase 2: Core Helper Library (base)

Generate standard test utilities:

1. tests/helpers/auth.ts (Mock Authentication & Sessions)

import { vi } from 'vitest';

export interface MockUser {
  id: string;
  email: string;
  tenantId: string;
  role: 'owner' | 'admin' | 'member';
}

export function createMockSession(overrides?: Partial<MockUser>): MockUser {
  return {
    id: overrides?.id || 'usr_' + Math.random().toString(36).substring(7),
    email: overrides?.email || 'test@example.com',
    tenantId: overrides?.tenantId || 'org_test123',
    role: overrides?.role || 'member',
  };
}

export function mockAuthHeaders(user: MockUser) {
  return {
    'x-user-id': user.id,
    'x-tenant-id': user.tenantId,
    'x-user-role': user.role,
  };
}

2. tests/helpers/factories.ts (Entity Model Factories)

export function makeTenant(name = 'Acme Corp') {
  return {
    id: 'org_' + Math.random().toString(36).substring(7),
    name,
    slug: name.toLowerCase().replace(/\s+/g, '-'),
    plan: 'pro',
    createdAt: new Date(),
  };
}

export function makeSubscription(tenantId: string, status = 'active') {
  return {
    id: 'sub_' + Math.random().toString(36).substring(7),
    tenantId,
    status,
    priceId: 'price_pro_monthly',
    currentPeriodEnd: new Date(Date.now() + 30 * 24 * 60 * 60 * 1000),
  };
}

3. tests/helpers/assertions.ts (Custom Assertions)

import { expect } from 'vitest';

export function assertTenantIsolation(data: { tenantId?: string }, expectedTenantId: string) {
  expect(data.tenantId).toBe(expectedTenantId);
}

export function assertApiResponse(res: Response, status: number) {
  expect(res.status).toBe(status);
}

Phase 3: Module-Specific Factories

When invoked with a specific module argument (e.g. /saas-test-helpers billing or /saas-test-helpers teams):

  1. Read the corresponding PRD in design/prd/[module].md.
  2. Extract required entities, database models, and API payload schemas.
  3. Generate typed factory functions in tests/helpers/[module]-factories.ts.

Phase 4: Verification

Run npm test or pytest to verify the generated helper functions compile and execute cleanly.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Turn your AI session into an autonomous SaaS and software engineering studio with 49 specialized agents, 74 workflow skills (/saas-*), 28 director gates, and complete architecture across Next.js, FastAPI, Supabase, Tailwind, and Stripe.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio22026년 10월 22일 업데이트

Brownfield audit — do existing artifacts actually work? Numbered migration plan. Unlike /saas-project-stage-detect, checks compliance not existence.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio22026년 10월 22일 업데이트

Create an ADR documenting a technical decision: context, alternatives considered, consequences.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio22026년 10월 22일 업데이트

Traceability matrix mapping PRD requirements to ADRs. Finds gaps, cross-ADR conflicts, stack compatibility. PASS/CONCERNS/NOT ASSESSED/FAIL.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio22026년 10월 22일 업데이트

Audit assets against naming conventions, file size budgets, format standards. Finds orphaned assets, missing references.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio22026년 10월 22일 업데이트

Author per-asset visual specs, SVG dimensions, and generation prompts from PRDs and design tokens. After design tokens.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Basinfy/Basinfy-SaaS-Studio22026년 10월 22일 업데이트

Basinfy의 스킬 모두 보기

이 스킬의 문제 신고