run-tests
bmad-commandsを用いてテストを実行し、カバレッジ分析でテストの不足部分を特定し、必要なテストを提案することで、テストの実行と品質検証を効率的に行うSkill。
📜 元の英語説明(参考)
Execute tests with coverage analysis using bmad-commands, identify coverage gaps, and suggest missing tests. This skill should be used for test execution and quality validation.
🇯🇵 日本人クリエイター向け解説
bmad-commandsを用いてテストを実行し、カバレッジ分析でテストの不足部分を特定し、必要なテストを提案することで、テストの実行と品質検証を効率的に行うSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o run-tests.zip https://jpskill.com/download/9710.zip && unzip -o run-tests.zip && rm run-tests.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9710.zip -OutFile "$d\run-tests.zip"; Expand-Archive "$d\run-tests.zip" -DestinationPath $d -Force; ri "$d\run-tests.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
run-tests.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
run-testsフォルダができる - 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
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Run Tests Skill
目的
テストを実行し、カバレッジレポートを生成し、カバレッジのギャップを分析し、コード品質とテストの完全性を向上させるために不足しているテストを提案します。
主な機能:
- bmad-commands を介したテスト実行
- カバレッジレポートの生成と分析
- 重要度評価によるギャップの特定
- 具体的な例を用いた不足しているテストの提案
前提条件
- テストフレームワークが構成されていること (Jest, Pytest, JUnit, Google Test, Cargo, Go Test、または任意のカスタムフレームワーク)
- テスト対象のコードに対してテストが記述されていること
- bmad-commands skill が
.claude/skills/bmad-commands/で利用可能であること - プロジェクトの依存関係がインストールされていること
フレームワークのサポート:
- 自動検出: Jest, Pytest, JUnit, GTest, Cargo, Go Test を自動的に検出
- 明示的:
--framework <name>でフレームワークを指定 - カスタム:
.claude/config.yamlを介してカスタムフレームワークを追加 (bmad-commands/FRAMEWORK-EXTENSION-GUIDE.md を参照)
ワークフロー
ステップ 0: テスト範囲の決定
アクション: 入力を解析し、実行するテストを特定します。
範囲の種類: タスクベース (キーワードを抽出 → パターン → テストを検索)、ファイルベース (対応するテストファイルを検索)、すべてのテスト (すべての */.test.* を実行)
参照: 完全な例については、references/templates.md#step-0-scope-determination-templates を参照してください。
ステップ 1: テストの実行
アクション: bmad-commands を使用してテストを実行します。
実行: python .claude/skills/bmad-commands/scripts/run_tests.py --path . --framework auto --output json
レスポンスの解析: 成功、出力 (passed, total_tests, coverage_percent, failures)、テレメトリ、エラーを抽出します。
テストが失敗した場合: 失敗したテストを詳細とともに報告し、修正を提案し、カバレッジ分析に進まないでください。
参照: 完全なレスポンス形式とエラー処理については、references/templates.md#step-1-test-execution-templates を参照してください。
ステップ 2: カバレッジレポートの生成
アクション: カバレッジデータを解析し、レポートを生成します。
カバレッジメトリクス: Statements, Branches, Functions, Lines (それぞれ covered/total/percent を含む)
レポートの生成: カバレッジ JSON を解析し、テキストテーブルを作成し、しきい値 (各メトリクスで ≥80%) を確認します。
参照: 完全な形式としきい値の確認については、references/templates.md#step-2-coverage-report-templates を参照してください。
ステップ 3: カバレッジギャップの分析
アクション: カバーされていないコードを特定し、重要度別に分類します。
ギャップのカテゴリ: Error Handling (High), Edge Cases (Medium), Rare Branches (Low)
重要度レベル:
- Critical: Security, payments, data deletion, auth (Must Test)
- High: Error handling, business logic, state transitions (Should Test)
- Medium: Logging, non-critical errors, minor edge cases (Nice to Test)
- Low: Debug code, dev-only code, trivial getters (Optional)
参照: 完全な例と評価基準については、references/templates.md#step-3-gap-analysis-templates を参照してください。
ステップ 4: 不足しているテストの提案
アクション: カバレッジギャップに対する具体的なテストの提案を生成します。
各ギャップに対して: File/line, criticality, reason, concrete test example
優先順位付け: HIGH (3-5 個の提案) に焦点を当て、次に MEDIUM (2-3 個)、LOW はオプションです。
参照: テストコードを含む完全な提案形式については、references/templates.md#step-4-test-suggestion-templates を参照してください。
ステップ 5: サマリーの提示
アクション: 包括的なテスト実行サマリーを提供します。
サマリーに含まれるもの:
- 範囲、フレームワーク、期間、テスト結果 (passed/failed/total)
- しきい値を含むカバレッジレポート (statements, branches, functions, lines)
- 優先度別に分類されたカバレッジギャップ (CRITICAL/HIGH/MEDIUM/LOW)
- 推定時間とカバレッジの向上を含むテストの提案
- 次のステップと推奨事項
参照: フォーマットされた出力例については、references/templates.md#step-5-complete-summary-templates を参照してください。
出力
テスト結果、カバレッジデータ、ギャップ配列 (file, lines, criticality, category)、テストの提案、およびテレメトリを含む構造化された JSON を返します。
参照: 完全な構造については、references/templates.md#complete-json-output-format を参照してください。
エラー処理
テストが見つからない: テストファイルが存在することを確認し、スコープパターンを確認してください | テストが失敗する: 失敗を詳細とともに報告し、修正を提案してください | カバレッジがしきい値を下回る: ギャップを特定し、不足しているテストを提案してください | フレームワークが構成されていない: インストールと構成を確認してください
参照: 完全なエラーメッセージと解決策については、references/templates.md#error-templates を参照してください。
一般的なシナリオ
テストが成功 + 良好なカバレッジ (≥80%): 成功を報告し、オプションの改善点を強調します | テストが成功 + 低いカバレッジ (<80%): 重要なギャップを特定し、HIGH 優先度のテストを提案します | テストが失敗する: 失敗を報告し、修正を提案し、カバレッジ分析に進まないでください
ベストプラクティス
テストを頻繁に実行する | カバレッジ % よりも品質を優先する | 重要なもの (ビジネスロジック、エラー、エッジケース) をテストする | テストを高速に保つ (依存関係をモックする) | 意味のあるテスト名を使用する
参照: 詳細なテストのベストプラクティスについては、references/best-practices.md を参照してください。
ルーティングガイダンス
この skill を使用する場合:
- 実装されたコードのテストを実行する必要がある場合
- カバレッジ分析が必要な場合
- テストギャップを特定したい場合
- 実装品質を検証する必要がある場合
常に以下で使用する:
- 機能実装 (
implement-feature) - バグ修正 (
fix-bug) - コードリファクタリング (
refactor-code)
以下より前:
- プルリクエストの作成
- 本番環境へのデプロイ
- コードレビュー
参照ファイル
references/ に詳細なドキュメントがあります。
- templates.md: すべての出力形式、完全な例、JSON 構造、CI/CD 統合
- test-execution-guide.md: テスト構成と実行の詳細
- coverage-analysis-guide.md: カバレッジの解析としきい値の確認
- gap-analysis-guide.md: カバーされていないコードの分析と分類
- test-suggestions.md: 不足しているテストの提案テンプレート
- best-practices.md: テストとカバレッジのベストプラクティス
Part of BMAD Enhanced Development Suite
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Run Tests Skill
Purpose
Execute tests, generate coverage reports, analyze coverage gaps, and suggest missing tests to improve code quality and test completeness.
Core Capabilities:
- Test execution via bmad-commands
- Coverage report generation and analysis
- Gap identification with criticality assessment
- Missing test suggestions with concrete examples
Prerequisites
- Test framework configured (Jest, Pytest, JUnit, Google Test, Cargo, Go Test, or any custom framework)
- Tests written for the code being tested
- bmad-commands skill available at
.claude/skills/bmad-commands/ - Project dependencies installed
Framework Support:
- Auto-detection: Automatically detects Jest, Pytest, JUnit, GTest, Cargo, Go Test
- Explicit: Specify framework with
--framework <name> - Custom: Add custom frameworks via
.claude/config.yaml(see bmad-commands/FRAMEWORK-EXTENSION-GUIDE.md)
Workflow
Step 0: Determine Test Scope
Action: Parse input and identify which tests to run.
Scope Types: Task-based (extract keywords → pattern → find tests), File-based (find corresponding test file), All tests (run all */.test.*)
See: references/templates.md#step-0-scope-determination-templates for complete examples
Step 1: Execute Tests
Action: Use bmad-commands to run tests.
Execute: python .claude/skills/bmad-commands/scripts/run_tests.py --path . --framework auto --output json
Parse Response: Extract success, outputs (passed, total_tests, coverage_percent, failures), telemetry, errors
If tests fail: Report failed tests with details, suggest fixes, do not proceed with coverage analysis
See: references/templates.md#step-1-test-execution-templates for complete response formats and error handling
Step 2: Generate Coverage Report
Action: Parse coverage data and generate reports.
Coverage Metrics: Statements, Branches, Functions, Lines (each with covered/total/percent)
Generate Report: Parse coverage JSON, create text table, check thresholds (≥80% for each metric)
See: references/templates.md#step-2-coverage-report-templates for complete formats and threshold checking
Step 3: Analyze Coverage Gaps
Action: Identify uncovered code and categorize by criticality.
Gap Categories: Error Handling (High), Edge Cases (Medium), Rare Branches (Low)
Criticality Levels:
- Critical: Security, payments, data deletion, auth (Must Test)
- High: Error handling, business logic, state transitions (Should Test)
- Medium: Logging, non-critical errors, minor edge cases (Nice to Test)
- Low: Debug code, dev-only code, trivial getters (Optional)
See: references/templates.md#step-3-gap-analysis-templates for complete examples and assessment criteria
Step 4: Suggest Missing Tests
Action: Generate concrete test suggestions for coverage gaps.
For each gap: File/line, criticality, reason, concrete test example
Prioritization: Focus on HIGH (3-5 suggestions), then MEDIUM (2-3), LOW optional
See: references/templates.md#step-4-test-suggestion-templates for complete suggestion formats with test code
Step 5: Present Summary
Action: Provide comprehensive test execution summary.
Summary Includes:
- Scope, framework, duration, test results (passed/failed/total)
- Coverage report with thresholds (statements, branches, functions, lines)
- Coverage gaps categorized by priority (CRITICAL/HIGH/MEDIUM/LOW)
- Test suggestions with estimated time and coverage gain
- Next steps and recommendations
See: references/templates.md#step-5-complete-summary-templates for formatted output examples
Output
Return structured JSON with test results, coverage data, gaps array (file, lines, criticality, category), test suggestions, and telemetry
See: references/templates.md#complete-json-output-format for full structure
Error Handling
No tests found: Verify test files exist, check scope pattern | Tests failing: Report failures with details, suggest fixes | Coverage below threshold: Identify gaps, suggest missing tests | Framework not configured: Verify installation and configuration
See: references/templates.md#error-templates for complete error messages and solutions
Common Scenarios
Tests passing + good coverage (≥80%): Report success, highlight optional improvements | Tests passing + low coverage (<80%): Identify critical gaps, suggest HIGH priority tests | Tests failing: Report failures, suggest fixes, do not proceed with coverage analysis
Best Practices
Run tests frequently | Prioritize quality over coverage % | Test what matters (business logic, errors, edge cases) | Keep tests fast (mock dependencies) | Use meaningful test names
See: references/best-practices.md for detailed testing best practices
Routing Guidance
Use this skill when:
- Need to execute tests for implemented code
- Need coverage analysis
- Want to identify test gaps
- Need to validate implementation quality
Always use after:
- Feature implementation (
implement-feature) - Bug fixes (
fix-bug) - Code refactoring (
refactor-code)
Before:
- Creating pull requests
- Deploying to production
- Code reviews
Reference Files
Detailed documentation in references/:
- templates.md: All output formats, complete examples, JSON structures, CI/CD integration
- test-execution-guide.md: Test configuration and execution details
- coverage-analysis-guide.md: Coverage parsing and threshold checking
- gap-analysis-guide.md: Analyzing uncovered code and categorization
- test-suggestions.md: Missing test suggestion templates
- best-practices.md: Testing and coverage best practices
Part of BMAD Enhanced Development Suite