Skip to main content
skill CX Codex

dotnet-csharp-code-smells — Claude Code skill: C# anti-pattern review

dotnet-csharp-code-smells — a C# review skill: the agent catches leaked IDisposable, misused async and DI, suppressed warnings and other anti-patterns while it plans, writes or reviews code.

no license 180 installs ★ 92 updated 2026-02-27

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a claude-code
Open on GitHub

What dotnet-csharp-code-smells does

The skill stays on through planning, implementation and review, so the agent checks its own C# as it goes. Inside are reference tables of common smells, each with the harm it does, the fix and the CA rule that flags it. Sections cover disposable handling, warning suppression, LINQ, event subscriptions, design thresholds and exception handling.

Concrete numbers make it usable. A class past 500 lines or a method past 30 lines gets flagged. throw ex; gives way to a bare throw;, .Count() > 0 becomes .Any(), and a query is enumerated once instead of twice.

Generation mistakes such as wrong NuGet packages or a broken project layout are out of scope — dotnet-agent-gotchas handles those. Async details, DI lifetimes and nullable annotations sit in companion skills from the same set, and this one only points at them.

What it helps with

  • find a disposable local variable that never gets a using
  • stop a LINQ chain from enumerating the same collection twice
  • replace an empty catch with logging or a rethrow
  • locate an event subscription that is never removed
  • split a method that has grown too long

Example prompts for the agent

  • Check OrderService.cs for leaked IDisposable and event handlers that never unsubscribe.
  • Review this PR for LINQ anti-patterns: where the collection is enumerated twice and where .Count() > 0 should be .Any().
  • Find empty catch blocks and throw ex; under src/Api.

How to install dotnet-csharp-code-smells

1Skills CLI (Vercel)

npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a claude-code

2Manually: put the files in place

~/.claude/skills/dotnet-csharp-code-smells/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/dotnet-csharp-code-smells/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about dotnet-csharp-code-smells

How do I install dotnet-csharp-code-smells in Claude Code?

Run npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a claude-code. The skill file lands at ~/.claude/skills/dotnet-csharp-code-smells/SKILL.md.

What does dotnet-csharp-code-smells do?

It feeds the agent common C# mistakes while it plans, writes and reviews code: resource leaks, LINQ problems, event leaks, swallowed exceptions, design smells.

How is it different from dotnet-agent-gotchas?

dotnet-agent-gotchas covers generation mistakes such as wrong NuGet packages, project structure and MSBuild errors. This skill covers general code smells that hurt whoever wrote the code.

Similar skills

All skills for Code review and refactoring →

From the same set24

The whole set →
validation-patterns validation-patterns — a skill that tells your agent how to validate data in ASP.NET Core, from attributes to FluentValidation and startup option checks. CX Codex +1 545installs dotnet-domain-modeling dotnet-domain-modeling guides pure C# Domain-Driven Design modeling with entities, aggregate roots, value objects, and domain events, keeping business logic isolated from ORM concerns. CX Codex +1 539installs dotnet-wpf-modern dotnet-wpf-modern — a skill that steers your coding agent through modern WPF: generic host, MVVM Toolkit, Fluent theme, current C# features. CX Codex +1 358installs dotnet-winforms-basics dotnet-winforms-basics teaches coding agents how to build WinForms apps on modern .NET 8+. Helps configure dependency injection, SDK-style projects, and high-DPI scaling. CX Codex +1 295installs dotnet-security-owasp dotnet-security-owasp flags OWASP Top 10 vulnerabilities in .NET solutions and guides safe coding. Useful for reviewing ASP.NET Core endpoints and data queries. CX Codex +1 175installs dotnet-api-security dotnet-api-security is a Claude Code skill that handles authentication and authorization in ASP.NET Core APIs. CX Codex +1 169installs dotnet-csharp-async-patterns dotnet-csharp-async-patterns teaches AI agents proper C# async patterns, stopping common blunders like .Result deadlocks, unhandled fire-and-forget tasks, and dropped cancellation tokens. CX Codex +1 136installs dotnet-architecture-patterns dotnet-architecture-patterns guides scalable .NET Minimal API architecture using vertical slices, route groups, endpoint filters, and structured error handling. CX Codex +1 125installs

Project sponsors

Companies that keep this analytics open