code-simplification

Simplifies C# and .NET code for readability while preserving exact behavior.

7|Updated Jan 11, 2026
One-click install
npx skills add https://github.com/peterblazejewicz/claude-plugins --skill code-simplification-peterblazejewicz
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: code-simplification
Source: https://github.com/peterblazejewicz/claude-plugins/tree/main/plugins/dotnet-skills/skills/code-simplification
Command: npx skills add https://github.com/peterblazejewicz/claude-plugins --skill code-simplification-peterblazejewicz

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Working code often accumulates unnecessary complexity — deep nesting, long methods, unclear names, and duplicated logic — making it harder to read, maintain, and extend. This Skill provides a disciplined, behavior-preserving process for simplifying .NET/C# code without introducing regressions. ## Core Features & Use Cases - Behavior-Preserving Refactoring: Applies five principles (preserve behavior, follow project conventions, prefer clarity, maintain balance, scope to changes) so every simplification keeps inputs, outputs, side effects, and error behavior identical. - Concrete Pattern Detection: Identifies specific signals like 3+ level nesting, 50+ line methods, nested ternaries, boolean parameter flags, dead code, and over-engineered abstractions, each paired with a targeted simplification. - C# / .NET Guidance: Includes .NET-specific examples such as async wrapper unwrapping (with three cases where await must be kept), switch expressions, LINQ conversion, null-coalescing, and record structs, plus TypeScript, Python, and React examples. - Use Case: After shipping a feature whose implementation grew messy under time pressure, run a simplification pass that refactors incrementally, runs dotnet test after each change, and produces a clean, reviewable diff. ## Quick Start Ask the agent to simplify the recently modified C# code in this project while preserving behavior and keeping all existing tests passing.

Frequently Asked Questions about code-simplification

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

FAQPage Schema
How do I refactor C# code without changing its behavior?

Make one simplification at a time and run the test suite after each change. Verify that inputs, outputs, exception types, side effects, and edge cases remain identical, and revert any change that breaks existing tests.

When should I remove async and await from a C# method?

Remove the async wrapper only when the method does nothing but forward the inner Task. Keep await when using try/catch for exception handling, when using or await using blocks must wrap the actual I/O, or when logic after the call needs the unwrapped result.

What code patterns indicate C# code needs simplification?

Look for nesting deeper than three levels, methods over 50 lines, nested ternaries, boolean parameter flags, generic names like data or temp, duplicated logic blocks, dead code, and abstractions that add no value such as single-implementation strategies.

When should I not simplify working code?

Avoid simplifying code you do not yet understand, performance-critical code where the simpler version is measurably slower (confirm with BenchmarkDotNet), code that is already clean, and modules you are about to rewrite entirely.

Should refactoring and feature changes go in the same pull request?

No. Submit refactoring separately from feature or bug fix changes. Mixed changes are harder to review, revert, and understand in history, and batching simplifications makes it impossible to identify which change caused a failure.