generate-testability-wrappers

Generate wrapper interfaces and DI registration code for C# static dependencies.

Updated May 28, 2026
One-click install
npx skills add https://github.com/ojrojas/AgentsInstructions --skill generate-testability-wrappers-ojrojas
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: generate-testability-wrappers
Source: https://github.com/ojrojas/AgentsInstructions/tree/main/.claude/skills/dotnet-test/skills/generate-testability-wrappers
Command: npx skills add https://github.com/ojrojas/AgentsInstructions --skill generate-testability-wrappers-ojrojas

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Microsoft.Extensions.DependencyInjection, System.IO.Abstractions, and includes scripts (resource) components.

What problem does it solve?

This Skill addresses the challenge of making hard-to-test static C# dependencies testable, by generating wrapper interfaces and dependency injection registration.

Core Features & Use Cases

  • Automated Wrapper Generation: Generates wrapper interfaces and default implementations for static dependencies like DateTime.Now and File.ReadAllText.
  • Built-in Abstraction Adoption: Guides the use of built-in abstractions like TimeProvider and IHttpClientFactory.
  • Custom Wrapper Creation: For statics without built-in abstractions, creates custom wrappers to replace them.
  • DI Registration: Generates code to register the wrappers with the dependency injection container.

Quick Start

Run the skill by providing the category of static dependency and target framework. Example: generate-testability-wrappers time net8 to generate wrappers for TimeProvider on .NET 8.

Frequently Asked Questions about generate-testability-wrappers

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

FAQPage Schema
How do I make C# static dependencies mockable for unit testing?

To make C# static dependencies mockable, you generate wrapper interfaces and default implementations for them, then register these wrappers with the dependency injection container. This allows mocking static calls during unit testing.

How do I generate testability wrappers for static dependencies in .NET?

You generate testability wrappers for .NET static dependencies by running the skill with a static dependency category and target framework, like `generate-testability-wrappers time net8`, which outputs interfaces, implementations, and DI registration code.

Does .NET provide built-in abstractions for mocking static dependencies like DateTime?

.NET provides built-in abstractions for mocking static dependencies like DateTime by adopting features such as TimeProvider and IHttpClientFactory, which natively support dependency injection and testability without requiring custom wrappers.

What is the best way to register mockable interfaces with dependency injection in C#?

The best way to register mockable interfaces with dependency injection in C# is to generate DI configuration code alongside the wrapper interfaces, ensuring the container maps the new abstractions to their default implementations automatically.

Do I need Microsoft.Extensions.DependencyInjection to create mockable wrappers for static C# code?

Yes, you need Microsoft.Extensions.DependencyInjection to create mockable wrappers for static C# code, because the generated DI registration code relies on this container to inject the wrapper interfaces into your .NET application.

When should I create custom wrappers instead of using built-in .NET abstractions for testing?

You should create custom wrappers instead of using built-in .NET abstractions for testing when your static dependencies lack native alternatives, allowing you to generate tailored interfaces and implementations to replace untestable static calls.