detect-static-dependencies

Scan C# source files for hard-to-test static dependencies and produce a ranked report.

1|Updated Jun 1, 2026
One-click install
npx skills add https://github.com/D1ssolve/craft-agents --skill detect-static-dependencies-d1ssolve
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: detect-static-dependencies
Source: https://github.com/D1ssolve/craft-agents/tree/main/skills/detect-static-dependencies
Command: npx skills add https://github.com/D1ssolve/craft-agents --skill detect-static-dependencies-d1ssolve

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Legacy C# codebases often hide untestable static calls like DateTime.Now, File.*, and HttpClient throughout the code, making unit testing painful. This Skill audits your code and shows exactly where static coupling lives and how severe it is. ## Core Features & Use Cases - Static Dependency Detection: Scans .cs files for time, filesystem, environment, network, console, and process static call patterns. - Ranked Report: Produces category summaries, top 10 patterns by frequency, most affected files, and migration priorities. - Replacement Guidance: Maps each category to a recommended .NET abstraction such as TimeProvider, System.IO.Abstractions, or IHttpClientFactory. - Use Case: Before adding unit tests to a legacy solution, run a scan to find that DateTime.UtcNow appears 28 times across 14 files, then prioritize wrapping time statics first. ## Quick Start Scan the src/ directory of my C# solution for untestable static dependencies and give me a ranked report.

Frequently Asked Questions about detect-static-dependencies

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find untestable static dependencies in C# code?

Scan your .cs files for patterns like DateTime.Now, File.ReadAllText, Environment.GetEnvironmentVariable, and new HttpClient(). This Skill searches a file, directory, project, or solution and returns a ranked report of static call sites by frequency.

What replaces DateTime.Now for testable C# code?

Use TimeProvider, which is built into .NET 8 and later, to abstract time access for unit testing. On earlier target frameworks, use NodaTime.IClock or a custom ISystemClock interface instead.

Can I scan only part of a .NET solution for static calls?

Yes, you can scope the scan to a single .cs file, a directory, a .csproj, or a full .sln. You can also filter by category such as time, filesystem, or network, and exclude paths with glob patterns.

Does the static dependency scan include test projects?

No, test projects matching *.Tests.csproj should be excluded so only production code is audited. The scan also always skips obj/ and bin/ directories and generated files like *.Designer.cs.

When should I not use a static dependency scan?

Skip it when statics are already behind interfaces or TimeProvider, when the code is not C#, or when you want wrappers generated or migration performed. Those tasks belong to wrapper-generation and migration skills instead.