csharp-review
БесплатноБез исполняемых скриптовНе проверенReviewing C# code - what to flag, and what Roslyn analyzers and nullable reference types already flag for you USE WHEN: you are reviewing, critiquing or…
от claude-dev-suite★ 51 звезда на GitHubОб этом скилле
Reviewing C#
A reviewer's leverage is what the toolchain cannot say. C# ships a large analyzer set in the SDK, but two of its most valuable guarantees are opt-in per project — nullable reference types and warnings-as-errors — so the first thing to establish is which of them this project turned on.
The findings that remain cluster around async, disposal, and the places where a compile-time guarantee is erased at runtime.
The snippets are fragments cut down to the defect, not runnable programs.
Already covered - do not spend review on it
| Defect | Reported by |
|---|---|
| Dereferencing a possibly-null reference | CS8602 — only when <Nullable>enable</Nullable> |
An async method with no await |
CS1998 (warning, on by default) |
Unawaited task in an async method |
CS4014 (warning) |
| Unused local, unreachable code | CS0219, CS0162 |
| Disposable created and not disposed, simple shapes | CA2000 — only if code analysis is enabled |
ConfigureAwait missing in a library |
CA2007 — opt-in, off by default in most templates |
Sync-over-async (.Result, .Wait()) |
no built-in rule; some analyzer packages add one |
String comparison without StringComparison |
CA1310 — opt-in |
Read the .csproj first. <Nullable>, <TreatWarningsAsErrors> and
<AnalysisLevel> decide whether rows 1, 5, 6 and 8 exist at all. A project with
nullable disabled has no null guarantees whatsoever, and that is one
architectural comment, not a per-line campaign.
The table above dates; the tools do not. Verify a default set with
mcp__documentation__fetch_docson technologydotnet-quality— topicscode-analysis-rules,nullable-reference-types. Those entries point at the indexes the tool authors maintain, so they follow the version the project actually pins rather than the one this skill was written against.
The checks that earn their place
async void outside an event handler
async void ProcessAsync() { await work(); } // exceptions cannot be caught
When you see it: async void on anything that is not an event handler
matching a delegate signature.
Ask: where does an exception from this go? An async void method has no
task to carry the failure, so a throw reaches the synchronization context and
terminates the process. The caller cannot await it or catch it. async Task is
the fix, and the shape is easy to miss because it compiles and usually works.
Sync-over-async
var user = GetUserAsync(id).Result; // blocks; deadlocks on a context with affinity
When you see it: .Result, .Wait(), .GetAwaiter().GetResult() on a task
whose continuation may need the calling thread.
Ask: is there a synchronization context here? In ASP.NET Core there is not, so this is "only" thread-pool starvation under load. In WPF, WinForms and classic ASP.NET it is a hard deadlock: the continuation waits for a thread the caller is blocking. The symptom is a hang, not an exception.
A CancellationToken accepted and never passed on
async Task<Data> LoadAsync(CancellationToken ct) {
return await http.GetAsync(url); // ct not forwarded
}
When you see it: a method taking a CancellationToken whose body calls
other async APIs without it.
Ask: does cancellation actually reach the I/O? The signature promises cooperative cancellation and the body does not deliver it, so a cancelled request keeps its connection and its thread. Nothing reports it — the parameter is "used" as far as the compiler is concerned.
IDisposable created inside a using-less path
var conn = new SqlConnection(cs); // no using, no dispose
if (!TryOpen(conn)) return; // leaks on this path
When you see it: any IDisposable assigned to a local without using,
especially where an early return or a throw sits between creation and disposal.
Ask: which paths dispose it? CA2000 catches simple shapes only, and is off
unless code analysis is enabled. Also check the opposite error: using on an
injected HttpClient, which disposes something the container owns.
A struct mutated through a property or a copy
readonly struct Point { public int X { get; init; } }
list[0].X = 5; // does not compile for List<T> — but
var p = dict["k"]; p.X = 5; // mutates a COPY, silently
When you see it: a mutable struct, or any struct retrieved from a
collection, a property, or a foreach variable and then modified.
Ask: is this the original or a copy? Value semantics mean every access
returns a copy, so the write lands somewhere that is discarded. Making structs
readonly turns the mistake into a compile error, which is why the guidance
exists.
A nullable warning suppressed rather than answered
var name = user!.Name; // `!` asserts; nothing verified it
#nullable disable
Установить csharp-review в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobFAQ
Что делает скилл csharp-review?
Reviewing C# code - what to flag, and what Roslyn analyzers and nullable reference types already flag for you USE WHEN: you are reviewing, critiquing or auditing existing C# code - a "code review", a "review" of a .cs file, a diff, a PR or a pull request; deciding what to comment on in C#; avoiding false positives on C# code DO NOT USE FOR: writing, explaining or learning C# - use `languages/csharp`; anything the built-in Roslyn analyzers or nullable reference types already report (this skill lists those so you can stay silent about them); ASP.NET Core specifics - use the ASP.NET skills; EF Core mapping - use the ORM skills
Как установить скилл csharp-review?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл csharp-review запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic