Skip to main content

exp-mock-usage-analysis

Trace .NET mock setups through production control flow to find dead, unreachable, redundant, or replaceable mocks.

Source facts

Repository
visionarycoder/vc.Agentic
Last source activity
November 9, 2026 at 06:22
Detected SKILL.md language
English
Stars
0
Forks
0

Install options

The review-first prompt is selected by default. You can switch to a direct command or download a local copy.

Review the source files

Read SKILL.md and any companion files shown by SkillsMP before deciding whether to install.

File Explorer
7 files

Showing SKILL.md

SKILL.md
Source instructions · Read-only preview
name
exp-mock-usage-analysis
description
Trace .NET mock setups through production control flow to find dead, unreachable, redundant, or replaceable mocks.
metadata
{"metadata-version":"1.0.0","title":"Mock Usage Analysis","document-type":"skill","repository":"vc.Agentic","language":"Standard Technical English","updated":"2026-11-08","collection":"optional"}
# Mock Usage Analysis Agent traces each mock setup through production execution to decide whether the setup earns its cost. ## When to Use | User prompt | Use | |---|---| | User asks which mocks are unused or unnecessary | Use this skill | | User asks whether test setup is over-mocked | Use this skill | | User asks whether `ILogger`, `IOptions`, or similar mocks can become real objects | Use this skill | ## When Not to Use | User prompt | Route | |---|---| | User asks for general suite quality review | Use `test-anti-patterns` | | User asks to migrate between mock frameworks | Handle the migration directly | | User asks to write new tests only | Use a test-writing skill | ## Required Inputs | Input | Required | Description | |---|---|---| | Test code | Yes | Agent needs mock setup and verification code. | | Production code | Yes | Agent needs the executed control flow. | | Mock framework | No | Agent infers Moq, NSubstitute, or FakeItEasy terminology. | ## Workflow | Step | Agent action | Test | Pass | |---|---|---|---| | 1 | Agent reads test code and production code together. | Review both scopes. | Findings rely on traced execution, not guesswork. | | 2 | Agent inventories each setup and verification. | Review extracted list. | Every finding references one concrete setup. | | 3 | Agent traces the specific test inputs through production control flow. | Review path notes. | Used and unreachable classifications match the code path. | | 4 | Agent identifies replaceable mocks. | Review setup types. | Stable framework helpers become real objects where safe. | | 5 | Agent reports only high-confidence findings. | Review final report. | Each item states location, reason, and concrete change. | ## Common Pitfalls | Pitfall | Agent fix | |---|---| | Agent flags every mock as suspicious | Agent preserves mocks at true system boundaries. | | Agent judges setups without reading production code | Agent traces the actual path first. | | Agent ignores verify-only interaction tests | Agent credits verifications that prove required side effects. | | Agent extracts shared setup after two occurrences only | Agent waits for material repetition. | ## Classification Table | Classification | Signal | Agent conclusion | Agent fix | |---|---|---|---| | Used | Production code reaches the setup on this path. | Setup is justified. | Agent keeps it and cites why when explanation adds value. | | Unreachable | Guard clause, exception, or branch prevents the call. | Setup is unnecessary for this test path. | Agent removes or relocates it. | | Unused | Production method never calls that member. | Setup adds noise without value. | Agent deletes it. | | Redundant | Multiple tests repeat the same setup. | Shared infrastructure helps when repetition is material. | Agent proposes extraction when repetition is material. | | Replaceable | Stable framework type does not need a mock. | Real helper is simpler. | Agent swaps to `NullLogger`, `Options.Create`, or a real value object. | ## Mock Pattern Table | Pattern | Agent interpretation | Pass | |---|---|---| | `Setup` plus `Verify` on called dependency | Legitimate interaction proof | Setup remains because observable behavior depends on it. | | Mocked DTO or record | Likely replaceable | Real object removes indirection. | | Logging mock without verification | Usually replaceable | `NullLogger<T>.Instance` preserves behavior. | | Options mock | Usually replaceable | `Options.Create(new T())` preserves behavior. | | Branch-only setup | Path-specific evidence needed | Agent keeps it only in tests that reach the branch. | ## Report Contract | Section | Requirement | |---|---| | Summary | Agent reports setup counts by classification. | | Findings | Agent reports test, setup line, path reason, and fix. | | Good usage | Agent names correctly placed mocks for external boundaries. | | Refactoring opportunities | Agent groups repeated setups into one extraction suggestion. | ## Verification Checklist - [ ] Agent read production control flow before classifying mocks. - [ ] Agent used framework-correct terminology. - [ ] Agent tied every finding to a specific setup line. - [ ] Agent preserved valid mocks at external boundaries. - [ ] Agent recommended real helpers only when behavior stayed intact. ## Additional source coverage The selected version is the preferred starting point by the recorded date/context basis. Distinct source coverage is retained in the scoped references; do not apply superseded or conflicting defaults automatically. - [exp-mock-usage-analysis-alternative-1](references/contexts/exp-mock-usage-analysis-alternative-1/guide.md) - [exp-mock-usage-analysis-alternative-2](references/contexts/exp-mock-usage-analysis-alternative-2/guide.md) - [exp-mock-usage-analysis-alternative-3](references/contexts/exp-mock-usage-analysis-alternative-3/guide.md) - [exp-mock-usage-analysis-alternative-4](references/contexts/exp-mock-usage-analysis-alternative-4/guide.md) - [exp-mock-usage-analysis-alternative-5](references/contexts/exp-mock-usage-analysis-alternative-5/guide.md) - [exp-mock-usage-analysis-alternative-6](references/contexts/exp-mock-usage-analysis-alternative-6/guide.md)
View on GitHub