ada-dotnet-engineering-refactoring

Guides multi-phase engineering-grade refactoring of C#/.NET/Blazor codebases with verified patterns.

Updated Jul 23, 2026
One-click install
npx skills add https://github.com/wubing7755/Ada --skill ada-dotnet-engineering-refactoring-wubing7755
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ada-dotnet-engineering-refactoring
Source: https://github.com/wubing7755/Ada/tree/main/skills/software-development/ada-dotnet-engineering-refactoring
Command: npx skills add https://github.com/wubing7755/Ada --skill ada-dotnet-engineering-refactoring-wubing7755

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Refactoring a .NET codebase beyond superficial cleanup is risky and inconsistent: value-type migrations ripple across tests, god classes resist safe splitting, and public API surfaces accumulate stale members. This Skill provides proven, phase-ordered patterns that elevate C#/.NET/Blazor code to human-maintainable engineering quality with build-test-format verification at every step. ## Core Features & Use Cases - Domain Primitive Value Types: Replace bare string/double with constrained types (Ratio, PanelId, TabId) including IEquatable, conversion operators, and custom JsonConverter support for .NET 6 compatibility. - Structural Decomposition: Orchestrator-to-helper extraction, CommandBase guard extraction, god-class partial file splitting, and Blazor component extraction with @key and callback patterns. - Phased Workflow & Verification: A six-phase ordering that minimizes rework, plus regex catalogs for bulk test repair, public API stabilization with reflection tests, and closeout audit procedures. - Use Case: A team inherits a Blazor dock layout library with stringly-typed IDs and a 1000-line LayoutContext. Use this Skill to migrate to domain primitives first, extract TabOperations, stabilize the public API, and finish with a green build/test/format verification checklist. ## Quick Start Ask the agent to perform an engineering-grade refactoring of your .NET solution, starting with domain primitive value types and verifying each phase with dotnet build, test, and format.

Frequently Asked Questions about ada-dotnet-engineering-refactoring

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

FAQPage Schema
How do I refactor C# code to use domain primitive value types?

Replace bare string or double fields with readonly struct types that enforce constraints at construction, such as Ratio clamping to [0,1] or PanelId rejecting null values. Add manual IEquatable for .NET 6, implicit/explicit conversion operators, and a custom JsonConverter for serialization.

What is the correct phase order for a large .NET refactoring?

Start with domain primitives because they have the widest ripple effect, then API naming and catch tightening, orchestrator extraction, base class extraction, dead field removal, and finally Blazor template extraction. Each phase ends with dotnet build, dotnet test, and dotnet format.

Does this refactoring approach work on .NET 6?

Yes, all patterns are .NET 6 compatible. Use manual readonly struct with IEquatable instead of record struct, and use the RegisterElementRef callback pattern instead of @ref lambdas in Blazor, which .NET 6 does not support.

How do I fix hundreds of broken tests after a value type migration?

Apply the regex catalog for bulk fixes of constructor calls, method calls, and property assignments across test files, then run dotnet build and manually patch remaining errors like Assert.Equal comparisons and variable type changes. Finish with a full dotnet test run.

When should I not use engineering-grade refactoring?

Do not use it for simple bug fixes, single-file cleanup, pre-commit formatting, or one-off mechanical deduplication. It is designed for multi-phase architectural work where the codebase must be handed off to human maintainers, and for non-.NET projects a generic refactoring skill applies instead.

How do I safely split a god class in C# without changing behavior?

Split it into a thin shell plus partial files organized by responsibility, moving members verbatim with zero behavior or API change. Use a script-based split that handles attributes, XML doc comments, and LF normalization, then verify with dotnet build, test, and format checks.