[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M756FW70V034Y1G5Y9SW7RTW":3,"skill-same:01M756FW70V034Y1G5Y9SW7RTW":45},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":29,"ownerDescription":6,"updatedAt":30,"install":31,"resources":44},"01M756FW70V034Y1G5Y9SW7RTW","exp-mock-usage-analysis",null,"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\u002FIOptions should use real implementations instead. Supports Moq, NSubstitute, and FakeItEasy.","weiflycc-cmd\u002Fskills","weiflycc-cmd","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F250846518?v=4","01M756C4PFGZJWKK04WFB9S5XF","威飛工作室","01M756C4QJJ66QDXN2RN6SXY87",0,"MIT","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-experimental\u002Fskills\u002Fexp-mock-usage-analysis\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: exp-mock-usage-analysis\ndescription: \"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\u002FIOptions should use real implementations instead. Supports Moq, NSubstitute, and FakeItEasy.\"\nlicense: MIT\n---\n\n# Mock Usage Analysis\n\nTrace 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.\n\n## When to Use\n\n- User asks to audit, review, or analyze mock usage in .NET tests\n- User wants to find unused, unnecessary, or redundant mock setups\n- User wants to simplify test setup or reduce over-mocking\n- User asks whether mocks of ILogger, IOptions, or similar types are needed\n\n## When Not to Use\n\n- User wants to write new mocks or tests (general testing guidance)\n- User wants to detect non-mock test anti-patterns (use `test-anti-patterns`)\n- User wants to migrate between mock frameworks (out of scope)\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Test code | Yes | Test files to analyze |\n| Production code | Yes | Code under test — essential for tracing execution paths |\n\n## Workflow\n\n### Step 1: Read all provided code\n\nRead 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.\n\nIdentify the mock framework by scanning for its patterns:\n- **Moq**: `new Mock\u003CT>()`, `.Setup(...)`, `.Verify(...)`\n- **NSubstitute**: `Substitute.For\u003CT>()`, `.Returns(...)`, `.Received(...)`\n- **FakeItEasy**: `A.Fake\u003CT>()`, `A.CallTo(...)`, `.MustHaveHappened()`\n\nUse the correct framework's terminology throughout your analysis.\n\n### Step 2: Trace each mock setup through the production code\n\nFor **each test method**, do the following:\n\n1. Identify every mock setup line (`.Setup`, `.Returns`, `A.CallTo`, etc.)\n2. Read the production method being tested and trace its execution path for the specific inputs used in that test\n3. Determine which mock setups are actually reached during execution\n4. Classify each setup:\n\n| Classification | Meaning | Example |\n|---------------|---------|---------|\n| **Used** | The production code calls this mock during the test's execution path | `GetStock` setup when `Reserve` is called and stock is sufficient |\n| **Unreachable** | The production code returns early, throws, or branches away before reaching this mock call | `UpdateStock` setup when the test expects the method to throw `ArgumentOutOfRangeException` on the first line |\n| **Unused** | The mock method is never called by the production method under test at all, regardless of inputs | `GetLowStockProducts` setup when testing `Reserve`, which never calls that method |\n| **Redundant** | Identical mock configurations are duplicated across multiple tests instead of being shared | Five tests each creating `new Mock\u003CIPaymentGateway>()` with the same default setup |\n\nPay special attention to:\n- **Early returns and guard clauses** — setups for mocks called after a guard clause are unreachable when the guard triggers\n- **Exception throws** — if the method throws before using dependencies, all setups for those dependencies are unnecessary\n- **Branch-specific logic** — if a method dispatches by channel\u002Ftype, setups for other channels are unused\n- **Verify-only tests** — tests that only call `.Verify`\u002F`.Received`\u002F`.MustHaveHappened` without asserting on the method's return value\n\n### Step 3: Check for replaceable mocks\n\nFlag mocks of stable framework types that should use real implementations:\n- `Mock\u003CILogger\u003CT>>` → `NullLogger\u003CT>.Instance` (unless log output is asserted)\n- `Mock\u003CIOptions\u003CT>>` → `Options.Create(new T { ... })`\n- Mocks of DTOs, records, or value objects → use `new T { ... }` directly\n\nExplicitly confirm which mocks are **correctly placed** — external boundaries (databases, HTTP clients, message queues, third-party APIs) and security-sensitive types should remain mocked.\n\n### Step 4: Report findings\n\nFor each finding, state:\n1. The specific test method and mock setup line\n2. Why the setup is unnecessary (trace the production code path to explain)\n3. A concrete fix — which lines to remove, what to replace them with, or how to extract shared setup\n\nWhen multiple tests duplicate mock configurations, provide a before\u002Fafter example showing how to extract shared setup into a fixture or helper method.\n\n## Validation\n\n- [ ] Production code was read and execution paths were traced (not just test code reviewed)\n- [ ] Every finding references a specific test method and setup line\n- [ ] Unreachable setups include an explanation of which production code path makes them unreachable\n- [ ] Correctly-placed mocks (external boundaries) are explicitly noted as appropriate\n- [ ] Correct framework terminology is used throughout (not mixing Moq\u002FNSubstitute\u002FFakeItEasy terms)\n\n## Common Pitfalls\n\n| Pitfall | Solution |\n|---------|----------|\n| Analyzing test code without reading production code | Always read the production method to trace which mocks are actually called |\n| Flagging mocks for external boundaries (HTTP, DB) | These are valid isolation boundaries — keep them mocked |\n| Flagging `ILogger` mock when log output is asserted | Only flag when the mock is set up but log output is never verified |\n| Using wrong framework terminology | Match the framework in the code: Moq (`Setup`\u002F`Verify`), NSubstitute (`Returns`\u002F`Received`), FakeItEasy (`A.CallTo`\u002F`MustHaveHappened`) |\n","# Mock Usage Analysis\n\nTrace 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.\n\n## When to Use\n\n- User asks to audit, review, or analyze mock usage in .NET tests\n- User wants to find unused, unnecessary, or redundant mock setups\n- User wants to simplify test setup or reduce over-mocking\n- User asks whether mocks of ILogger, IOptions, or similar types are needed\n\n## When Not to Use\n\n- User wants to write new mocks or tests (general testing guidance)\n- User wants to detect non-mock test anti-patterns (use `test-anti-patterns`)\n- User wants to migrate between mock frameworks (out of scope)\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Test code | Yes | Test files to analyze |\n| Production code | Yes | Code under test — essential for tracing execution paths |\n\n## Workflow\n\n### Step 1: Read all provided code\n\nRead 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.\n\nIdentify the mock framework by scanning for its patterns:\n- **Moq**: `new Mock\u003CT>()`, `.Setup(...)`, `.Verify(...)`\n- **NSubstitute**: `Substitute.For\u003CT>()`, `.Returns(...)`, `.Received(...)`\n- **FakeItEasy**: `A.Fake\u003CT>()`, `A.CallTo(...)`, `.MustHaveHappened()`\n\nUse the correct framework's terminology throughout your analysis.\n\n### Step 2: Trace each mock setup through the production code\n\nFor **each test method**, do the following:\n\n1. Identify every mock setup line (`.Setup`, `.Returns`, `A.CallTo`, etc.)\n2. Read the production method being tested and trace its execution path for the specific inputs used in that test\n3. Determine which mock setups are actually reached during execution\n4. Classify each setup:\n\n| Classification | Meaning | Example |\n|---------------|---------|---------|\n| **Used** | The production code calls this mock during the test's execution path | `GetStock` setup when `Reserve` is called and stock is sufficient |\n| **Unreachable** | The production code returns early, throws, or branches away before reaching this mock call | `UpdateStock` setup when the test expects the method to throw `ArgumentOutOfRangeException` on the first line |\n| **Unused** | The mock method is never called by the production method under test at all, regardless of inputs | `GetLowStockProducts` setup when testing `Reserve`, which never calls that method |\n| **Redundant** | Identical mock configurations are duplicated across multiple tests instead of being shared | Five tests each creating `new Mock\u003CIPaymentGateway>()` with the same default setup |\n\nPay special attention to:\n- **Early returns and guard clauses** — setups for mocks called after a guard clause are unreachable when the guard triggers\n- **Exception throws** — if the method throws before using dependencies, all setups for those dependencies are unnecessary\n- **Branch-specific logic** — if a method dispatches by channel\u002Ftype, setups for other channels are unused\n- **Verify-only tests** — tests that only call `.Verify`\u002F`.Received`\u002F`.MustHaveHappened` without asserting on the method's return value\n\n### Step 3: Check for replaceable mocks\n\nFlag mocks of stable framework types that should use real implementations:\n- `Mock\u003CILogger\u003CT>>` → `NullLogger\u003CT>.Instance` (unless log output is asserted)\n- `Mock\u003CIOptions\u003CT>>` → `Options.Create(new T { ... })`\n- Mocks of DTOs, records, or value objects → use `new T { ... }` directly\n\nExplicitly confirm which mocks are **correctly placed** — external boundaries (databases, HTTP clients, message queues, third-party APIs) and security-sensitive types should remain mocked.\n\n### Step 4: Report findings\n\nFor each finding, state:\n1. The specific test method and mock setup line\n2. Why the setup is unnecessary (trace the production code path to explain)\n3. A concrete fix — which lines to remove, what to replace them with, or how to extract shared setup\n\nWhen multiple tests duplicate mock configurations, provide a before\u002Fafter example showing how to extract shared setup into a fixture or helper method.\n\n## Validation\n\n- [ ] Production code was read and execution paths were traced (not just test code reviewed)\n- [ ] Every finding references a specific test method and setup line\n- [ ] Unreachable setups include an explanation of which production code path makes them unreachable\n- [ ] Correctly-placed mocks (external boundaries) are explicitly noted as appropriate\n- [ ] Correct framework terminology is used throughout (not mixing Moq\u002FNSubstitute\u002FFakeItEasy terms)\n\n## Common Pitfalls\n\n| Pitfall | Solution |\n|---------|----------|\n| Analyzing test code without reading production code | Always read the production method to trace which mocks are actually called |\n| Flagging mocks for external boundaries (HTTP, DB) | These are valid isolation boundaries — keep them mocked |\n| Flagging `ILogger` mock when log output is asserted | Only flag when the mock is set up but log output is never verified |\n| Using wrong framework terminology | Match the framework in the code: Moq (`Setup`\u002F`Verify`), NSubstitute (`Returns`\u002F`Received`), FakeItEasy (`A.CallTo`\u002F`MustHaveHappened`) |\n",{"name":5,"license":15,"description":7},"main","5810d492c9b301d8227f932bf87b5c954c4fa4d6","plugins\u002Fdotnet-experimental\u002Fskills\u002Fexp-mock-usage-analysis","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd","weiflycc.com","2026-11-10 03:26:55",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":43},[33,36,39],{"tool":34,"command":35},"npx","npx skills add weiflycc-cmd\u002Fskills --skill exp-mock-usage-analysis",{"tool":37,"command":38},"bunx","bunx skills add weiflycc-cmd\u002Fskills --skill exp-mock-usage-analysis",{"tool":40,"command":41},"pnpm","pnpm dlx skills add weiflycc-cmd\u002Fskills --skill exp-mock-usage-analysis","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-experimental\u002Fskills\u002Fexp-mock-usage-analysis\u002FSKILL.md",true,[],[46,53,60,67,74,81],{"skillNo":47,"name":48,"nameZh":6,"description":49,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":50,"categories":51,"keywords":52,"publishedAt":19},"01M76SGT4WG5682JQJ0V3NSK6X","system-text-json-net11","Provides guidance on new System.Text.Json APIs introduced in .NET 11. It covers typed JsonTypeInfo access via GetTypeInfo\u003CT> and TryGetTypeInfo\u003CT> on JsonSerializerOptions, and the new JsonNamingPolicy.PascalCase static property. Use when serializing or deserializing JSON in .NET 11 applications and needing typed metadata access or PascalCase property naming.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fsystem-text-json-net11\u002FSKILL.md",[],[],{"skillNo":54,"name":55,"nameZh":6,"description":56,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":19},"01M76SGPNZYYV9BCZJW7BF7J8A","nuget-trusted-publishing","Set up NuGet trusted publishing (OIDC) on a GitHub Actions repo — replaces long-lived API keys with short-lived tokens. USE FOR: trusted publishing, NuGet OIDC, keyless NuGet publish, migrate from NuGet API key, NuGet\u002Flogin, secure NuGet publishing. DO NOT USE FOR: publishing to private feeds or Azure Artifacts (OIDC is nuget.org only). INVOKES: shell (powershell or bash), edit, create, ask_user for guided repo setup.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet\u002Fskills\u002Fnuget-trusted-publishing\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":64,"categories":65,"keywords":66,"publishedAt":19},"01M76SGHVNBNVM1DMVDYTMAE5G","dotnet-pinvoke","Correctly call native (C\u002FC++) libraries from .NET using P\u002FInvoke and LibraryImport. Covers function signatures, string marshalling, memory lifetime, SafeHandle, and cross-platform patterns. USE FOR: writing new P\u002FInvoke or LibraryImport declarations, reviewing or debugging existing native interop code, wrapping a C or C++ library for use in .NET, diagnosing crashes, memory leaks, or corruption at the managed\u002Fnative boundary. DO NOT USE FOR: COM interop, C++\u002FCLI mixed-mode assemblies, or pure managed code with no native dependencies.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet\u002Fskills\u002Fdotnet-pinvoke\u002FSKILL.md",[],[],{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":19},"01M76SGDB9Z3GSB1CFW314NC84","csharp-scripts","Run file-based C# apps with the .NET CLI when the user explicitly wants C#\u002F.NET code without creating a project. Use for C# language\u002FAPI experiments, one-file C# apps, small multi-file C# apps composed with `#:include`\u002F`#:exclude`, or C# file-based apps linked with `#:ref`. Do not use for language-agnostic throwaway scripts, generic computations, Python\u002FPowerShell-style automation, full projects, or existing app integration.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet\u002Fskills\u002Fcsharp-scripts\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":19},"01M76SG805T8W764WAKB1NP3CJ","thread-abort-migration","Guides migration of .NET Framework Thread.Abort usage to cooperative cancellation in modern .NET. USE FOR: modernizing code that calls Thread.Abort, catching ThreadAbortException, replacing Thread.ResetAbort, replacing Thread.Interrupt for thread termination, resolving PlatformNotSupportedException or SYSLIB0006 after retargeting to .NET 6+, migrating ASP.NET Response.End or Response.Redirect(url, true) which internally call Thread.Abort. DO NOT USE FOR: code that only uses Thread.Join, Thread.Sleep, or Thread.Start without any abort, interrupt, or ThreadAbortException usage — these APIs work identically in modern .NET and need no migration. Also not for projects staying on .NET Framework, or Thread.Abort usage inside third-party libraries you do not control.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-upgrade\u002Fskills\u002Fthread-abort-migration\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":19},"01M76SG2588ZJBE5C51HYJJSKV","migrate-nullable-references","Enable nullable reference types in a C# project and systematically resolve all warnings. USE FOR: adopting NRTs in existing codebases, file-by-file or project-wide migration, fixing CS8602\u002FCS8618\u002FCS86xx warnings, annotating APIs for nullability, cleaning up null-forgiving operators, upgrading dependencies with new nullable annotations. DO NOT USE FOR: projects already fully migrated with zero warnings (unless auditing suppressions), fixing a handful of nullable warnings in code that already has NRTs enabled, suppressing warnings without fixing them, C# 7.3 or earlier projects. INVOKES: Get-NullableReadiness.ps1 scanner script.","https:\u002F\u002Fgithub.com\u002Fweiflycc-cmd\u002Fskills\u002Fblob\u002Fmain\u002Fplugins\u002Fdotnet-upgrade\u002Fskills\u002Fmigrate-nullable-references\u002FSKILL.md",[],[]]