Official agent skill

Detect Static Dependencies

by microsoft in microsoft/testfx

Scan C source files for hard-to-test static dependencies — DateTime.Now/UtcNow, File., Directory., Environment., HttpClient, Console., Process., and other untestable statics.

OfficialMITAuto-check passedDevelopment

Install Detect Static Dependencies

skills CLI
$ npx skills add microsoft/testfx --skill detect-static-dependencies -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install microsoft/testfx detect-static-dependencies --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/microsoft/testfx.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/detect-static-dependencies .claude/skills/detect-static-dependencies && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
detect-static-dependencies
GitHub stars
1k
Token cost
~1.9k tokens
SKILL.md length
657 words
Files
1
Skills in repo
44
Repo updated
First seen
Licence
MIT

At a glance

Scan C source files for hard-to-test static dependencies — DateTime.Now/UtcNow, File., Directory., Environment., HttpClient, Console., Process., and other untestable statics.

  • Works in 5 steps: Determine scan scope → Search for static dependency patterns → Aggregate and rank results → …
  • : find untestable statics
  • SKILL.md covers When to Use, Response Guidelines, When Not to Use and Inputs, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Detect Static Dependencies is an agent skill from microsoft/testfx, published by the product's own GitHub organization. Scan C source files for hard-to-test static dependencies — DateTime.Now/UtcNow, File., Directory., Environment., HttpClient, Console., Process., and other untestable statics. Produces a ranked report of static call sites by frequency. USE FOR: find untestable statics, scan for static dependencies, testability audit, identify hard-to-mock code, find DateTime.Now usage, detect static coupling, testability report, static analysis for testability. DO NOT USE FOR: generating wrappers (use…

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Static analysis and SAST. It works with C#. The repository describes itself as: This repository holds the source code of Microsoft.Testing.Platform (MTP), a lightweight alternative to VSTest, as well as MSTest adapter and framework. The licence is MIT.

When your agent uses it

  • : find untestable statics
  • Scan for static dependencies
  • Testability audit
  • Identify hard-to-mock code

Example prompts

  • “/detect-static-dependencies”

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Determine scan scope
  2. Search for static dependency patterns
  3. Aggregate and rank results
  4. Present the report
  5. Suggest next steps

What it can do on your machine

Read from SKILL.md and the folder at commit 44b9dcc. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Detect Static Dependencies loads about 1.9k tokens when it runs. Until then it costs about 170 tokens; SKILL.md has 657 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~170
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from microsoft/testfx at commit 44b9dcc, republished under its MIT licence (© microsoft). 657 words, ~1,920 tokens.

