dotnet-csharp-code-smells

Analyze C# code for logic issues, anti-patterns, and CA rule fixes.

71|10|Updated Feb 11, 2026
One-click install
npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-csharp-code-smells-wshaddix
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: dotnet-csharp-code-smells
Source: https://github.com/wshaddix/dotnet-skills/tree/main/skills/dotnet-csharp-code-smells
Command: npx skills add https://github.com/wshaddix/dotnet-skills --skill dotnet-csharp-code-smells-wshaddix

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill proactively identifies and helps fix common C# code smells, anti-patterns, and potential logic issues, leading to more robust and maintainable code.

Core Features & Use Cases

  • Smell Detection: Identifies issues in resource management, warning suppression, LINQ usage, event handling, and general design.
  • Guidance: Provides explanations of why a smell is harmful, the correct fix, and relevant C# compiler rules (CA rules).
  • Use Case: When reviewing a complex C# method, use this Skill to quickly pinpoint potential resource leaks, inefficient LINQ queries, or problematic exception handling patterns.

Quick Start

Review the attached C# code file for common code smells and anti-patterns.

Frequently Asked Questions about dotnet-csharp-code-smells

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

FAQPage Schema
How do I detect C# code smells and anti-patterns in my code?▼

To detect C# code smells, analyze your codebase for common logic issues like IDisposable misuse, LINQ anti-patterns, event handling leaks, and God classes, then apply the suggested fixes referencing relevant CA rules.

What are common C# resource management anti-patterns and IDisposable misuse?▼

Common C# resource management anti-patterns involve improper IDisposable implementation, which can cause resource leaks. Analyzing the code identifies these gaps and provides fixes referencing relevant CA rules.

How do I find and fix LINQ anti-patterns and event handling leaks in C#?▼

To find LINQ anti-patterns and event handling leaks in C#, review the code to pinpoint inefficient queries and unsubscribed events, receiving explanations of why they are harmful and the correct refactoring steps.

Can I use this to identify C# design smells like long methods and God classes?▼

Yes, you can identify C# design smells like God classes and long methods. The analysis targets these structural issues, explaining the potential pitfalls and providing actionable refactoring guidance.

Does this C# code review process reference specific compiler CA rules?▼

Yes, the C# code review process references specific CA rules. It provides explanations for detected code smells, warning suppression hacks, and exception handling gaps while citing the relevant CA rules for quality improvement.