test-gap-analysis
できること
このスキルは、既存のテストが失敗せずに壊れてしまう可能性のある、本番コードの動作を探します。既存のテストが本当のバグを捕まえられるかを知りたい開発者向けです。
使う場面
- ✓機能に対して既存のテストが本当のバグを捕まえるかを知りたいとき。
- ✓一つのコンポーネントやリスク領域で、テストされていない動作を見つけたいとき。
- ✓テストのギャップが本物かを、テストを追加する前に確かめたいとき。
スキルのリンク
https://github.com/dotnet/skills/blob/main/plugins/dotnet-test/skills/test-gap-analysis/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“チェックアウトのコードの割引計算が壊れたら、既存のテストは捕まえられますか?ギャップを見つけてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
エージェントは、コードが呼び出し元に示す結果を一覧にし、小さく現実的な変更を想定します。そのうえで、どの既存テストが失敗するかを確認します。依頼された場合は、信頼できるギャップを検証します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Test Gap Analysis
Answer one question: which caller-visible production behaviors could change without an existing test failing? Mutation reasoning is a probe, not the goal. Inventory public outcomes first, then verify only credible gaps.
Composition dispatch
Before entering the decision flow, check the caller's mode. An explicit
per-test-read-only request (including composition from grade-tests) uses
only references/per-test-read-only.md.
This mode is assessment context conveyed through the host's supported caller
instructions, not a new skill-loader parameter or a mode-specific skill name.
Read that reference and return its per-test assessment inline; do not enter
the standalone workflow below. Loading this mode does not authorize a
baseline run, mutation execution, file edits, suite discovery, or delegation.
If the bundled reference is unavailable, allow at most one listing of the known
references/ directory, then return N/A / unverified with the reason.
Requests without this mode retain the standalone analysis, verification, and test-addition paths below.
Decision flow
1. Set scope
Discover production and test files from manifests and file types. After a narrow search misses, inspect the current directory broadly before asking for paths.
| Request | Action |
|---|---|
| One component or named risk | Inventory every high-risk public outcome in scope; do not edit production code unless verification was requested |
| General small-component review | Inventory distinct outcomes and report caller-visible gaps from source/assertion mapping |
| Explicit survivor verification | Inventory all requested outcomes; execute one representative observable candidate for each distinct high-risk outcome under verification, then classify it as Survived or Killed |
| Explicit exhaustive audit | Read references/mutation-catalog.md and classify all meaningful candidates |
| Add tests to an existing suite | Analyze first; add tests only for verified survivors or demonstrated no-coverage outcomes |
| Create a new suite | Stop and use code-testing |
When the request names a risk, turn it into a one-line public-outcome allowlist
before reading code. An outcome is not in scope merely because the same method writes it.
For money math, allow computed or returned amounts, rates, tier/boundary
choice, percentage base/order, floors/caps, and rounding; exclude non-monetary
state predicates (including derived booleans), identity, and formatting. Private
code is in scope only to trace an allowed outcome.
Do not expand a focused request into a repository audit, plan artifact, or
dashboard. Use source and tests directly for familiar frameworks. When discovery
or assertion semantics are unclear, read the matching language file relative
to the caller-provided or runtime-listed test-analysis-extensions catalog;
do not invoke the reference-only helper or search installation directories.
If absent, state the limitation and use the pinned APIs and rules here.
2. Establish one baseline
For a source-only advisory review, skip execution and label empirical survival
unverified. A baseline is required when the user requests execution or survivor
verification, or when closing gaps with tests. Run the narrowest existing test
command once. Choose it from the project
manifest; Microsoft.Testing.Platform executables may require dotnet run.
Confirm tests executed: exit 0 with build-only output is not green. If that one
attempt cannot run the suite, do not troubleshoot the runner or try alternate
commands for an advisory review; continue statically and label all candidates
unverified. Do not infer a project-configuration cause from missing output;
name a cause only when the command reports it.
Missing runner output limits only claims of empirical mutation survival. It does not make source-proven facts tentative: a public outcome with no reaching test is still No coverage, and an exact expected value derived from the unmodified implementation is still actionable. State the baseline limitation once, then give the static source/assertion conclusion directly instead of hedging every row.
For an advisory review such as "would tests catch this?", stop execution after that baseline. Source-to-assertion mapping is sufficient evidence for No coverage and Candidate survivor (unverified). Trace or run the unmodified code once only
よくある質問
不足しているテストも書きますか?
ギャップを埋めるよう頼まれた場合にだけ書きます。それ以外はギャップを報告します。
コードカバレッジと同じですか?
いいえ。カバレッジは実行された行を示しますが、このスキルは動作が本当に保護されているかを確認します。
ソリューション全体も対象ですか?
対象にできますが、一つのコンポーネントやリスク領域に範囲を絞ると、焦点の合った結果が得られます。
詳細
作者による元の説明
Find caller-visible production changes existing tests would miss through pseudo-mutation analysis; verify candidates or close gaps only when requested. Includes read-only per-test composition for grading. Polyglot. USE FOR: would tests catch a bug, behavioral blind spots, surviving mutations. DO NOT USE FOR: concrete fix/feature revision proof (test-value-evidence); suite taxonomy (test-tagging); .NET coverage, Cobertura, plateaus or coverage-backed priorities (coverage-analysis); named CRAP (crap-score); new suites (code-testing); assertion/smell audits; mutation tools.
repo: dotnet/skills
人気
- GitHubのスター
- 5.8k
- ランキング
- #14638
- ライセンス
- MIT
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
create-custom-agent
5.8kVisual Studio Codeのカスタムエージェントのファイルを、独自のツール、指示、ほかのエージェントへの引き継ぎとともに作るようエージェントを支援します。
create-skill
5.8k有効な名前、明確な発動の説明、規格に従うSKILL.mdファイルを持つ、新しいエージェントのスキルを作るようエージェントを支援します。
csharp-scripts
5.8k.NETのコマンドラインツールを使って、完全なプロジェクトを作らずに、小さなC#のプログラムを一つのファイルとして実行するようエージェントを支援します。
dotnet-pinvoke
5.8k署名、文字列の扱い、メモリ、安全なハンドルを含めて、ネイティブのC言語またはC++のライブラリを.NETから正しく呼び出すようエージェントを支援します。
似ているスキル
test-driven-development
311k機能や修正を作る前に、まず失敗するテストを書き、それが失敗するのを確認してから、合格させる最小のコードを書くようエージェントに教えます。
verification-before-completion
311kタスク、修正、ビルドが完了した、または合格したと主張する前に、実際のチェックを実行し、その出力を読むようエージェントに教えます。
migrate-to-shoehorn
310kテストファイル内の危険な型キャストを、shoehornライブラリに置き換え、テストが部分的なデータを使いつつ型チェックを通るようにします。