detect-static-dependencies

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

1|Updated Jul 27, 2026
One-click install
npx skills add https://github.com/FittyAr/Cardscape --skill detect-static-dependencies-fittyar
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: detect-static-dependencies
Source: https://github.com/FittyAr/Cardscape/tree/main/.agents/skills/detect-static-dependencies
Command: npx skills add https://github.com/FittyAr/Cardscape --skill detect-static-dependencies-fittyar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Hard-to-test static calls like DateTime.Now, File.*, and new HttpClient() are scattered across C# codebases, making unit testing painful. This Skill audits your code, counts every static call site, and ranks them so you know exactly where testability debt lives and what to fix first. ## Core Features & Use Cases - Static Dependency Detection: Scans .cs files for six categories of untestable statics — time, file system, environment, network, console, and process. - Ranked Report: Produces a category summary, top 10 patterns by frequency, most affected files, and a migration priority list with recommended .NET abstractions like TimeProvider and System.IO.Abstractions. - Scoped Scanning: Accepts a single file, directory, .csproj, or .sln, automatically excluding obj/, bin/, and test projects. - Use Case: Before adding unit tests to a legacy ASP.NET Core service, run the scan on the solution to discover that DateTime.UtcNow appears 28 times across 14 files, then plan a TimeProvider migration. ## Quick Start Scan my C# solution for hard-to-test static dependencies and show me a ranked report of the most frequent patterns.

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(). The scan produces a ranked report showing call-site counts per category, the most frequent patterns, and the most affected files.

What replaces DateTime.Now for testable .NET code?▼

TimeProvider is the recommended replacement for DateTime.Now, DateTime.UtcNow, and DateTimeOffset.Now on .NET 8 and later. For earlier target frameworks, use NodaTime.IClock or a custom ISystemClock abstraction instead.

Can I scan a single file or project instead of a whole solution?▼

Yes, the scan accepts a single .cs file, a directory, a .csproj, or a .sln. Directories are scanned recursively while obj/, bin/, and user-specified exclusion patterns are always skipped.

What abstraction should I use for file system access in .NET tests?▼

Use the System.IO.Abstractions NuGet package, which provides IFileSystem wrappers for File.*, Directory.*, and Path.* calls. This lets you substitute in-memory file systems during unit tests.

When should I not run a static dependency scan?▼

Skip the scan when statics are already behind interfaces or TimeProvider, when the code is not C#/.NET, or when you want wrappers generated or migrations performed — those belong to separate wrapper-generation and migration skills.