exp-mock-usage-analysis
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.
npx skills add dotnet/skills --skill exp-mock-usage-analysis --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# 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 frame
- When to Use
- When Not to Use
- Inputs
- Workflow
- Step 1: Read all provided code
- Step 2: Trace each mock setup through the production code
- Step 3: Check for replaceable mocks
- Step 4: Report findings
- Validation
- Common Pitfalls
What does the exp-mock-usage-analysis skill do?
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.
How do I install it?
Run `npx skills add dotnet/skills --skill exp-mock-usage-analysis --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
