testing-strategy-builder
アプリケーション向けの包括的なテスト戦略を構築する際に役立ち、テスト計画のテンプレートや網羅率の目標、テストケースの構造を提供し、ユニットテストからE2Eテスト、パフォーマンステストまで品質保証を支援するSkill。
📜 元の英語説明(参考)
Use this skill when creating comprehensive testing strategies for applications. Provides test planning templates, coverage targets, test case structures, and guidance for unit, integration, E2E, and performance testing. Ensures robust quality assurance across the development lifecycle.
🇯🇵 日本人クリエイター向け解説
アプリケーション向けの包括的なテスト戦略を構築する際に役立ち、テスト計画のテンプレートや網羅率の目標、テストケースの構造を提供し、ユニットテストからE2Eテスト、パフォーマンステストまで品質保証を支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o testing-strategy-builder.zip https://jpskill.com/download/17256.zip && unzip -o testing-strategy-builder.zip && rm testing-strategy-builder.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/17256.zip -OutFile "$d\testing-strategy-builder.zip"; Expand-Archive "$d\testing-strategy-builder.zip" -DestinationPath $d -Force; ri "$d\testing-strategy-builder.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
testing-strategy-builder.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
testing-strategy-builderフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 2
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
テスト戦略ビルダー
概要
このスキルは、ソフトウェアの品質、信頼性、保守性を保証する効果的なテスト戦略を構築するための包括的なガイダンスを提供します。ゼロから始める場合でも、既存のテストカバレッジを改善する場合でも、このフレームワークはチームが堅牢なテストアプローチを設計するのに役立ちます。
このスキルを使用するタイミング:
- 新しいプロジェクトまたは機能のテスト戦略を計画する
- 既存のコードベースのテストカバレッジを改善する
- 品質ゲートとカバレッジ目標を設定する
- テスト自動化アーキテクチャを設計する
- テスト計画とテストケースを作成する
- 適切なテストツールとフレームワークを選択する
- CI/CD パイプラインに継続的テストを実装する
バンドルされているリソース:
references/code-examples.md- 詳細なテストコードの例templates/test-plan-template.md- 包括的なテスト計画テンプレートtemplates/test-case-template.md- テストケースのドキュメントテンプレートchecklists/test-coverage-checklist.md- カバレッジ検証チェックリスト
必要なツール
このスキルは、以下のテストツールを参照します。すべてが必要というわけではありません。このスキルは、プロジェクトに基づいて適切なツールを推奨します。
JavaScript/TypeScript テスト
-
Jest: 最も人気のあるテストフレームワーク
- インストール:
npm install --save-dev jest @types/jest - 設定:
npx jest --init
- インストール:
-
Vitest: Vite ネイティブのテストフレームワーク
- インストール:
npm install --save-dev vitest - 設定:
vite.config.tsに追加
- インストール:
-
Playwright: エンドツーエンドテスト
- インストール:
npm install --save-dev @playwright/test - セットアップ:
npx playwright install
- インストール:
-
k6: パフォーマンス テスト
- インストール (macOS):
brew install k6 - インストール (Linux): k6.io からダウンロード
- コマンド:
k6 run script.js
- インストール (macOS):
Python テスト
-
pytest: 標準的な Python テストフレームワーク
- インストール:
pip install pytest - コマンド:
pytest
- インストール:
-
pytest-cov: カバレッジレポート
- インストール:
pip install pytest-cov - コマンド:
pytest --cov=.
- インストール:
-
Locust: パフォーマンス テスト
- インストール:
pip install locust - コマンド:
locust -f locustfile.py
- インストール:
カバレッジツール
-
c8: JavaScript/TypeScript カバレッジ
- インストール:
npm install --save-dev c8 - コマンド:
c8 npm test
- インストール:
-
Istanbul/nyc: 代替 JS カバレッジ
- インストール:
npm install --save-dev nyc - コマンド:
nyc npm test
- インストール:
インストール検証
# JavaScript/TypeScript
jest --version
vitest --version
playwright --version
k6 version
# Python
pytest --version
locust --version
# Coverage
c8 --version
nyc --version
注: このスキルは、プロジェクトのフレームワーク (React, Vue, FastAPI, Django など) とテストのニーズに基づいてツールを選択するのに役立ちます。
テストの哲学
テストトロフィー 🏆
現代のテストは、「テストトロフィー」モデル(テストピラミッドから発展)に従います。
🏆
/ \
/ E2E \ ← 少数 (重要なユーザー体験)
/----------\
/ Integration\ ← 多数 (コンポーネントの相互作用)
/--------------\
/ Unit \ ← 最多 (ビジネスロジック)
/------------------\
/ Static Analysis \ ← 基盤 (linting, type checking)
原則:
- Static Analysis: 構文エラー、型に関する問題、および一般的なバグをランタイム前に検出します
- Unit Tests: 個々の関数とコンポーネントを分離してテストします
- Integration Tests: コンポーネントがどのように連携するかをテストします
- E2E Tests: 重要なユーザーワークフローをエンドツーエンドで検証します
バランス: 70% 統合、20% ユニット、10% E2E (コンテキストに基づいて調整)
テスト戦略フレームワーク
1. カバレッジ目標
推奨される目標:
- 全体的なコードカバレッジ: 最小 80%
- クリティカルパス: 95-100% (支払い、認証、データミューテーション)
- 新機能: 100% のカバレッジ要件
- ビジネスロジック: 90% 以上のカバレッジ
- UI コンポーネント: 70% 以上のカバレッジ
カバレッジの種類:
- Line Coverage: 実行されたコード行の割合
- Branch Coverage: 実行された決定分岐の割合
- Function Coverage: 呼び出された関数の割合
- Statement Coverage: 実行されたステートメントの割合
重要: カバレッジは目標ではなく、メトリクスです。100% のカバレッジ = バグのないコードではありません。
2. テストの分類
静的解析
目的: ランタイム前にエラーを検出する ツール: ESLint, Prettier, TypeScript, Pylint, mypy, Ruff 実行タイミング: プリコミットフック、CI パイプライン
ユニットテスト
目的: 分離されたビジネスロジックをテストする ツール: Jest, Vitest, pytest, JUnit 特徴:
- 高速な実行 (< 100ms/テスト)
- 外部依存関係なし (データベース、API、ファイルシステム)
- 決定論的 (同じ入力 = 同じ出力)
- 単一責任のテスト
カバレッジ目標: ビジネスロジックで 90% 以上
詳細なユニットテストの例については、references/code-examples.md を参照してください。
統合テスト
目的: コンポーネントの相互作用をテストする ツール: Testing Library, Supertest, pytest with fixtures 特徴:
- 複数のユニットが連携して動作することをテストする
- テストデータベースまたはモックされた外部サービスを使用する場合があります
- 適度な実行時間 (< 1 秒/テスト)
- インターフェースとコントラクトに焦点を当てる
カバレッジ目標: API エンドポイントおよびコンポーネントの相互作用で 70% 以上
API 統合テストの例については、references/code-examples.md を参照してください。
エンドツーエンド (E2E) テスト
目的: 重要なユーザー体験を検証する ツール: Playwright, Cypress, Selenium 特徴:
- アプリケーションフロー全体をテストする (フロントエンド + バックエンド + データベース)
- 遅い実行 (5-30 秒/テスト)
- 本番環境のような環境に対して実行する
- ビジネス上重要なパスに焦点を当てる
カバレッジ目標: 5〜10 の重要なユーザー体験
完全な E2E テストの例については、references/code-examples.md を参照してください。
パフォーマンス テスト
目的: 負荷時のシステムパフォーマンスを検証する ツール: k6, Artillery, JMeter, Locust 種類:
- 負荷テスト: 予想される負荷下でのシステムの動作
- ストレステスト: 限界点の特定
- スパイクテスト: 突然のトラフィック急増の処理
- 耐久テスト: 長期間にわたる持続的な負荷
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Testing Strategy Builder
Overview
This skill provides comprehensive guidance for building effective testing strategies that ensure software quality, reliability, and maintainability. Whether starting from scratch or improving existing test coverage, this framework helps teams design robust testing approaches.
When to use this skill:
- Planning testing strategy for new projects or features
- Improving test coverage in existing codebases
- Establishing quality gates and coverage targets
- Designing test automation architecture
- Creating test plans and test cases
- Choosing appropriate testing tools and frameworks
- Implementing continuous testing in CI/CD pipelines
Bundled Resources:
references/code-examples.md- Detailed testing code examplestemplates/test-plan-template.md- Comprehensive test plan templatetemplates/test-case-template.md- Test case documentation templatechecklists/test-coverage-checklist.md- Coverage verification checklist
Required Tools
This skill references the following testing tools. Not all are required - the skill will recommend appropriate tools based on your project.
JavaScript/TypeScript Testing
-
Jest: Most popular testing framework
- Install:
npm install --save-dev jest @types/jest - Config:
npx jest --init
- Install:
-
Vitest: Vite-native testing framework
- Install:
npm install --save-dev vitest - Config: Add to vite.config.ts
- Install:
-
Playwright: End-to-end testing
- Install:
npm install --save-dev @playwright/test - Setup:
npx playwright install
- Install:
-
k6: Performance testing
- Install (macOS):
brew install k6 - Install (Linux): Download from k6.io
- Command:
k6 run script.js
- Install (macOS):
Python Testing
-
pytest: Standard Python testing framework
- Install:
pip install pytest - Command:
pytest
- Install:
-
pytest-cov: Coverage reporting
- Install:
pip install pytest-cov - Command:
pytest --cov=.
- Install:
-
Locust: Performance testing
- Install:
pip install locust - Command:
locust -f locustfile.py
- Install:
Coverage Tools
-
c8: JavaScript/TypeScript coverage
- Install:
npm install --save-dev c8 - Command:
c8 npm test
- Install:
-
Istanbul/nyc: Alternative JS coverage
- Install:
npm install --save-dev nyc - Command:
nyc npm test
- Install:
Installation Verification
# JavaScript/TypeScript
jest --version
vitest --version
playwright --version
k6 version
# Python
pytest --version
locust --version
# Coverage
c8 --version
nyc --version
Note: The skill will guide you to select tools based on your project framework (React, Vue, FastAPI, Django, etc.) and testing needs.
Testing Philosophy
The Testing Trophy 🏆
Modern testing follows the "Testing Trophy" model (evolved from the testing pyramid):
🏆
/ \
/ E2E \ ← Few (critical user journeys)
/----------\
/ Integration\ ← Many (component interactions)
/--------------\
/ Unit \ ← Most (business logic)
/------------------\
/ Static Analysis \ ← Foundation (linting, type checking)
Principles:
- Static Analysis: Catch syntax errors, type issues, and common bugs before runtime
- Unit Tests: Test individual functions and components in isolation
- Integration Tests: Test how components work together
- E2E Tests: Validate critical user workflows end-to-end
Balance: 70% integration, 20% unit, 10% E2E (adjust based on context)
Testing Strategy Framework
1. Coverage Targets
Recommended Targets:
- Overall Code Coverage: 80% minimum
- Critical Paths: 95-100% (payment, auth, data mutations)
- New Features: 100% coverage requirement
- Business Logic: 90%+ coverage
- UI Components: 70%+ coverage
Coverage Types:
- Line Coverage: Percentage of code lines executed
- Branch Coverage: Percentage of decision branches taken
- Function Coverage: Percentage of functions called
- Statement Coverage: Percentage of statements executed
Important: Coverage is a metric, not a goal. 100% coverage ≠ bug-free code.
2. Test Classification
Static Analysis
Purpose: Catch errors before runtime Tools: ESLint, Prettier, TypeScript, Pylint, mypy, Ruff When to run: Pre-commit hooks, CI pipeline
Unit Tests
Purpose: Test isolated business logic Tools: Jest, Vitest, pytest, JUnit Characteristics:
- Fast execution (< 100ms per test)
- No external dependencies (database, API, filesystem)
- Deterministic (same input = same output)
- Test single responsibility
Coverage Target: 90%+ for business logic
See references/code-examples.md for detailed unit test examples.
Integration Tests
Purpose: Test component interactions Tools: Testing Library, Supertest, pytest with fixtures Characteristics:
- Test multiple units working together
- May use test databases or mocked external services
- Moderate execution time (< 1s per test)
- Focus on interfaces and contracts
Coverage Target: 70%+ for API endpoints and component interactions
See references/code-examples.md for API integration test examples.
End-to-End (E2E) Tests
Purpose: Validate critical user journeys Tools: Playwright, Cypress, Selenium Characteristics:
- Test entire application flow (frontend + backend + database)
- Slow execution (5-30s per test)
- Run against production-like environment
- Focus on business-critical paths
Coverage Target: 5-10 critical user journeys
See references/code-examples.md for complete E2E test examples.
Performance Tests
Purpose: Validate system performance under load Tools: k6, Artillery, JMeter, Locust Types:
- Load Testing: System behavior under expected load
- Stress Testing: Breaking point identification
- Spike Testing: Sudden traffic surge handling
- Soak Testing: Sustained load over time (memory leaks)
Coverage Target: Test all performance-critical endpoints
See references/code-examples.md for k6 load test examples.
Test Planning
1. Risk-Based Testing
Prioritize testing based on risk assessment:
High Risk (100% coverage required):
- Payment processing
- Authentication and authorization
- Data mutations (create, update, delete)
- Security-critical operations
- Compliance-related features
Medium Risk (80% coverage):
- Business logic
- Data transformations
- API integrations
- Email/notification systems
Low Risk (50% coverage):
- UI styling
- Static content
- Read-only operations
- Non-critical features
2. Test Case Design
Given-When-Then Pattern:
Given [initial context]
When [action occurs]
Then [expected outcome]
This pattern keeps tests clear and focused. See references/code-examples.md for implementation examples.
3. Test Data Management
Strategies:
- Fixtures: Pre-defined test data in JSON/YAML files
- Factories: Generate test data programmatically
- Seeders: Populate test database with known data
- Faker Libraries: Generate realistic random data
See references/code-examples.md for test factory and fixture examples.
Testing Patterns and Best Practices
1. AAA Pattern (Arrange-Act-Assert)
Structure tests in three clear phases:
- Arrange: Set up test data and context
- Act: Perform the action being tested
- Assert: Verify expected outcomes
See references/code-examples.md for detailed AAA pattern examples.
2. Test Isolation
Each test should be independent:
- Use fresh test database for each test
- Clean up resources after each test
- Tests don't depend on execution order
See references/code-examples.md for test isolation patterns.
3. Mocking vs Real Dependencies
When to Mock:
- External APIs (payment gateways, third-party services)
- Slow operations (file I/O, network calls)
- Non-deterministic behavior (current time, random values)
- Hard-to-test scenarios (error conditions, edge cases)
When to Use Real Dependencies:
- Fast, deterministic operations
- Critical business logic
- Database operations (use test database)
- Internal service interactions
See references/code-examples.md for mocking examples.
4. Snapshot Testing
Use for: UI components, API responses, generated code
Warning: Snapshots can become brittle. Use for stable components, not rapidly changing UI.
5. Parameterized Tests
Test multiple scenarios with same logic using data tables.
See references/code-examples.md for parameterized test patterns.
Continuous Testing
1. CI/CD Integration
Pipeline Stages:
# Example: GitHub Actions
name: Test Pipeline
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Type check
run: npm run typecheck
- name: Unit & Integration Tests
run: npm test -- --coverage
- name: Upload coverage
uses: codecov/codecov-action@v3
- name: E2E Tests
run: npm run test:e2e
- name: Performance Tests (on main branch)
if: github.ref == 'refs/heads/main'
run: npm run test:performance
2. Quality Gates
Block merges/deployments if:
- Code coverage drops below threshold (e.g., 80%)
- Any tests fail
- Linting errors exist
- Performance regression detected (> 10% slower)
- Security vulnerabilities found
3. Test Execution Strategy
On Every Commit:
- Static analysis (lint, type check)
- Unit tests
- Fast integration tests (< 5 min total)
On Pull Request:
- All tests (unit + integration + E2E)
- Coverage report
- Performance benchmarks
On Deploy to Staging:
- Full E2E suite
- Load testing
- Security scans
On Deploy to Production:
- Smoke tests (critical paths only)
- Health checks
- Canary deployments with monitoring
Testing Tools Recommendations
JavaScript/TypeScript
| Category | Tool | Use Case |
|---|---|---|
| Unit/Integration | Vitest | Fast, Vite-native, modern |
| Unit/Integration | Jest | Mature, extensive ecosystem |
| E2E | Playwright | Cross-browser, reliable, fast |
| E2E | Cypress | Developer-friendly, visual debugging |
| Component Testing | Testing Library | User-centric, framework-agnostic |
| API Testing | Supertest | HTTP assertions, Express integration |
| Performance | k6 | Load testing, scriptable |
Python
| Category | Tool | Use Case |
|---|---|---|
| Unit/Integration | pytest | Powerful, extensible, fixtures |
| API Testing | httpx + pytest | Async support, modern |
| E2E | Playwright (Python) | Browser automation |
| Performance | Locust | Load testing, Python-based |
| Mocking | unittest.mock | Standard library, reliable |
Common Testing Anti-Patterns
❌ Testing Implementation Details
// Bad: Testing internal state
expect(component.state.isLoading).toBe(false);
// Good: Testing user-visible behavior
expect(screen.queryByText('Loading...')).not.toBeInTheDocument();
❌ Tests Too Coupled to Code
// Bad: Test breaks when implementation changes
expect(userService.save).toHaveBeenCalledTimes(1);
// Good: Test behavior, not implementation
const user = await db.users.findOne({ email: 'test@example.com' });
expect(user).toBeTruthy();
❌ Flaky Tests
// Bad: Non-deterministic timeout
await waitFor(() => {
expect(screen.getByText('Success')).toBeInTheDocument();
}, { timeout: 1000 }); // Might fail on slow CI
// Good: Use explicit waits with longer timeout
await screen.findByText('Success', {}, { timeout: 5000 });
❌ Giant Test Cases
// Bad: One test does too much
test('user workflow', async () => {
// 100 lines testing signup, login, profile update, logout...
});
// Good: Focused tests
test('user can sign up', async () => { /* ... */ });
test('user can login', async () => { /* ... */ });
test('user can update profile', async () => { /* ... */ });
Integration with Agents
Code Quality Reviewer
- Reviews test coverage reports
- Suggests missing test cases
- Validates test quality and structure
- Ensures tests follow patterns from this skill
Backend System Architect
- Uses test strategy templates when designing services
- Ensures APIs are testable (dependency injection, clear interfaces)
- Plans integration test architecture
Frontend UI Developer
- Applies component testing patterns
- Uses Testing Library best practices
- Implements E2E tests for user flows
AI/ML Engineer
- Adapts testing patterns for ML models (data validation, model performance tests)
- Uses performance testing for inference endpoints
Quick Start Checklist
When starting a new project or feature:
- [ ] Define coverage targets (overall, critical paths, new code)
- [ ] Choose testing framework (Jest/Vitest, Playwright, etc.)
- [ ] Set up test infrastructure (test database, fixtures, factories)
- [ ] Create test plan (see
templates/test-plan-template.md) - [ ] Implement static analysis (ESLint, TypeScript)
- [ ] Write unit tests for business logic (80%+ coverage)
- [ ] Write integration tests for API endpoints (70%+ coverage)
- [ ] Write E2E tests for critical user journeys (5-10 flows)
- [ ] Configure CI/CD pipeline with quality gates
- [ ] Set up coverage reporting (Codecov, Coveralls)
- [ ] Document testing conventions in project README
For detailed code examples: See references/code-examples.md
Skill Version: 1.0.0 Last Updated: 2025-10-31 Maintained by: AI Agent Hub Team
同梱ファイル
※ ZIPに含まれるファイル一覧。`SKILL.md` 本体に加え、参考資料・サンプル・スクリプトが入っている場合があります。
- 📄 SKILL.md (14,294 bytes)
- 📎 references/code-examples.md (7,886 bytes)