- Home
- Skills
- Code Quality & Review
- .NET Best Practice Checker
.NET Best Practice Checker
Use when you want a pre-review sweep of a C# solution, a "what would a reviewer flag" pass, or a first look at an inherited codebase.
Free
Works with the AI Agents you already use
.NET Best Practice Checker
Example session with this skill installed
Check this .NET solution with the dotnet-best-practice-checker skill and print the report. I approve the analyzer pass and the PRJ-4 vulnerable-package check, so run both. Do not edit any file.
- Read your context and instructions
- Compiled the net best practice
- Generated the document
Run on a synthetic solution with 3 projects and 18 C# files, written for testing. The skill prints its report in the chat and writes no file. Below are the first findings; the full report has 36 findings (examples/sample-report.md).
.NET best-practice report: Shop.slnx
Scanned: 2026-10-17, 3 projects (1 web, 1 library, 1 test), net10.0 (Api, Tests) and net6.0 (Legacy).
Rules run: 30 of 30. Not checked: none.
Method: I read all 17 source files plus the three .csproj files and appsettings.json, instead of running every Grep Find line. The solution is under 30 source files. I ran the CFG-1 Find lines over the config, key and certificate files. Analyzer pass: dotnet build with AnalysisMode=All, filtered to the IDs named in the rule files. PRJ-4 ran as dotnet list package --vulnerable --include-transitive. I wrote no source files. The build rewrote bin/ and obj/, which you approved.
Summary
| Severity | Findings |
|---|---|
| High | 13 |
| Medium | 15 |
| Low | 8 |
Nearly everything is in OrderService.cs, which carries SQL injection, N+1 queries, blocking calls and logging problems. Fix the injection paths, the disabled certificate validation and the committed secrets first, then the two vulnerable packages.
Findings
High
ASYNC-1 · async void outside event handlers · Shop.Api/Services/OrderService.cs:144 · Confirmed
public async void Reprocess(int orderId)
Why: an exception in SaveChangesAsync cannot be caught by the caller and can end the process.
Fix: return Task and await it at the call site.
ASYNC-2 · Blocking on a Task · Confirmed
OrderService.cs:156...SumAsync(o => o.Total).Result, called fromOrdersController.cs:19, so it is on the request path.OrderService.cs:161email.SendAsync(...).GetAwaiter().GetResult();OrderService.cs:294AuditAsync(order).Wait();
Why: each one blocks a thread-pool thread on async work.
Fix: make these methods async Task and await them up to the controller. Analyzer evidence: CA1849 fired only at :169, which I dropped (see below). It did not flag these three.
ERR-1 · Empty or swallowing catch · OrderService.cs:88 · Confirmed
catch (Exception) { } followed by return false;
Why: a failed send is reported as false with no log and no exception. Analyzer: CA1031 at OrderService.cs(88,9).
Fix: catch the specific exception, log it with ex, and return the failure explicitly.
LOG-2 · Sensitive value passed to a logger · OrderService.cs:71 · Confirmed
logger.LogInformation("Charging with token {Token}", paymentToken);
Why: the payment token value reaches the log sink. Argument: paymentToken.
Fix: drop the argument or log an order id or the last four characters.
HTTP-2 · Certificate validation disabled · Confirmed
Program.cs:29ServerCertificateCustomValidationCallback = (_, _, _, _) => trueon thePaymentGatewayClienthandler.FeedClient.cs:9ServicePointManager.ServerCertificateValidationCallback = (_, _, _, _) => true;(CA5359 at(9,67)). This sets a process-wide callback.FeedClient.cs:12DangerousAcceptAnyServerCertificateValidator
Why: any certificate is accepted, including for payment calls. I saw no development-only guard.
Fix: remove the overrides and trust the dev certificate with dotnet dev-certs https --trust.
net-best-practice-checker.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Checks a .NET codebase against 30 concrete best-practice rules and writes a severity-ranked report. Each finding names the rule, the file and line, the offending code, one sentence on why it matters here, and a fix. The skill reads your code and changes nothing.
Use when you want a pre-review sweep of a C# solution, a "what would a reviewer flag" pass, or a first look at an inherited codebase.
Do not use for layering or architecture review, performance profiling, new feature work, single-snippet questions, or non-.NET code.
The 30 rules cover async and cancellation, exception handling, logging, HttpClient and certificate validation, time and disposal, dependency injection, secrets in config, EF Core queries and raw SQL, performance hygiene, target framework support, package versions and vulnerabilities, and test smells. Every rule has a search pattern, a way to confirm the hit in context, a fix, and a list of cases that are not findings, so an async void event handler or a .Result after Task.WhenAll is dropped instead of reported. The report ends with the hits it dropped and the rules it could not check.
Two optional steps run dotnet and the skill asks before either: an analyzer pass (dotnet build with AnalysisMode=All, filtered to the analyzer IDs the rules name) and a NuGet vulnerability check (dotnet list package --vulnerable). Without them the skill uses only the Read and Grep tools.
Features
- 30 named rules in 8 groups, each with severity, confirm step, fix and a "not a finding" list.
- Report ordered by severity with a summary table, checked-and-clean rules, rules not checked, and hits dropped.
- Evidence is
path:lineplus the code. Secret values are never printed; findings show the key name and***. - Findings that depend on something the scan cannot see are marked Likely, with what would settle them.
- Optional analyzer pass and NuGet advisory check, each only after you agree.
- A real sample report from a synthetic solution is included (
examples/sample-report.md). - Free, MIT licensed.
Who it is for
.NET developers and reviewers who use an AI coding agent and want a repeatable pre-review check of an ASP.NET Core, EF Core or class-library solution.
Requirements
- An agent that reads skill folders and gives the model file read and search tools (tested only in Claude Code 2.1.301).
- The .NET SDK, only for the two optional steps.
- No API keys, accounts or environment variables.
Supported environments
| Environment | Status |
|---|---|
| Claude Code 2.1.301 on Windows, Sonnet model | Tested on one synthetic solution (see docs/VALIDATION.md) |
| Other Claude models | Untested |
| Cursor, GitHub Copilot, Codex CLI, Gemini CLI | Untested |
| Linux, macOS | Untested |
Limitations
- It is a text-based scan. It does not resolve types, DI lifetimes or runtime configuration, so some findings are marked Likely.
- The rules are one author's judgment of common review findings, not Microsoft guidance, and not a complete security audit.
- Tuned and tested on one synthetic solution that I wrote. The false-positive rate on real projects is unknown.
- .NET support dates were read from Microsoft's support policy page on 2026-10-17. Check the page before relying on them later.
- Large solutions: matches beyond 25 per rule are counted but not all reviewed, and the report says so.
Network and external references (disclosure)
- The scan makes no network calls and sends no repository content anywhere.
- The optional
dotnet list package --vulnerablestep queries the NuGet feeds in your repo's configuration. The optionaldotnet buildrestores packages from the same feeds and writesbin/andobj/. - The skill asks before running either step.
- The package contains Markdown only: no scripts and no binaries.
Use cases
- Sweep a pull-request branch or a whole solution before human review.
- Take a first look at an inherited .NET codebase and see what to fix first.
- Find blocking calls, swallowed exceptions, disabled certificate validation, committed secrets and SQL built by string concatenation.
- Check target frameworks and NuGet packages against support dates and known advisories.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean 2 days ago
- Free to download with an account
Requires