[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6DYWR2CQGD52MX3QERRZ9XX":3,"skill-same:01M6DYWR2CQGD52MX3QERRZ9XX":97},{"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":23,"publishedAt":53,"linkOnly":54,"markdownContent":55,"markdownBody":56,"frontMatter":57,"refName":59,"commitSha":60,"skillDirectory":61,"forksCount":62,"repositoryHtmlUrl":63,"repositoryHomepageUrl":64,"ownerHtmlUrl":65,"ownerBlogUrl":66,"ownerDescription":67,"updatedAt":68,"install":69,"resources":82},"01M6DYWR2CQGD52MX3QERRZ9XX","detect-static-dependencies",null,"ACTIVATION PREREQUISITE: the request or discovered target must explicitly identify C#, .NET, `.cs`, or `.csproj`; otherwise stay dormant without invoking this skill. USE FOR: locating System.DateTime.Now\u002FUtcNow, System.IO.File\u002FDirectory, System.Environment, HttpClient, Console, or Process usage in C#; auditing C# code for hard-to-test framework dependencies; or verifying those C# calls are already abstracted. DO NOT USE FOR: any target lacking the activation prerequisite; generating wrappers (use generate-testability-wrappers); migrating code (use migrate-static-to-wrapper); or general code review.","managedcode\u002Fdotnet-skills","managedcode","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F78253589?v=4","01M6DYDJR3EG8KB5G4PC65XCTT","Managed Code","01M6DYDJX0ZT432N04NYJW89DN",515,"MIT","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTesting\u002FOfficial-DotNet-Test\u002Fskills\u002Fdetect-static-dependencies\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52],"static","detect static dependencies","detect","dependencies","use","request","csproj","usage","datetime","now","testability","io","do","activation","general","Wrapper","code review","process","environment","system","migrate","file","framework","console","code","generate","test","review","directory","2026-11-10 10:12:30",false,"---\nname: detect-static-dependencies\ndescription: >\n  ACTIVATION PREREQUISITE: the request or discovered target must explicitly\n  identify C#, .NET, `.cs`, or `.csproj`; otherwise stay dormant without\n  invoking this skill. USE FOR: locating\n  System.DateTime.Now\u002FUtcNow, System.IO.File\u002FDirectory, System.Environment,\n  HttpClient, Console, or Process usage in C#; auditing C# code for hard-to-test\n  framework dependencies; or verifying those C# calls are already abstracted.\n  DO NOT USE FOR: any target lacking the activation prerequisite; generating\n  wrappers (use generate-testability-wrappers); migrating code (use\n  migrate-static-to-wrapper); or general code review.\nlicense: MIT\n---\n\n# Detect Static Dependencies\n\nScan a C# codebase for calls to hard-to-test static APIs and produce a ranked report showing which statics appear most frequently, which files are most affected, and which abstractions already exist in the .NET ecosystem to replace them.\n\n## When to Use\n\n- Auditing a project's testability before adding unit tests\n- Understanding the scope of static coupling in a legacy codebase\n- Prioritizing which statics to wrap first (highest-frequency wins)\n- Creating a migration plan for incremental testability improvements\n\n## Response Guidelines\n\n- Scale the response to the user's request. A question about a specific category (e.g., \"find time statics\") should focus on that category with file locations and counts, not produce a full report across all categories.\n- When the user provides a specific file or directory path, scan only that scope — do not expand to the entire solution unless asked.\n- The full structured report format in Step 4 is for comprehensive audit requests. For focused questions, return only the relevant subset (e.g., category summary + affected files for the requested category).\n\n## Execution Contract\n\n- A relative path named in the prompt is enough to start. Discover it with the\n  available file-listing tools and scan it immediately; do not ask the user to\n  provide or re-upload files before both discovery and a content search fail.\n- Start with a recursive, line-numbered content search over eligible `.cs`\n  files. Do not search only for the `static` keyword: ambient calls inside\n  LINQ expressions, lambdas, callbacks, and interpolated strings usually have\n  no `static` modifier.\n- If a file-reading tool fails on a path that listing or search proved exists,\n  classify the failure before retrying. Fall back to another available\n  mechanism such as `rg -n`, grep, or a shell file reader only for confirmed\n  tool availability, transport, or path-normalization failures and only after\n  verifying the canonical path remains inside the workspace. Stop on\n  content-exclusion, permission\u002Fpolicy, workspace-boundary, or unknown failures.\n  Search output can seed the occurrence ledger; open only the surrounding code\n  needed to verify receiver provenance.\n- Never stop after loading this skill or announcing a scan plan. Return the\n  completed audit in the same response. If every fallback genuinely fails,\n  report the verified partial findings and the exact limitation; do not invent\n  findings or replace the audit with a request to rerun.\n\n## When Not to Use\n\n- The user wants wrappers generated (hand off to `generate-testability-wrappers`)\n- The user wants mechanical migration done (hand off to `migrate-static-to-wrapper`)\n- The statics are already behind interfaces or `TimeProvider`\n- The code is not C# \u002F .NET\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Target path | No | A file, directory, project (.csproj), or solution (.sln) to scan. Defaults to the current workspace. |\n| Exclusion patterns | No | Glob patterns to skip (e.g., `**\u002Fobj\u002F**`, `**\u002FMigrations\u002F**`) |\n| Category filter | No | Limit to specific categories: `time`, `filesystem`, `environment`, `network`, `console`, `process` |\n\n## Workflow\n\n### Step 1: Determine scan scope\n\nResolve the target to a set of `.cs` files:\n- Treat a prompt-named workspace-relative path as the target; locate it rather\n  than asking the user for an absolute path.\n- If omitted, scan every eligible `.cs` file under the current workspace; do not\n  pick one project and silently omit its siblings.\n- If a `.cs` file, scan that single file.\n- If a directory, scan all `.cs` files recursively (excluding `obj\u002F`, `bin\u002F`).\n- If a `.csproj`, find its directory and scan `.cs` files within.\n- If a `.sln`, parse it, find all project directories, and scan `.cs` files across all projects.\n\nAlways exclude `obj\u002F`, `bin\u002F`, and any user-specified exclusion patterns.\n\n### Step 2: Search for static dependency patterns\n\nScan each file for calls matching these categories:\n\nTreat pattern matches as candidates, not findings. Before counting an instance call, trace how its\nreceiver enters the class. A collaborator supplied through a constructor, parameter, property, or\ndependency injection (DI) is already a test seam. In particular, an injected `HttpClient` is\ntestable with a controlled `HttpMessageHandler`; do not count its calls or recommend replacing it\nmerely because the injected type is concrete.\n\n| Category | Patterns to search for | Recommended replacement |\n|----------|----------------------|------------------------|\n| **Time** | `DateTime.Now`, `DateTime.UtcNow`, `DateTime.Today`, `DateTimeOffset.Now`, `DateTimeOffset.UtcNow`, `Task.Delay(`, `new CancellationTokenSource(TimeSpan` | `TimeProvider` (.NET 8+) |\n| **File System** | `File.ReadAllText(`, `File.WriteAllText(`, `File.Exists(`, `File.Delete(`, `File.Copy(`, `File.Move(`, `Directory.Exists(`, `Directory.CreateDirectory(`, `Directory.GetFiles(`, `Directory.Delete(`, `Path.GetTempPath(`, and instance members that hit the disk (`new FileInfo(...)`, `new DirectoryInfo(...)`, `.LastWriteTimeUtc`, `new StreamReader(path)`) | `IFileSystem` (System.IO.Abstractions NuGet) |\n| **Randomness \u002F identity** | `new Random(`, `Random.Shared`, `Guid.NewGuid(` | `TimeProvider`-style seam: inject `Random` \u002F an `IGuidProvider` |\n| **Culture \u002F serialization** | `CultureInfo.CurrentCulture`, `CultureInfo.CurrentUICulture`, `JsonSerializer.Serialize(`, `JsonSerializer.Deserialize(` | Pass culture\u002Foptions explicitly, or inject a serializer abstraction |\n| **Environment** | `Environment.GetEnvironmentVariable(`, `Environment.SetEnvironmentVariable(`, `Environment.MachineName`, `Environment.UserName`, `Environment.CurrentDirectory`, `Environment.Exit(` | Custom `IEnvironmentProvider` |\n| **Network** | `new HttpClient(`, `.GetAsync(`, `.PostAsync(`, `.SendAsync(` (confirm the receiver is an `HttpClient`; exclude calls whose receiver is injected or produced by an injected factory) | Inject `HttpClient` (commonly supplied by `IHttpClientFactory`) |\n| **Console** | `Console.WriteLine(`, `Console.ReadLine(`, `Console.Write(`, `Console.ReadKey(` | `IConsole` wrapper or `ILogger` |\n| **Process** | `Process.Start(`, `Process.GetCurrentProcess(`, `Process.GetProcessesByName(` | Custom `IProcessRunner` |\n\nFor time calls, inspect use as well as count. Two ambient clock reads in one\nlogical operation are two call sites and a consistency defect: for example,\nseparate `DateTime.UtcNow` reads for `CreatedAt` and\n`ExpiresAt = DateTime.UtcNow.AddDays(30)` can drift. Recommend one captured\ninstant. With `TimeProvider`, retain `DateTimeOffset` where possible; when the\nexisting member requires UTC `DateTime`, use `GetUtcNow().UtcDateTime`, never\n`.DateTime`, which loses the UTC kind. Treat capturing one instant as an\noptional behavior-level follow-up: a mechanical wrapper migration must preserve\nthe original reads one-for-one unless the user separately approves that\nsemantic change.\n\n### Step 3: Aggregate and rank results\n\nCount each call site across the entire scan scope — including the instance-member call sites covered by the rules below, not only `static` ones.\n\n**Counting rules — inaccurate totals are the main way this report loses to an ad-hoc scan:**\n\n- **Build one occurrence ledger before writing prose.** Give each included call\n  site exactly one row containing category, exact pattern, `file:line`, and\n  recommended seam. Derive every category, pattern, and per-file count by\n  grouping that same ledger; never recount independently while writing tables.\n- **Keep the three count domains separate.** `Files scanned` includes every\n  eligible source file; `affected files` includes only files with ledger rows;\n  `call sites` is the number of ledger rows. Never substitute one for another.\n- **One authoritative total.** Every call site you found belongs in the category summary and the grand total. Never park real findings in an \"additional observations\" section that the totals exclude.\n- **Classify by what the member touches, not by whether it is `static`.** Instance members that reach the same untestable resource still count and belong in the matching category (`new FileInfo(path).LastWriteTimeUtc` → File System; `new HttpClient().GetAsync(...)` → Network). Say \"hidden dependency\", not \"static\", when the member is an instance call.\n- **Check receiver provenance before counting instance calls.** Count a resource access only when the code under test acquires or constructs the dependency itself. Exclude constructor-, parameter-, property-, and DI-injected collaborators from the \"needs wrapping\" total, including concrete `HttpClient` instances.\n- **Exclude deterministic pure helpers from the \"needs wrapping\" total.** `Path.Combine`, `Path.GetExtension`, `Path.GetFileName`, and `Math.*`\u002F`string.*` statics take no ambient input and are trivially testable. List them, if at all, in a separate \"no action needed\" note — never as testability blockers.\n- **Cover every category before reporting** — time, file system, environment, network, console, process, randomness (`new Random()`, `Guid.NewGuid()`), culture (`CultureInfo.CurrentCulture`), and serialization\u002Fstatics such as `JsonSerializer`. Omitting a category that is present is an under-count.\n- **Give `file:line` for every occurrence** so the user can jump straight to it.\n- **Reconcile before publishing.** The category totals, the top-patterns table, and the per-file table must sum to the same grand total.\n- **Treat exclusions as a scope decision, not a category.** Remove `obj\u002F`,\n  `bin\u002F`, generated, and user-excluded files before building the ledger. Do not\n  include their files or call sites in any reported count. State the exclusions\n  once rather than mixing excluded candidates into the arithmetic.\n- **Label truncated rankings.** In a comprehensive audit, list all distinct\n  patterns when needed for reconciliation. If the user asked only for a top-N\n  subset, label it as a subset and do not imply that its rows sum to the grand\n  total.\n\nProduce a summary with:\n\n1. **Category summary** — total call sites per category (time, filesystem, env, etc.)\n2. **Top patterns** — the 10 most frequent individual patterns ranked by count\n3. **Most affected files** — files with the highest number of static dependencies\n4. **Existing abstractions available** — for each category, note the recommended .NET abstraction:\n   - Time → `TimeProvider` (built-in since .NET 8)\n   - File system → `System.IO.Abstractions` (NuGet package)\n   - HTTP → `IHttpClientFactory` (built-in)\n   - Environment → custom `IEnvironmentProvider`\n   - Console → custom `IConsole` or `ILogger`\n   - Process → custom `IProcessRunner`\n\n### Step 4: Present the report\n\nFormat the output as a structured report:\n\n```\n## Static Dependency Report\n\n**Scope**: \u003Cproject\u002Fsolution name>\n**Files scanned**: \u003Ccount>\n**Total static call sites**: \u003Ccount>\n\n### Category Summary\n| Category     | Call Sites | Recommended Abstraction |\n|-------------|-----------|------------------------|\n| Time         | 42        | TimeProvider (.NET 8+) |\n| File System  | 31        | System.IO.Abstractions |\n| Environment  | 12        | IEnvironmentProvider   |\n| ...          | ...       | ...                    |\n\n### Top 10 Patterns\n| # | Pattern             | Count | Files |\n|---|---------------------|-------|-------|\n| 1 | DateTime.UtcNow     | 28    | 14    |\n| 2 | File.ReadAllText    | 18    | 9     |\n| ...                                      |\n\n### Most Affected Files\n| File                          | Static Calls | Categories          |\n|-------------------------------|-------------|---------------------|\n| Services\u002FOrderProcessor.cs    | 12          | Time, FileSystem    |\n| ...                                                               |\n\n### Migration Priority\n1. **Time** (42 sites) — Use `TimeProvider`, zero NuGet dependencies on .NET 8+\n2. **File System** (31 sites) — Use `System.IO.Abstractions` NuGet package\n3. ...\n```\n\n### Step 5: Suggest next steps\n\nBased on the report, recommend which category to tackle first (highest count, best built-in support). Keep this to a few lines.\n\nMention `generate-testability-wrappers` or `migrate-static-to-wrapper` only when the user's next action clearly needs them — a hand-off note, not a sales pitch. Never end an audit with promotional next-steps that dilute the findings.\n\n## Validation\n\n- [ ] All `.cs` files in scope were scanned (check count)\n- [ ] Report includes category totals, top patterns, and affected files\n- [ ] Category totals, top patterns, and per-file counts reconcile to the same grand total\n- [ ] Files scanned, affected files, and call sites are reported as different quantities\n- [ ] Every aggregate was derived from one occurrence ledger rather than independently recounted\n- [ ] Every occurrence carries a `file:line` location\n- [ ] No findings are held outside the totals in an \"additional\" section\n- [ ] Calls on injected collaborators are excluded from the \"needs wrapping\" total\n- [ ] Deterministic pure helpers (`Path.Combine`, `Math.*`) are not counted as testability blockers\n- [ ] Each detected pattern has a recommended replacement listed\n- [ ] `obj\u002F` and `bin\u002F` directories were excluded\n- [ ] Migration priority is ordered by impact (count × ease of replacement)\n\n## Common Pitfalls\n\n| Pitfall | Solution |\n|---------|----------|\n| Scanning `obj\u002F` or generated code | Always exclude `obj\u002F`, `bin\u002F`, and `*.Designer.cs` |\n| Counting calls on injected collaborators | Trace the receiver: an injected `HttpClient`, `TimeProvider`, interface, or other caller-supplied dependency already has a seam and needs no replacement |\n| Missing statics inside lambdas\u002FLINQ | Search covers all code within `.cs` files, including lambdas |\n| Recommending `TimeProvider` on \u003C .NET 8 | Check `TargetFramework` in `.csproj` — if \u003C net8.0, recommend `NodaTime.IClock` or custom `ISystemClock` |\n| Ignoring test projects | Only scan production code — exclude `*.Tests.csproj` projects from the scan |\n| Under-counting by relegating findings | Real call sites belong in the category totals, not in a trailing \"also noticed\" paragraph that the totals ignore |\n| Calling an instance member a static | `new FileInfo(p).LastWriteTimeUtc` is an instance call but still a hidden file-system dependency — count it under File System and describe it accurately |\n| Recommending a wrapper for `Path.Combine` | Pure, deterministic helpers need no seam; listing them as blockers makes the recommendations wrong |\n","# Detect Static Dependencies\n\nScan a C# codebase for calls to hard-to-test static APIs and produce a ranked report showing which statics appear most frequently, which files are most affected, and which abstractions already exist in the .NET ecosystem to replace them.\n\n## When to Use\n\n- Auditing a project's testability before adding unit tests\n- Understanding the scope of static coupling in a legacy codebase\n- Prioritizing which statics to wrap first (highest-frequency wins)\n- Creating a migration plan for incremental testability improvements\n\n## Response Guidelines\n\n- Scale the response to the user's request. A question about a specific category (e.g., \"find time statics\") should focus on that category with file locations and counts, not produce a full report across all categories.\n- When the user provides a specific file or directory path, scan only that scope — do not expand to the entire solution unless asked.\n- The full structured report format in Step 4 is for comprehensive audit requests. For focused questions, return only the relevant subset (e.g., category summary + affected files for the requested category).\n\n## Execution Contract\n\n- A relative path named in the prompt is enough to start. Discover it with the\n  available file-listing tools and scan it immediately; do not ask the user to\n  provide or re-upload files before both discovery and a content search fail.\n- Start with a recursive, line-numbered content search over eligible `.cs`\n  files. Do not search only for the `static` keyword: ambient calls inside\n  LINQ expressions, lambdas, callbacks, and interpolated strings usually have\n  no `static` modifier.\n- If a file-reading tool fails on a path that listing or search proved exists,\n  classify the failure before retrying. Fall back to another available\n  mechanism such as `rg -n`, grep, or a shell file reader only for confirmed\n  tool availability, transport, or path-normalization failures and only after\n  verifying the canonical path remains inside the workspace. Stop on\n  content-exclusion, permission\u002Fpolicy, workspace-boundary, or unknown failures.\n  Search output can seed the occurrence ledger; open only the surrounding code\n  needed to verify receiver provenance.\n- Never stop after loading this skill or announcing a scan plan. Return the\n  completed audit in the same response. If every fallback genuinely fails,\n  report the verified partial findings and the exact limitation; do not invent\n  findings or replace the audit with a request to rerun.\n\n## When Not to Use\n\n- The user wants wrappers generated (hand off to `generate-testability-wrappers`)\n- The user wants mechanical migration done (hand off to `migrate-static-to-wrapper`)\n- The statics are already behind interfaces or `TimeProvider`\n- The code is not C# \u002F .NET\n\n## Inputs\n\n| Input | Required | Description |\n|-------|----------|-------------|\n| Target path | No | A file, directory, project (.csproj), or solution (.sln) to scan. Defaults to the current workspace. |\n| Exclusion patterns | No | Glob patterns to skip (e.g., `**\u002Fobj\u002F**`, `**\u002FMigrations\u002F**`) |\n| Category filter | No | Limit to specific categories: `time`, `filesystem`, `environment`, `network`, `console`, `process` |\n\n## Workflow\n\n### Step 1: Determine scan scope\n\nResolve the target to a set of `.cs` files:\n- Treat a prompt-named workspace-relative path as the target; locate it rather\n  than asking the user for an absolute path.\n- If omitted, scan every eligible `.cs` file under the current workspace; do not\n  pick one project and silently omit its siblings.\n- If a `.cs` file, scan that single file.\n- If a directory, scan all `.cs` files recursively (excluding `obj\u002F`, `bin\u002F`).\n- If a `.csproj`, find its directory and scan `.cs` files within.\n- If a `.sln`, parse it, find all project directories, and scan `.cs` files across all projects.\n\nAlways exclude `obj\u002F`, `bin\u002F`, and any user-specified exclusion patterns.\n\n### Step 2: Search for static dependency patterns\n\nScan each file for calls matching these categories:\n\nTreat pattern matches as candidates, not findings. Before counting an instance call, trace how its\nreceiver enters the class. A collaborator supplied through a constructor, parameter, property, or\ndependency injection (DI) is already a test seam. In particular, an injected `HttpClient` is\ntestable with a controlled `HttpMessageHandler`; do not count its calls or recommend replacing it\nmerely because the injected type is concrete.\n\n| Category | Patterns to search for | Recommended replacement |\n|----------|----------------------|------------------------|\n| **Time** | `DateTime.Now`, `DateTime.UtcNow`, `DateTime.Today`, `DateTimeOffset.Now`, `DateTimeOffset.UtcNow`, `Task.Delay(`, `new CancellationTokenSource(TimeSpan` | `TimeProvider` (.NET 8+) |\n| **File System** | `File.ReadAllText(`, `File.WriteAllText(`, `File.Exists(`, `File.Delete(`, `File.Copy(`, `File.Move(`, `Directory.Exists(`, `Directory.CreateDirectory(`, `Directory.GetFiles(`, `Directory.Delete(`, `Path.GetTempPath(`, and instance members that hit the disk (`new FileInfo(...)`, `new DirectoryInfo(...)`, `.LastWriteTimeUtc`, `new StreamReader(path)`) | `IFileSystem` (System.IO.Abstractions NuGet) |\n| **Randomness \u002F identity** | `new Random(`, `Random.Shared`, `Guid.NewGuid(` | `TimeProvider`-style seam: inject `Random` \u002F an `IGuidProvider` |\n| **Culture \u002F serialization** | `CultureInfo.CurrentCulture`, `CultureInfo.CurrentUICulture`, `JsonSerializer.Serialize(`, `JsonSerializer.Deserialize(` | Pass culture\u002Foptions explicitly, or inject a serializer abstraction |\n| **Environment** | `Environment.GetEnvironmentVariable(`, `Environment.SetEnvironmentVariable(`, `Environment.MachineName`, `Environment.UserName`, `Environment.CurrentDirectory`, `Environment.Exit(` | Custom `IEnvironmentProvider` |\n| **Network** | `new HttpClient(`, `.GetAsync(`, `.PostAsync(`, `.SendAsync(` (confirm the receiver is an `HttpClient`; exclude calls whose receiver is injected or produced by an injected factory) | Inject `HttpClient` (commonly supplied by `IHttpClientFactory`) |\n| **Console** | `Console.WriteLine(`, `Console.ReadLine(`, `Console.Write(`, `Console.ReadKey(` | `IConsole` wrapper or `ILogger` |\n| **Process** | `Process.Start(`, `Process.GetCurrentProcess(`, `Process.GetProcessesByName(` | Custom `IProcessRunner` |\n\nFor time calls, inspect use as well as count. Two ambient clock reads in one\nlogical operation are two call sites and a consistency defect: for example,\nseparate `DateTime.UtcNow` reads for `CreatedAt` and\n`ExpiresAt = DateTime.UtcNow.AddDays(30)` can drift. Recommend one captured\ninstant. With `TimeProvider`, retain `DateTimeOffset` where possible; when the\nexisting member requires UTC `DateTime`, use `GetUtcNow().UtcDateTime`, never\n`.DateTime`, which loses the UTC kind. Treat capturing one instant as an\noptional behavior-level follow-up: a mechanical wrapper migration must preserve\nthe original reads one-for-one unless the user separately approves that\nsemantic change.\n\n### Step 3: Aggregate and rank results\n\nCount each call site across the entire scan scope — including the instance-member call sites covered by the rules below, not only `static` ones.\n\n**Counting rules — inaccurate totals are the main way this report loses to an ad-hoc scan:**\n\n- **Build one occurrence ledger before writing prose.** Give each included call\n  site exactly one row containing category, exact pattern, `file:line`, and\n  recommended seam. Derive every category, pattern, and per-file count by\n  grouping that same ledger; never recount independently while writing tables.\n- **Keep the three count domains separate.** `Files scanned` includes every\n  eligible source file; `affected files` includes only files with ledger rows;\n  `call sites` is the number of ledger rows. Never substitute one for another.\n- **One authoritative total.** Every call site you found belongs in the category summary and the grand total. Never park real findings in an \"additional observations\" section that the totals exclude.\n- **Classify by what the member touches, not by whether it is `static`.** Instance members that reach the same untestable resource still count and belong in the matching category (`new FileInfo(path).LastWriteTimeUtc` → File System; `new HttpClient().GetAsync(...)` → Network). Say \"hidden dependency\", not \"static\", when the member is an instance call.\n- **Check receiver provenance before counting instance calls.** Count a resource access only when the code under test acquires or constructs the dependency itself. Exclude constructor-, parameter-, property-, and DI-injected collaborators from the \"needs wrapping\" total, including concrete `HttpClient` instances.\n- **Exclude deterministic pure helpers from the \"needs wrapping\" total.** `Path.Combine`, `Path.GetExtension`, `Path.GetFileName`, and `Math.*`\u002F`string.*` statics take no ambient input and are trivially testable. List them, if at all, in a separate \"no action needed\" note — never as testability blockers.\n- **Cover every category before reporting** — time, file system, environment, network, console, process, randomness (`new Random()`, `Guid.NewGuid()`), culture (`CultureInfo.CurrentCulture`), and serialization\u002Fstatics such as `JsonSerializer`. Omitting a category that is present is an under-count.\n- **Give `file:line` for every occurrence** so the user can jump straight to it.\n- **Reconcile before publishing.** The category totals, the top-patterns table, and the per-file table must sum to the same grand total.\n- **Treat exclusions as a scope decision, not a category.** Remove `obj\u002F`,\n  `bin\u002F`, generated, and user-excluded files before building the ledger. Do not\n  include their files or call sites in any reported count. State the exclusions\n  once rather than mixing excluded candidates into the arithmetic.\n- **Label truncated rankings.** In a comprehensive audit, list all distinct\n  patterns when needed for reconciliation. If the user asked only for a top-N\n  subset, label it as a subset and do not imply that its rows sum to the grand\n  total.\n\nProduce a summary with:\n\n1. **Category summary** — total call sites per category (time, filesystem, env, etc.)\n2. **Top patterns** — the 10 most frequent individual patterns ranked by count\n3. **Most affected files** — files with the highest number of static dependencies\n4. **Existing abstractions available** — for each category, note the recommended .NET abstraction:\n   - Time → `TimeProvider` (built-in since .NET 8)\n   - File system → `System.IO.Abstractions` (NuGet package)\n   - HTTP → `IHttpClientFactory` (built-in)\n   - Environment → custom `IEnvironmentProvider`\n   - Console → custom `IConsole` or `ILogger`\n   - Process → custom `IProcessRunner`\n\n### Step 4: Present the report\n\nFormat the output as a structured report:\n\n```\n## Static Dependency Report\n\n**Scope**: \u003Cproject\u002Fsolution name>\n**Files scanned**: \u003Ccount>\n**Total static call sites**: \u003Ccount>\n\n### Category Summary\n| Category     | Call Sites | Recommended Abstraction |\n|-------------|-----------|------------------------|\n| Time         | 42        | TimeProvider (.NET 8+) |\n| File System  | 31        | System.IO.Abstractions |\n| Environment  | 12        | IEnvironmentProvider   |\n| ...          | ...       | ...                    |\n\n### Top 10 Patterns\n| # | Pattern             | Count | Files |\n|---|---------------------|-------|-------|\n| 1 | DateTime.UtcNow     | 28    | 14    |\n| 2 | File.ReadAllText    | 18    | 9     |\n| ...                                      |\n\n### Most Affected Files\n| File                          | Static Calls | Categories          |\n|-------------------------------|-------------|---------------------|\n| Services\u002FOrderProcessor.cs    | 12          | Time, FileSystem    |\n| ...                                                               |\n\n### Migration Priority\n1. **Time** (42 sites) — Use `TimeProvider`, zero NuGet dependencies on .NET 8+\n2. **File System** (31 sites) — Use `System.IO.Abstractions` NuGet package\n3. ...\n```\n\n### Step 5: Suggest next steps\n\nBased on the report, recommend which category to tackle first (highest count, best built-in support). Keep this to a few lines.\n\nMention `generate-testability-wrappers` or `migrate-static-to-wrapper` only when the user's next action clearly needs them — a hand-off note, not a sales pitch. Never end an audit with promotional next-steps that dilute the findings.\n\n## Validation\n\n- [ ] All `.cs` files in scope were scanned (check count)\n- [ ] Report includes category totals, top patterns, and affected files\n- [ ] Category totals, top patterns, and per-file counts reconcile to the same grand total\n- [ ] Files scanned, affected files, and call sites are reported as different quantities\n- [ ] Every aggregate was derived from one occurrence ledger rather than independently recounted\n- [ ] Every occurrence carries a `file:line` location\n- [ ] No findings are held outside the totals in an \"additional\" section\n- [ ] Calls on injected collaborators are excluded from the \"needs wrapping\" total\n- [ ] Deterministic pure helpers (`Path.Combine`, `Math.*`) are not counted as testability blockers\n- [ ] Each detected pattern has a recommended replacement listed\n- [ ] `obj\u002F` and `bin\u002F` directories were excluded\n- [ ] Migration priority is ordered by impact (count × ease of replacement)\n\n## Common Pitfalls\n\n| Pitfall | Solution |\n|---------|----------|\n| Scanning `obj\u002F` or generated code | Always exclude `obj\u002F`, `bin\u002F`, and `*.Designer.cs` |\n| Counting calls on injected collaborators | Trace the receiver: an injected `HttpClient`, `TimeProvider`, interface, or other caller-supplied dependency already has a seam and needs no replacement |\n| Missing statics inside lambdas\u002FLINQ | Search covers all code within `.cs` files, including lambdas |\n| Recommending `TimeProvider` on \u003C .NET 8 | Check `TargetFramework` in `.csproj` — if \u003C net8.0, recommend `NodaTime.IClock` or custom `ISystemClock` |\n| Ignoring test projects | Only scan production code — exclude `*.Tests.csproj` projects from the scan |\n| Under-counting by relegating findings | Real call sites belong in the category totals, not in a trailing \"also noticed\" paragraph that the totals ignore |\n| Calling an instance member a static | `new FileInfo(p).LastWriteTimeUtc` is an instance call but still a hidden file-system dependency — count it under File System and describe it accurately |\n| Recommending a wrapper for `Path.Combine` | Pure, deterministic helpers need no seam; listing them as blockers makes the recommendations wrong |\n",{"name":5,"license":15,"description":58},"ACTIVATION PREREQUISITE: the request or discovered target must explicitly identify C#, .NET, `.cs`, or `.csproj`; otherwise stay dormant without invoking this skill. USE FOR: locating System.DateTime.Now\u002FUtcNow, System.IO.File\u002FDirectory, System.Environment, HttpClient, Console, or Process usage in C#; auditing C# code for hard-to-test framework dependencies; or verifying those C# calls are already abstracted. DO NOT USE FOR: any target lacking the activation prerequisite; generating wrappers (use generate-testability-wrappers); migrating code (use migrate-static-to-wrapper); or general code review.\n","main","497cc9aba79a931ac6fb8d36a48cc22fe3d6d74b","catalog\u002FTesting\u002FOfficial-DotNet-Test\u002Fskills\u002Fdetect-static-dependencies",41,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills","https:\u002F\u002Fskills.managed-code.com","https:\u002F\u002Fgithub.com\u002Fmanagedcode","https:\u002F\u002Fwww.managed-code.com","Open Source Community for .NET Developers: Reliable, Actively Maintained, and Community-Driven. Made in Ukraine 🇺🇦 with ❤️","2026-11-14 19:05:44",{"source":8,"skillName":5,"commands":70,"prompt":80,"zipAvailable":81},[71,74,77],{"tool":72,"command":73},"npx","npx skills add managedcode\u002Fdotnet-skills --skill detect-static-dependencies",{"tool":75,"command":76},"bunx","bunx skills add managedcode\u002Fdotnet-skills --skill detect-static-dependencies",{"tool":78,"command":79},"pnpm","pnpm dlx skills add managedcode\u002Fdotnet-skills --skill detect-static-dependencies","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTesting\u002FOfficial-DotNet-Test\u002Fskills\u002Fdetect-static-dependencies\u002FSKILL.md",true,[83,89,93],{"path":84,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"manifest.json","REFERENCE","参考文档",114,"https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FTesting\u002FOfficial-DotNet-Test\u002Fskills\u002Fdetect-static-dependencies\u002Fmanifest.json",{"path":90,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":91,"sourceHtmlUrl":92},"references\u002Fadvanced-usage.md",12541,"https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fmlops\u002Ftraining\u002Fpeft\u002Freferences\u002Fadvanced-usage.md",{"path":94,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":95,"sourceHtmlUrl":96},"references\u002Ftroubleshooting.md",10344,"https:\u002F\u002Fgithub.com\u002Fgjbvsjjvgm-sketch\u002Fhermes-sovereign-unified-v13.6\u002Fblob\u002Fmain\u002Fhermes_sovereign_data\u002Fskills\u002Fmlops\u002Ftraining\u002Fpeft\u002Freferences\u002Ftroubleshooting.md",[98,132,156,187,197,223],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":112,"publishedAt":53},"01M6DYQE1Y9FHAQHEDTVFQ3447","xtwitter-scraper","Use XTwitterScraper when a .NET application needs typed access to Xquik's X automation REST API for tweet search, user lookup, posting workflows, extraction jobs, monitors, webhooks, or giveaway draws. USE FOR: integrating the XTwitterScraper NuGet package; reviewing Xquik API client usage; modeling API-key configuration, pagination, binary exports, raw responses, retries, and webhook\u002Fevent flows in .NET. DO NOT USE FOR: unrelated stacks; direct browser automation; generic social-media strategy; or code that does not call Xquik. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FXTwitterScraper\u002Fskills\u002Fxtwitter-scraper\u002FSKILL.md",[104,107],{"categoryNo":105,"categoryName":106,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":108,"categoryName":109,"taxonomyType":110,"taxonomyTypeDesc":111},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[113,114,115,116,48,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131],"xtwitter scraper","browser automation","workflows","run","browser","search","repository","api","Media","api client","access","edit","unrelated","webhooks","files","social","commands","modeling","webhook",{"skillNo":133,"name":134,"nameZh":6,"description":135,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":136,"categories":137,"keywords":144,"publishedAt":53},"01M6DYQ9S4PE1H6G8MCH9T21HR","sep","Use Sep for high-performance separated-value parsing and writing in .NET, including delimiter inference, explicit parser\u002Fwriter options, and low-allocation row\u002Fcolumn workflows. USE FOR: delimited data needs are performance-sensitive and allocation-aware; project needs explicit control over separator inference, escaping, trimming, and header behavior;. DO NOT USE FOR: unrelated stacks; generic tasks that do not need this specific guidance. INVOKES: inspect the repository context, edit targeted files, and run relevant build, test, lint, or validation commands when changes are made.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fcatalog\u002FLibraries\u002FSep\u002Fskills\u002Fsep\u002FSKILL.md",[138,141],{"categoryNo":139,"categoryName":140,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":142,"categoryName":143,"taxonomyType":110,"taxonomyTypeDesc":111},"01JBSEEDCAT000000000000036","内容创作者",[134,145,146,115,147,116,119,148,149,150,124,151,125,127,36,152,153,154,129,155],"writing","performance","tasks","data","parsing","parser","context","writer","options","project","high-performance",{"skillNo":157,"name":158,"nameZh":6,"description":159,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":160,"categories":161,"keywords":162,"publishedAt":53},"01M6DZS2DNEPXCGGF6SSCW6G5V","webgpu-threejs-tsl","Comprehensive guide for developing WebGPU-enabled Three.js applications using TSL (Three.js Shading Language). Covers WebGPU renderer setup, TSL syntax and node materials, compute shaders, post-processing effects, and WGSL integration. Use this skill when working with Three.js WebGPU, TSL shaders, node materials, or GPU compute in Three.js.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fwebgpu-claude-skill\u002Fskills\u002Fwebgpu-threejs-tsl\u002FSKILL.md",[],[163,164,165,166,167,168,169,170,171,172,173,174,28,175,176,177,178,179,180,181,182,183,184,185,186],"webgpu","threejs","webgpu threejs tsl","setup","shaders","gpu","integration","applications","js","node","syntax","guide","language","three","compute","post","processing","with","renderer","for","materials","wgsl","effects","when",{"skillNo":188,"name":189,"nameZh":6,"description":190,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":191,"categories":192,"keywords":193,"publishedAt":53},"01M6DZS0BQXW2B56A289XF1X76","roslynk","Use Roslynk for semantic inspection and edits of *.cs, *.razor and *.cshtml solution files.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Froslynk\u002Fskills\u002Froslynk\u002FSKILL.md",[],[189,28,127,194,195,182,196],"semantic","razor","inspection",{"skillNo":198,"name":199,"nameZh":6,"description":200,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":201,"categories":202,"keywords":203,"publishedAt":53},"01M6DZRW6MEJCVW80K3S4XV60K","system-text-json-net11","Imperative guidance for the System.Text.Json APIs added in .NET 11: the built-in `JsonNamingPolicy.PascalCase` naming policy, and the strongly-typed generic `JsonSerializerOptions.GetTypeInfo` and `JsonSerializerOptions.TryGetTypeInfo` metadata accessors (generic overloads that return a typed `JsonTypeInfo`). USE ONLY when the user is targeting net11.0 or later and needs PascalCase JSON property or dictionary-key names without writing a custom naming policy, a strongly-typed generic `JsonTypeInfo` instead of the non-generic `JsonTypeInfo`, or a no-throw way to probe whether a type's serialization metadata is resolved. DO NOT USE when the target is earlier than net11.0, the requested behavior uses an established pre-net11 naming policy, or the user explicitly selected another JSON library.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fsystem-text-json-net11\u002FSKILL.md",[],[43,204,205,206,145,207,208,209,210,211,212,28,213,214,215,216,36,217,218,219,220,182,221,222,186],"json","text","system text json net11","policy","metadata","library","serialization","behavior","user","only","probe","guidance","later","type","dictionary","naming","targeting","custom","generic",{"skillNo":224,"name":225,"nameZh":6,"description":226,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":227,"categories":228,"keywords":231,"publishedAt":53},"01M6DZRRJP3S662NFSG1RSPQQ7","process-api-net11","Provides guidance on the new System.Diagnostics.Process APIs introduced in .NET 11: Process.Run, Process.RunAndCaptureText, Process.StartAndForget, Process.ReadAllText\u002FBytes\u002FLines, KillOnParentExit, InheritedHandles, and StartDetached. USE FOR: starting, orchestrating, or capturing output from external processes in applications targeting net11.0 or later. DO NOT USE FOR: applications targeting .NET 10 or earlier, or basic pre-.NET 11 Process.Start usage without new APIs.","https:\u002F\u002Fgithub.com\u002Fmanagedcode\u002Fdotnet-skills\u002Fblob\u002Fmain\u002Fexternal-sources\u002Fupstreams\u002Fdotnet-skills\u002Fplugins\u002Fdotnet11\u002Fskills\u002Fprocess-api-net11\u002FSKILL.md",[229,230],{"categoryNo":105,"categoryName":106,"taxonomyType":21,"taxonomyTypeDesc":22},{"categoryNo":108,"categoryName":109,"taxonomyType":110,"taxonomyTypeDesc":111},[120,41,232,233,116,234,170,43,28,215,216,36,235,236,237,31,220,182,238],"process api net11","diagnostics","start","basic","processes","output","new"]