
Description
Migrate Static to Wrapper is an agent skill for replacing static dependency calls in C# code with calls to injected wrapper interfaces or built-in abstractions. A typical change is moving DateTime.UtcNow or DateTime.Now to TimeProvider.GetUtcNow(), or moving File calls to an IFileSystem abstraction. The work is mechanical and codemod-style, and it runs over a bounded scope such as one file, one project or one namespace, so a migration can be done in steps. It adds constructor injection for the new abstraction to the affected classes. For a static utility class that needs to be testable, it can add an ambient seam while the existing call sites keep compiling unchanged. When the requested migration names the replacement, it also updates the affected tests with fakes. The skill is meant to run after wrappers have been generated with the generate-testability-wrappers skill, or after built-in abstractions have been identified for the calls in question. It is part of the dotnet/skills repository on GitHub.…
Highlights
- Replaces DateTime and File calls with injected abstractions
- Runs over one file, project or namespace at a time
- Adds constructor injection to affected classes
- Updates tests with fakes for the new abstraction
Ratings & Reviews
No ratings yet
Be the first to rate migrate-static-to-wrapper.
People also visit

dotnet-best-practices
Validate .NET/C# code against comprehensive best practices for your solution
migrate-static-to-wrapper FAQ
What does this skill do?
It rewrites static calls such as DateTime.UtcNow or File.* into calls on an injected wrapper or a built-in abstraction, across a scope you choose.
How do I install it?
Run npx skills add https://github.com/dotnet/skills --skill migrate-static-to-wrapper in your project.
Is it free?
Yes. The skill page lists its pricing as Free.
Does it need other skills first?
It is meant to follow generate-testability-wrappers or come after built-in abstractions have been chosen for the calls.
What do the security audits say?
Gen Agent Trust Hub: Pass. Socket: Pass. Snyk: Pass.
What are the best migrate-static-to-wrapper alternatives?
Popular alternatives to migrate-static-to-wrapper include testability-obstacle, csharp-refactoring and modern-csharp-coding-standards. See all migrate-static-to-wrapper alternatives






