
Most mock audits stop at "is this mock referenced?" This one goes further: it reads the production method, traces the actual execution path for each test's inputs, and flags setups that sit behind a guard clause, an early throw, or a branch the test never takes. It also calls out mocks of ILogger, IOptions, and DTOs that could be real instances instead, while keeping external boundaries like databases and HTTP clients mocked. The reliance on reading production code is the point, and also the cost: on a large codebase, expect it to be slower than a grep-based check. It covers Moq, NSubstitute, and FakeItEasy, and it uses each framework's own terminology in its findings, which keeps the output readable for the team that actually owns the tests.
$ npx -y skills add dotnet/skills --skill exp-mock-usage-analysis --agent claude-codeInstalls into .claude/skills of the current project.
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.
test-anti-patterns)| Input | Required | Description |
|---|---|---|
| Test code | Yes | Test files to analyze |
| Production code | Yes | Code under test — essential for tracing execution paths |
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.
Sponsors