🛠️ テストDetect
主要なテストフレームワークを自動判別し、既存テストの実行や新規コードの基本テスト生成を効率的に行うSkill。
📺 まず動画で見る(YouTube)
▶ 【衝撃】最強のAIエージェント「Claude Code」の最新機能・使い方・プログラミングをAIで効率化する超実践術を解説! ↗
※ jpskill.com 編集部が参考用に選んだ動画です。動画の内容と Skill の挙動は厳密には一致しないことがあります。
📜 元の英語説明(参考)
Auto-detect testing framework and run relevant tests. Identifies Jest, Vitest, Playwright, Cypress, pytest, Go test, and others. Can run all tests, specific file tests, or generate basic tests for new code. Usage - /test-detect, /test-detect src/auth/login.ts, /test-detect generate src/utils.ts
🇯🇵 日本人クリエイター向け解説
主要なテストフレームワークを自動判別し、既存テストの実行や新規コードの基本テスト生成を効率的に行うSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 この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-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
💬 こう話しかけるだけ — サンプルプロンプト
- › test-detect を使って、最小構成のサンプルコードを示して
- › test-detect の主な使い方と注意点を教えて
- › test-detect を既存プロジェクトに組み込む方法を教えて
これをClaude Code に貼るだけで、このSkillが自動発動します。
📖 Claude が読む原文 SKILL.md(中身を展開)
この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。
Test Detect
Automatically detect the testing framework in the current project and run the right tests.
Workflow
Step 1: Detect the testing framework
Check for these files in order (first match wins):
| Check | Framework | Run Command |
|---|---|---|
vitest.config.* exists OR vitest in devDeps |
Vitest | npx vitest run |
jest.config.* exists OR jest in devDeps |
Jest | npx jest |
playwright.config.* exists |
Playwright | npx playwright test |
cypress.config.* exists |
Cypress | npx cypress run |
pytest.ini or conftest.py or pyproject.toml with [tool.pytest] |
pytest | python -m pytest |
go.mod exists |
Go test | go test ./... |
Cargo.toml exists |
Rust/cargo | cargo test |
mix.exs exists |
ExUnit | mix test |
Gemfile with rspec |
RSpec | bundle exec rspec |
package.json has scripts.test |
npm test | npm test |
Report the detected framework before proceeding.
Step 2: Parse arguments
Check $ARGUMENTS for the mode:
- No arguments or "all": Run the full test suite (Step 3)
- File path (e.g.,
src/auth/login.ts): Run tests for that file (Step 4) - "generate" + file path (e.g.,
generate src/utils.ts): Generate tests (Step 5)
Step 3: Run full test suite
Run the detected test command. After completion:
- Report total tests, passed, failed, skipped
- If tests fail, show the first 3 failure messages with file:line references
- Suggest: "Run
/test-detect <failing-file>to investigate a specific failure"
Step 4: Run tests for a specific file
Given a source file path, find its test file:
Search strategy (try in order):
__tests__/<filename>.test.<ext>(Jest convention)<filename>.test.<ext>(co-located)<filename>.spec.<ext>(alternative convention)test/<filename>_test.<ext>(Go/Python convention)tests/test_<filename>.<ext>(pytest convention)<filename>_test.go(Go convention)
Use Glob to find matches. If found, run only that test file:
| Framework | Command |
|---|---|
| Vitest | npx vitest run <test-file> |
| Jest | npx jest <test-file> |
| Playwright | npx playwright test <test-file> |
| pytest | python -m pytest <test-file> |
| Go | go test -run <TestName> ./<package>/ |
| Cargo | cargo test <test_name> |
If no test file found, ask: "No tests found for this file. Want me to generate them? Run /test-detect generate <file>"
Step 5: Generate tests
Read the source file and analyze:
- Identify all exported functions/classes/components
- Determine the appropriate test patterns for the framework
- Generate a test file with:
- Import statements
describeblock per function/classit/testblocks covering: happy path, edge cases, error cases- Framework-appropriate assertions and mocking
Save to the conventional location for the detected framework:
- Jest/Vitest:
__tests__/<filename>.test.<ext>or<filename>.test.<ext>(match existing convention) - pytest:
tests/test_<filename>.py - Go:
<filename>_test.go(same directory) - RSpec:
spec/<filename>_spec.rb
Show the generated file path and ask if the user wants to run the new tests.
Tips
- If multiple frameworks are detected (e.g., Vitest for unit tests + Playwright for e2e), mention both and default to the unit test framework
- For monorepos, detect from the closest config file to the current directory
- If
package.jsonhas bothtestandtest:unit/test:e2escripts, prefer the specific one when context is clear