Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
managedcode avatar

Detect Static Dependencies

  • 18 installs
  • 466 repo stars
  • Updated July 25, 2026
  • managedcode/dotnet-skills

Helps with ai & agent building tasks.

About

detect-static-dependencies is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.

  • detect-static-dependencies
  • AI & Agent Building
  • AI-coding skill

Detect Static Dependencies by the numbers

  • 18 all-time installs (skills.sh)
  • +1 installs in the week ending Aug 2, 2026 (Skillselion tracking)
  • Ranked #10,710 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
  • Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/managedcode/dotnet-skills --skill detect-static-dependencies

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs18
repo stars466
Last updatedJuly 25, 2026
Repositorymanagedcode/dotnet-skills

What it does

Helps with ai & agent building tasks.

Files

SKILL.mdMarkdownGitHub ↗

Detect Static Dependencies

Scan 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.

When to Use

  • Auditing a project's testability before adding unit tests
  • Understanding the scope of static coupling in a legacy codebase
  • Prioritizing which statics to wrap first (highest-frequency wins)
  • Creating a migration plan for incremental testability improvements

Response Guidelines

  • 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.
  • When the user provides a specific file or directory path, scan only that scope — do not expand to the entire solution unless asked.
  • 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).

When Not to Use

  • The user wants wrappers generated (hand off to generate-testability-wrappers)
  • The user wants mechanical migration done (hand off to migrate-static-to-wrapper)
  • The statics are already behind interfaces or TimeProvider
  • The code is not C# / .NET

Inputs

InputRequiredDescription
Target pathYesA file, directory, project (.csproj), or solution (.sln) to scan
Exclusion patternsNoGlob patterns to skip (e.g., **/obj/**, **/Migrations/**)
Category filterNoLimit to specific categories: time, filesystem, environment, network, console, process

Workflow

Step 1: Determine scan scope

Resolve the target to a set of .cs files:

  • If a .cs file, scan that single file.
  • If a directory, scan all .cs files recursively (excluding obj/, bin/).
  • If a .csproj, find its directory and scan .cs files within.
  • If a .sln, parse it, find all project directories, and scan .cs files across all projects.

Always exclude obj/, bin/, and any user-specified exclusion patterns.

Step 2: Search for static dependency patterns

Scan each file for calls matching these categories:

CategoryPatterns to search forRecommended replacement
TimeDateTime.Now, DateTime.UtcNow, DateTime.Today, DateTimeOffset.Now, DateTimeOffset.UtcNow, Task.Delay(, new CancellationTokenSource(TimeSpanTimeProvider (.NET 8+)
File SystemFile.ReadAllText(, File.WriteAllText(, File.Exists(, File.Delete(, File.Copy(, File.Move(, Directory.Exists(, Directory.CreateDirectory(, Directory.GetFiles(, Directory.Delete(, Path.Combine(, Path.GetTempPath(IFileSystem (System.IO.Abstractions NuGet)
EnvironmentEnvironment.GetEnvironmentVariable(, Environment.SetEnvironmentVariable(, Environment.MachineName, Environment.UserName, Environment.CurrentDirectory, Environment.Exit(Custom IEnvironmentProvider
Networknew HttpClient(, HttpClient.GetAsync(, HttpClient.PostAsync(, HttpClient.SendAsync(IHttpClientFactory (built-in)
ConsoleConsole.WriteLine(, Console.ReadLine(, Console.Write(, Console.ReadKey(IConsole wrapper or ILogger
ProcessProcess.Start(, Process.GetCurrentProcess(, Process.GetProcessesByName(Custom IProcessRunner

Step 3: Aggregate and rank results

Count each static call pattern across the entire scan scope. Produce a summary with:

1. Category summary — total call sites per category (time, filesystem, env, etc.) 2. Top patterns — the 10 most frequent individual patterns ranked by count 3. Most affected files — files with the highest number of static dependencies 4. Existing abstractions available — for each category, note the recommended .NET abstraction:

  • Time → TimeProvider (built-in since .NET 8)
  • File system → System.IO.Abstractions (NuGet package)
  • HTTP → IHttpClientFactory (built-in)
  • Environment → custom IEnvironmentProvider
  • Console → custom IConsole or ILogger
  • Process → custom IProcessRunner

Step 4: Present the report

Format the output as a structured report:

## Static Dependency Report

**Scope**: <project/solution name>
**Files scanned**: <count>
**Total static call sites**: <count>

### Category Summary
| Category     | Call Sites | Recommended Abstraction |
|-------------|-----------|------------------------|
| Time         | 42        | TimeProvider (.NET 8+) |
| File System  | 31        | System.IO.Abstractions |
| Environment  | 12        | IEnvironmentProvider   |
| ...          | ...       | ...                    |

### Top 10 Patterns
| # | Pattern             | Count | Files |
|---|---------------------|-------|-------|
| 1 | DateTime.UtcNow     | 28    | 14    |
| 2 | File.ReadAllText    | 18    | 9     |
| ...                                      |

### Most Affected Files
| File                          | Static Calls | Categories          |
|-------------------------------|-------------|---------------------|
| Services/OrderProcessor.cs    | 12          | Time, FileSystem    |
| ...                                                               |

### Migration Priority
1. **Time** (42 sites) — Use `TimeProvider`, zero NuGet dependencies on .NET 8+
2. **File System** (31 sites) — Use `System.IO.Abstractions` NuGet package
3. ...

Step 5: Suggest next steps

Based on the report, recommend:

  • Which category to tackle first (fewest dependencies, best built-in support)
  • Whether to use generate-testability-wrappers for custom wrapper generation
  • Whether to use migrate-static-to-wrapper for mechanical bulk migration

Validation

  • [ ] All .cs files in scope were scanned (check count)
  • [ ] Report includes category totals, top patterns, and affected files
  • [ ] Each detected pattern has a recommended replacement listed
  • [ ] obj/ and bin/ directories were excluded
  • [ ] Migration priority is ordered by impact (count × ease of replacement)

Common Pitfalls

PitfallSolution
Scanning obj/ or generated codeAlways exclude obj/, bin/, and *.Designer.cs
Counting wrapped calls as staticsCheck if the call is behind an interface or injected service before counting
Missing statics inside lambdas/LINQSearch covers all code within .cs files, including lambdas
Recommending TimeProvider on < .NET 8Check TargetFramework in .csproj — if < net8.0, recommend NodaTime.IClock or custom ISystemClock
Ignoring test projectsOnly scan production code — exclude *.Tests.csproj projects from the scan

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.