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
npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a claude-codeWhat 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
catchwith 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.csfor leakedIDisposableand event handlers that never unsubscribe. - Review this PR for LINQ anti-patterns: where the collection is enumerated twice and where
.Count() > 0should be.Any(). - Find empty
catchblocks andthrow ex;undersrc/Api.
How to install dotnet-csharp-code-smells
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a claude-code2Manually: put the files in place
~/.claude/skills/dotnet-csharp-code-smells/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/dotnet-csharp-code-smells/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a codex2Manually: put the files in place
.agents/skills/dotnet-csharp-code-smells/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a cursor2Manually: put the files in place
.cursor/skills/dotnet-csharp-code-smells/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshaddix/dotnet-skills skills/dotnet-csharp-code-smells2Manually: put the files in place
.github/skills/dotnet-csharp-code-smells/SKILL.md1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a gemini-cli2Platform CLI
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/dotnet-csharp-code-smellsManually: put the files in place
.devin/skills/dotnet-csharp-code-smells/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-csharp-code-smells -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.