test について
test は、リリースやマージの前、または変更後にプロジェクトのテストを実行するワークフロースキルです。ユニットテストと統合テストを並列実行し、成功した場合に E2E・受け入れテストへ進みます。
主な機能
- 01テスト前の型診断
- 02ユニット・統合テストの並列実行
- 03前段階の成功後に E2E を実行
- 04全体・機能範囲・クイック実行
- 05カバレッジ、監視、スキップのオプション
活用シーン
- 01機能の実装後に動作を確認
- 02マージやリリース前のテスト実行
- 03迅速な確認のためユニットテストだけを実行
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ parcadei/ continuous-claude-v3 --skill testインストール後、Claude Code で/testを入力して読み込まれたか確認します。
詳細
/test - テストワークフロー
包括的なテストスイートを並列実行します。
使用するタイミング
- 「すべてのテストを実行」
- 「この機能をテスト」
- 「すべてが動作することを確認」
- 「テストスイート全体」
- リリースまたはマージの前
- 大規模な変更の後
ワークフローの概要
┌─────────────┐ ┌───────────┐
│ diagnostics │ ──▶ │ arbiter │ ─┐
│ (type check)│ │ (unit) │ │
└─────────────┘ └───────────┘ │
├──▶ ┌─────────┐
┌───────────┐ │ │ atlas │
│ arbiter │ ─┘ │ (e2e) │
│ (integ) │ └─────────┘
└───────────┘
Pre-flight Parallel Sequential
(~1 second) fast tests slow tests
エージェントの実行順序
| # | エージェント | 役割 | 実行 |
|---|---|---|---|
| 1 | arbiter | 単体テスト、型チェック、リンティング | 並列 |
| 1 | arbiter | 統合テスト | 並列 |
| 2 | atlas | E2E/受け入れテスト | 1 が成功した後 |
この順序にする理由
- 迅速なフィードバック:単体テストはすぐに失敗します
- 並列実行の効率化:単体テストと統合テストの間に依存関係はありません
- E2E の実行条件:より高速なテストが成功した場合にのみ、時間のかかる E2E テストを実行します
実行
フェーズ 0:事前診断(新規)
テストを実行する前に、型エラーを確認します。型エラーはテスト失敗の原因となることがよくあります。
tldr diagnostics . --project --format text 2>/dev/null | grep "^E " | head -10
最初に診断する理由
- 型チェックは瞬時(約 1 秒)ですが、テストにはもっと時間がかかります
- 診断では根本原因がわかり、テストでは症状がわかります
- 「int が期待されていますが、str が渡されました」は「50 行目で AttributeError が発生しました」より明確です
- テストされていないコードパスのエラーも検出します
エラーが見つかった場合: テストを実行する前に修正してください。型エラーがある場合、いずれにしてもテストは失敗する可能性が高いです。
問題がない場合: フェーズ 1 に進みます。
フェーズ 0.5:変更の影響(任意)
大規模なテストスイートでは、影響を受けるテストのみを特定します。
tldr change-impact --session
# or for explicit files:
tldr change-impact src/changed_file.py
変更内容に基づいて実行するテストを特定します。小規模なプロジェクトの場合や、すべてを網羅したい場合は、この手順を省略してください。
フェーズ 1:並列テスト
# Run both in parallel
Task(
subagent_type="arbiter",
prompt="""
Run unit tests for: [SCOPE]
Include:
- Unit tests
- Type checking
- Linting
Report: Pass/fail count, failures detail
""",
run_in_background=true
)
Task(
subagent_type="arbiter",
prompt="""
Run integration tests for: [SCOPE]
Include:
- Integration tests
- API tests
- Database tests
Report: Pass/fail count, failures detail
""",
run_in_background=true
)
# Wait for both
[Check TaskOutput for both]
フェーズ 2:E2E テスト(フェーズ 1 が成功した場合)
Task(
subagent_type="atlas",
prompt="""
Run E2E tests for: [SCOPE]
Include:
- End-to-end flows
- Acceptance tests
- UI tests if applicable
Report: Pass/fail count, screenshots on failure
"""
)
テスト範囲
テストスイート全体
User: /test
→ All unit + integration + E2E tests
機能範囲
User: /test authentication
→ Only auth-related tests
簡易チェック
User: /test --quick
→ Only unit tests (skip integration and E2E)
例
User: /test the new payment feature
Claude: Starting /test workflow for payment feature...
Phase 0: Pre-flight diagnostics...
$ tldr diagnostics . --project --format text | grep "^E "
(no type errors found)
Phase 1: Running parallel tests...
┌─────────────────────────────────────────┐
│ arbiter: Running unit tests... │
│ arbiter: Running integration tests... │
└─────────────────────────────────────────┘
arbiter: ✅ 45/45 unit tests passing
arbiter: ✅ 12/12 integration tests passing
Phase 2: Running E2E tests...
atlas: ✅ 8/8 E2E tests passing
Test Summary:
┌─────────────┬─────────┬────────┐
│ Type │ Passed │ Failed │
├─────────────┼─────────┼────────┤
│ Unit │ 45 │ 0 │
│ Integration │ 12 │ 0 │
│ E2E │ 8 │ 0 │
├─────────────┼─────────┼────────┤
│ TOTAL │ 65 │ 0 │
└─────────────┴─────────┴────────┘
All tests passing! ✅
型エラーがある場合の例
User: /test
Claude: Starting /test workflow...
Phase 0: Pre-flight diagnostics...
$ tldr diagnostics . --project --format text | grep "^E "
E src/payment.py:45:12: Argument of type 'str' not assignable to 'int'
E src/refund.py:23:8: Return type 'None' not assignable to 'float'
Found 2 type errors. Fixing before running tests...
[Claude fixes the type errors]
Re-running diagnostics... clean.
Phase 1: Running parallel tests...
失敗時の対応
フェーズ 1 が失敗した場合:
arbiter: ❌ 43/45 tests passing
2 failures:
- test_payment_validation: expected 'invalid' got 'valid'
- test_refund_calculation: off by $0.01
Stopping workflow. Fix failures before running E2E tests.
フラグ
--quick:単体テストのみ--no-e2e:E2E テストをスキップ--coverage:カバレッジレポートを含める--watch:ファイル変更時に再実行
コメント
Markdown 対応