analyzing-dotnet-performance

Scans C# code for .NET performance anti-patterns and reports prioritized findings with fixes.

Updated Jul 12, 2026
One-click install
npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill analyzing-dotnet-performance-patrick-rex
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: analyzing-dotnet-performance
Source: https://github.com/Patrick-Rex/DotNetTechSamples/tree/main/.agents/plugins/dotnet-diag/skills/analyzing-dotnet-performance
Command: npx skills add https://github.com/Patrick-Rex/DotNetTechSamples --skill analyzing-dotnet-performance-patrick-rex

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Reviewing .NET code for performance issues manually is slow and easy to miss known anti-patterns like sync-over-async deadlocks, uncached JsonSerializerOptions, or missing StringComparison arguments. This Skill systematically scans C# code for roughly 50 documented performance anti-patterns and produces a prioritized, actionable findings report. ## Core Features & Use Cases - Pattern Detection Across 8 Categories: Covers async/concurrency, memory and strings, collections and LINQ, regex, JSON serialization, I/O, networking, and structural patterns like unsealed classes. - Tiered Severity Classification: Classifies each finding as Critical (deadlocks, >10x regressions), Moderate (2-10x improvements), or Info, with scale-based escalation when a pattern appears dozens of times. - Concrete Fixes with Evidence: Every finding includes exact file locations, hit counts from grep-based scan recipes, and a one-line fix description. - Use Case: Before a release, point the Skill at your repository to audit hot paths for allocation-heavy patterns such as chained .Replace() calls, per-call Regex construction, or LINQ in extension methods, then receive a summary table of issues ranked by severity. ## Quick Start Ask the assistant to scan your C# project directory for .NET performance anti-patterns and report the critical and moderate findings with fixes.

Frequently Asked Questions about analyzing-dotnet-performance

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I scan C# code for performance anti-patterns?

Provide the C# files or repository path to scan, optionally noting which code paths are performance-critical. The Skill detects code signals like async, LINQ, or Regex usage, runs matching detection recipes, and reports findings grouped by severity with file locations and fixes.

What .NET performance issues does this analysis detect?

It detects roughly 50 patterns including sync-over-async blocking, Substring allocations, missing StringComparison arguments, uncached JsonSerializerOptions, per-call Regex construction, LINQ on hot paths, unsealed classes, and new HttpClient instances. Each pattern maps to guidance from the official .NET performance blog series.

Does the .NET performance scan work on older framework versions?

Yes, but some recommended fixes require specific versions, such as FrozenDictionary on .NET 8, Span.Split on .NET 9, or GeneratedRegex on .NET 7. Providing your target framework version helps the Skill flag only applicable patterns.

When should I not use automated performance pattern scanning?

Avoid it for algorithmic complexity analysis, since the Skill targets API usage patterns rather than algorithm design. Also skip it for code with no performance requirements, where flagging patterns would amount to premature optimization.

Why does the scan report zero hits for some patterns?

A zero-hit result is valid and confirms good practice, such as finding no unsealed classes or no missing StringComparison arguments. The Skill counts both sides of absence patterns and reports ratios, so clean results are explicitly verified rather than skipped.