migrate-static-to-wrapper

Installation
SKILL.md

Migrate Static to Wrapper

Perform mechanical, codemod-style replacement of static dependency call sites with calls to injected wrapper interfaces or built-in abstractions. Operates on a bounded scope (single file, project, or namespace) so migrations can be done incrementally.

When to Use

  • After wrappers have been generated (via generate-testability-wrappers) or built-in abstractions identified
  • Migrating DateTime.UtcNow → TimeProvider.GetUtcNow() across a project
  • Migrating File.* → IFileSystem.File.* across a namespace
  • Adding constructor injection for the new abstraction to affected classes
  • Making a static utility class testable by adding an ambient seam (Step 3) while its existing call sites keep compiling unchanged
  • Incremental migration: one project or namespace at a time
  • Updating affected tests with fakes when the requested migration names the replacement abstraction

When Not to Use

Installs
2.1K
Repository
dotnet/skills
GitHub Stars
5.5K
First Seen
Apr 13, 2026
migrate-static-to-wrapper — dotnet/skills