.NET Async + EF Core Review (sync-over-async, N+1)

    1

    AI agents regress to web/JS habits in C#: they block on tasks, fire `async void`, drop cancellation, and generate N+1 EF Core queries.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    .NET Async + EF Core Review (sync-over-async, N+1)

    Example session with this skill installed

    Review Api/OrdersController.cs for async and EF Core problems before I merge. Don't change anything until you've shown me the findings.

    • Read your context and instructions
    • Compiled the net async

    Summary

    Ran the read-only scanner on Api/, then reviewed the file against the async and EF Core rules. Scanner found 2 issues. Manual review found 2 more that the heuristic doesn't catch.

    Scanner output (verbatim)

    Api/OrdersController.cs:7: ASYNC001 sync-over-async: .Result on an awaitable
        var order = _db.Orders.FirstOrDefaultAsync(o => o.Id == id).Result;
    Api/OrdersController.cs:10: ASYNC004 async void outside an event handler
        public async void Refresh() { await _db.SaveChangesAsync(); }
    
    2 finding(s).
    

    Findings

    LineRuleProblemFix
    7ASYNC001.Result blocks a thread-pool thread and can deadlockmake Get async Task<IActionResult>, await the query
    10ASYNC004async void swallows exceptions and can't be awaitedreturn Task
    14-15N+1 (manual)one query per order for LinesInclude(o => o.Lines) or a projection
    5, 12Cancellation (manual)no CancellationToken passed to EFadd CancellationToken ct and pass it through

    Proposed change (line 7)

    // before
    public IActionResult Get(int id)
    {
        var order = _db.Orders.FirstOrDefaultAsync(o => o.Id == id).Result;
        return Ok(order);
    }
    // after
    public async Task<IActionResult> Get(int id, CancellationToken ct)
    {
        var order = await _db.Orders.AsNoTracking()
            .FirstOrDefaultAsync(o => o.Id == id, ct);
        return order is null ? NotFound() : Ok(order);
    }
    

    Next steps

    1. Approve and I'll apply all four fixes.
    2. I'll re-run the scanner (expect 0 findings), then dotnet build and dotnet test.
    3. No performance claim until you measure it.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    AI agents regress to web/JS habits in C#: they block on tasks, fire async void, drop cancellation, and generate N+1 EF Core queries. This skill gives your agent the standing rules a senior .NET reviewer applies, plus a deterministic, stdlib-only Python scanner that flags 7 common smells (ASYNC001-004, EF001-003) before the agent changes anything.

    What it does

    • Scan, apply rules, verify (re-scan, dotnet build, dotnet test)
    • Slow-query workflow: cause, before/after LINQ, SQL impact, index suggestion
    • Output: file:line, rule, before/after, how verified. No unmeasured speedup claims.

    What's inside

    • SKILL.md with when-to-apply rules and the review workflow
    • scripts/scan_dotnet_smells.py, read-only, stdlib only, no network
    • reference/ notes: async correctness, safe EF Core queries, optimizing a slow EF query

    Limits

    The scanner is heuristic. It catches common patterns, not every case (for example, an N+1 hidden inside a foreach with await is left to the agent's rule-based review). It writes nothing and makes no network calls.

    Targets .NET 8+ / C# 12+, EF Core 8+. MIT licensed. Source: github.com/recsventures-ops/dotnet-ai-coding-rules

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Code Quality & Review.

    Line-based scanner heuristics may produce false positives on non-Task types. Multi-line patterns might be missed. Human validation required.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 10 days ago

    • Free with an Agensi account

    Permissions

    Terminal / Shell
    Read Files
    Listed10 days ago

    What's inside

    Frequently Asked Questions

    This skill specifically targets C# 12+ and .NET 8+ environments, focusing on advanced Entity Framework Core 8+ optimizations like N+1 query detection and proper AsNoTracking usage.

    It flags blocking calls like .Result, .Wait() and GetAwaiter().GetResult(), and async void, then has the agent propose async replacements with CancellationToken passed through. You approve before anything changes.

    It works file by file or on a folder; the scanner reads any size of codebase. Large legacy sync-to-async migrations still need human planning. The skill gives the rules and findings, not an automated migration.

    The skill uses a read-only scanning script to identify anti-patterns before proposing refactored code, which can then be verified through your standard build and unit testing process.

    Unlike generic models, this skill applies strict .NET-specific rules, such as enforcing ConfigureAwait(false) for library code and preventing the use of lazy-loading proxies in web APIs.

    New in Code Quality & Review

    Free