スキル一覧に戻る
bybren-llc

testing-patterns

by bybren-llc

Production-validated SAFe multi-agent development methodology with Claude Code. Treat AI agents as specialized team members (11 roles: BSA, Architect, QAS, etc). Complete whitepaper + working template.

22🍴 7📅 2026年1月20日
GitHubで見るManusで実行

SKILL.md


name: testing-patterns description: Testing patterns for Jest and Playwright. Use when writing tests, setting up test fixtures, or validating RLS enforcement. Routes to existing test conventions.

Testing Patterns Skill

Purpose

Guide consistent and effective testing. Routes to existing test patterns and provides evidence templates.

When This Skill Applies

  • Writing unit or integration tests
  • Setting up test fixtures with RLS
  • Running test suites
  • Packaging test evidence

Critical Rules

❌ FORBIDDEN

// Direct Prisma calls bypass RLS
const user = await prisma.user.findUnique({ where: { user_id } });

// Shared test state causes flaky tests
let sharedUser: User;
beforeAll(() => { sharedUser = createUser(); });

✅ CORRECT

// Use RLS context helpers
const user = await withSystemContext(prisma, "test", async (client) => {
  return client.user.findUnique({ where: { user_id } });
});

// Isolated test state
beforeEach(() => {
  const testUser = createTestUser();
});

// Unique identifiers
const userId = `user-${crypto.randomUUID()}`;

Test Commands

yarn test:unit              # Unit tests
yarn test:integration       # Integration tests
yarn test:e2e               # E2E tests (Playwright)
yarn ci:validate            # Full validation

Test Directory Structure

__tests__/
├── unit/              # Fast, isolated tests
├── integration/       # API and database tests
├── e2e/               # End-to-end tests
└── setup.ts           # Global setup

Evidence Template

**Test Execution Evidence**

**Test Suite**: [unit/integration/e2e]
**Files Changed**: [list files]

**Test Results:**
- Total Tests: [X]
- Passed: [X]
- Failed: [0]

**Commands Run:**
```bash
yarn test:unit --coverage

## Reference

- **Jest Config**: `jest.config.js`
- **RLS Context**: `lib/rls-context.ts`

スコア

総合スコア

75/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

+10
人気

GitHub Stars 100以上

0/15
最近の活動

1ヶ月以内に更新

+10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

+5

レビュー

💬

レビュー機能は近日公開予定です