Download SKILL.mdSave it as .claude/skills/detect-static-dependencies/SKILL.md (or your agent's skills folder).
name
detect-static-dependencies
description
Scan C# source files for hard-to-test static dependencies — DateTime.Now/UtcNow, File.*, Directory.*, Environment.*, HttpClient, Console.*, Process.*, and other untestable statics. Produces a ranked report of static call sites by frequency. USE FOR: find untestable statics, scan for static dependencies, testability audit, identify hard-to-mock code, find DateTime.Now usage, detect static coupling, testability report, static analysis for testability. DO NOT USE FOR: generating wrappers (use generate-testability-wrappers), migrating code (use migrate-static-to-wrapper), general code review, or finding statics that are already behind abstractions.
license
MIT

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
Show full SKILL.md (259 more words)Show less
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

© microsoft, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/detect-static-dependencies of microsoft/testfx.

Open the folder on GitHubat commit 44b9dcc

Compare with similar skills

Detect Static Dependencies next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Detect Static Dependencies compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Detect Static Dependencies this skillmicrosoft/testfx1k—~1.9kAutomated safety check: PassMIT
Roslynatormanagedcode/dotnet-skills486—~1.3kAutomated safety check: PassMIT
Mcaf Dotnet Roslynatormanagedcode/Storage138—~1.2kAutomated safety check: PassMIT
Find Untested Sourcesdotnet/skills5.6k1 repos~3.3kAutomated safety check: PassMIT
New Rule for sonar-javaSonarSource/sonar-java1.2k—~833Automated safety check: PassCustom licence
Golang Continuous Integrationsamber/cc-skills-golang3.4k—~3.7kAutomated safety check: PassMIT

Similar skills

  • Roslynator

    managedcode/dotnet-skills

    Use the open-source free Roslynator analyzer packages and optional CLI for .NET.

    486 GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Mcaf Dotnet Roslynator

    managedcode/Storage

    Use the open-source free Roslynator analyzer packages and optional CLI for .NET.

    138 GitHub stars~1.2k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Official

    Statically pairs source files with test files to list code that no test references, using Roslyn for C# or tree-sitter for many languages, with no build.

    5.6k GitHub starsUsed in 1 repo~3.3k tokens
    Testing & QAAuto-check passed
  • New Rule for sonar-java

    SonarSource/sonar-java

    Official

    Sets the sonar-java conventions for adding an analyzer rule: metadata from rule-api, test locations, MethodMatchers and what not to commit or change.

    1.2k GitHub stars~833 tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Golang Continuous Integration

    samber/cc-skills-golang

    GitHub Actions CI/CD pipeline configuration for Golang projects — workflow files for test, lint, SAST, coverage and vulnerability-scan jobs, Dependabot and Renovate config files, GoReleaser release…

    3.4k GitHub stars~3.7k tokensUpdated 6 days ago
    DevelopmentAuto-check passed
  • Arandu Doctor Findings

    arandu-io/arandu

    Explains what each aru doctor architecture-check finding means in the Arandu Go framework, why it is never suppressed, and how to fix the line it points to.

    281 GitHub stars~1.2k tokensUpdated 3 days ago
    DevelopmentAuto-check passed

More from microsoft/testfx

All 44 skills in this repo
  • Official

    Guide for organizing MSBuild infrastructure with Directory.Build.props, Directory.Build.targets, Directory.Packages.props, and Directory.Build.rsp.

    1k GitHub starsUsed in 1 repo~2.5k tokens
    Auto-check passed
  • Binlog Failure Analysis

    microsoft/testfx

    Official

    Analyze MSBuild binary logs to diagnose build failures. An agent skill from microsoft/testfx.

    1k GitHub starsUsed in 3 repos~730 tokens
    Auto-check passed
  • Coverage Analysis

    microsoft/testfx

    Official

    Project-wide code coverage and CRAP (Change Risk Anti-Patterns) score analysis for .NET projects.

    1k GitHub stars~7.3k tokensUpdated today
    Auto-check passed
  • Incremental Build

    microsoft/testfx

    Official

    Guide for optimizing MSBuild incremental builds. An agent skill from microsoft/testfx.

    1k GitHub starsUsed in 3 repos~3.7k tokens
    Auto-check passed
  • Msbuild Modernization

    microsoft/testfx

    Official

    Guide for modernizing and migrating MSBuild project files to SDK-style format.

    1k GitHub starsUsed in 3 repos~4.3k tokens
    Auto-check passed
  • Msbuild Antipatterns

    microsoft/testfx

    Official

    Catalog of MSBuild anti-patterns with detection rules and fix recipes.

    1k GitHub stars~4.5k tokensUpdated today
    Auto-check passed

Works with

Questions about Detect Static Dependencies

What does Detect Static Dependencies do?

Scan C source files for hard-to-test static dependencies — DateTime.Now/UtcNow, File., Directory., Environment., HttpClient, Console., Process., and other untestable statics. Detect Static Dependencies is an agent skill from microsoft/testfx, published by the product's own GitHub organization., and other untestable statics.

When should I use Detect Static Dependencies?

Detect Static Dependencies fits situations like: : find untestable statics; scan for static dependencies; testability audit; identify hard-to-mock code.

How do I install Detect Static Dependencies in Claude Code?

Run `npx skills add microsoft/testfx --skill detect-static-dependencies -a claude-code`. Or copy the skill folder (.agents/skills/detect-static-dependencies in microsoft/testfx) into .claude/skills/detect-static-dependencies in your project. Claude Code loads it when a task matches its description.

How do I install Detect Static Dependencies in Codex?

Run `npx skills add microsoft/testfx --skill detect-static-dependencies -a codex`. Or copy the skill folder (.agents/skills/detect-static-dependencies in microsoft/testfx) into .agents/skills/detect-static-dependencies in your project. Codex loads it when a task matches its description.

Can I use Detect Static Dependencies in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add microsoft/testfx --skill detect-static-dependencies -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/detect-static-dependencies, .gemini/skills/detect-static-dependencies, .github/skills/detect-static-dependencies and .opencode/skills/detect-static-dependencies in your project.

What does Detect Static Dependencies need to run?

SKILL.md names no scripts, command-line tools or credentials: Detect Static Dependencies is instructions for the agent only.

Does Detect Static Dependencies access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Detect Static Dependencies safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Detect Static Dependencies use?

Detect Static Dependencies is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Detect Static Dependencies use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Detect Static Dependencies?

Skills that share tags, products or a category with Detect Static Dependencies: Roslynator (managedcode/dotnet-skills, 486 stars), Mcaf Dotnet Roslynator (managedcode/Storage, 138 stars), Find Untested Sources (dotnet/skills, 5.6k stars) and New Rule for sonar-java (SonarSource/sonar-java, 1.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Detect Static Dependencies?

microsoft (a GitHub organization, an official publisher) maintains it in microsoft/testfx, which has 1,047 GitHub stars. The repository holds 44 skills in this directory. The repository was last updated on October 7, 2026.

Source: microsoft/testfx on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.