Audits .NET test mock usage by tracing each mock setup through the production code's execution path to find dead, unreachable, redundant, or replaceable mocks. Use when the user asks to audit mock usage, find unused or unnecessary mock setups, check if mocks are needed, reduce mock duplication or over-mocking, simplify test setup, or review whether mock configurations like ILogger/IOptions should use real implementations instead. Supports Moq, NSubstitute, and FakeItEasy.
Start a fresh conversation. Replace the highlighted placeholders.
Use exp-mock-usage-analysis to audit mock setups in [test files] against [production code], and report each setup as used, unreachable, unused, redundant, or safely replaceable, with concise rationale and recommended simplifications.
Required inputs
[test files]
[production code]
User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗
SKILL.md
name: exp-mock-usage-analysisdescription: "Audits .NET test mock usage by tracing each mock setup through the production code's execution path to find dead, unreachable, redundant, or replaceable mocks. Use when the user asks to audit mock usage, find unused or unnecessary mock setups, check if mocks are needed, reduce mock duplication or over-mocking, simplify test setup, or review whether mock configurations like ILogger/IOptions should use real implementations instead. Supports Moq, NSubstitute, and FakeItEasy."license: MIT
Mock Usage Analysis
Trace each mock setup through the production code's execution path to determine which setups are actually exercised at runtime and which are dead, unreachable, redundant, or replaceable with real implementations.
When to Use
User asks to audit, review, or analyze mock usage in .NET tests
User wants to find unused, unnecessary, or redundant mock setups
User wants to simplify test setup or reduce over-mocking
User asks whether mocks of ILogger, IOptions, or similar types are needed
When Not to Use
User wants to write new mocks or tests (general testing guidance)
User wants to detect non-mock test anti-patterns (use test-anti-patterns)
User wants to migrate between mock frameworks (out of scope)
Inputs
Input
Required
Description
Test code
Yes
Test files to analyze
Production code
Yes
Code under test — essential for tracing execution paths
Workflow
Step 1: Read all provided code
Read the test files and always read the production code. You cannot determine whether a mock setup is necessary without understanding the production method's control flow.
Identify the mock framework by scanning for its patterns: