generate-testability-wrappers
Generate wrapper interfaces and DI registration for hard-to-test static dependencies in C#, when the abstraction does NOT exist yet. Produces IFileSystem, IEnvironmentProvider, IConsole, IProcessRunner wrappers, or guides first-time adoption of TimeProvider and IHttpClientFactory. With no DI container, produces the ambient context seam instead. USE FOR: generate wrapper for static, create IFileSystem wrapper, wrap DateTime.Now, make a static or a class testable, create abstraction for File.*, generate DI registration, adopt TimeProvider when it is not registered yet, IHttpClientFactory setup,
npx skills add dotnet/skills --skill generate-testability-wrappers --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Generate Testability Wrappers Generate wrapper interfaces, default implementations, and DI service registration code for untestable static dependencies. For statics that already have .NET built-in abstractions (`TimeProvider`, `IHttpClientFactory`), guide adoption of the built-in. For statics without built-in alternatives, generate custom minimal wrappers. ## When to Use - After running `detect-static-dependencies` and identifying which statics to wrap - When the user asks to make a class testable by replacing statics with injected abstractions - When adopting `TimeProvider` (.NET 8+) or `System.IO.Abstractions` - When creating a custom wrapper for `Environment.*`, `Console.*`, or `Process.*` - When there is no DI container and the seam has to be ambient rather than injected ## When Not to Use - The user wants to find statics first (use `detect-static-dependencies`) - The user wants to bulk-replace call sites (use `migrate-static-to-wrapper`) - The static is already behind an interface > A project with **no DI container**, or a user who does not want to add one, is **not** a reason to skip this skill — > that is exactly what the ambient context seam in Step 5 is for. Choose the s
- When to Use
- When Not to Use
- Inputs
- Workflow
- Step 1: Determine the abstraction strategy
- Step 2: Generate built-in abstraction adoption (Time, HTTP)
- Step 3: Generate custom wrappers (Environment, Console, Process)
- Step 4: Generate file system wrapper adoption
- Step 5: Generate ambient context alternative (when DI is not available)
- Step 6: Place generated files
- Validation
- Common Pitfalls
What does the generate-testability-wrappers skill do?
Generate wrapper interfaces and DI registration for hard-to-test static dependencies in C#, when the abstraction does NOT exist yet. Produces IFileSystem, IEnvironmentProvider, IConsole, IProcessRunner wrappers, or guides first-time adoption of TimeProvider and IHttpClientFactory. With no DI container, produces the ambient context seam instead. USE FOR: generate wrapper for static, create IFileSystem wrapper, wrap DateTime.Now, make a static or a class testable, create abstraction for File.*, generate DI registration, adopt TimeProvider when it is not registered yet, IHttpClientFactory setup,
How do I install it?
Run `npx skills add dotnet/skills --skill generate-testability-wrappers --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From dotnet/skills, a repository with 4,927 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
