DO

dotnet-performance

Comprehensive resource for .NET performance tuning, benchmarking, and memory optimization.

Install

mkdir -p .claude/skills/dotnet-performance && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/12599" && unzip -o skill.zip -d .claude/skills/dotnet-performance && rm skill.zip

Installs to .claude/skills/dotnet-performance

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Performance optimization and measurement for .NET applications. Navigation skill covering Span, ArrayPool, memory management, benchmarking, profiling, Native AOT, and optimization patterns. For building high-performance applications. Keywords: performance, optimization, span, arraypool, benchmarking, profiling, memory, gc, aot, native-aot
340 charsno explicit “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Advanced

Key capabilities

  • Optimize application performance and allocations.
  • Measure performance using BenchmarkDotNet.
  • Profile memory or CPU usage.
  • Build Native AOT applications.
  • Tune garbage collection.
  • Reduce memory allocations.

How it works

This skill acts as a navigation map to specialized skills for .NET performance optimization. It covers areas like zero-allocation coding, benchmarking, profiling, and Native AOT.

Inputs & outputs

You give it
a .NET application
You get back
performance optimization guidance and specialized skill navigation

When to use dotnet-performance

  • Optimizing memory usage in .NET
  • Setting up benchmarks for code
  • Profiling CPU and memory usage

About this skill

.NET Performance

Performance optimization and measurement for .NET applications. This meta-skill provides navigation to ~10 performance-focused skills covering zero-allocation coding, benchmarking, profiling, Native AOT, and optimization patterns.

When to Use This Skill

Load this skill when:

  • Optimizing application performance and allocations
  • Measuring performance with BenchmarkDotNet
  • Profiling memory or CPU usage
  • Building Native AOT applications
  • Tuning garbage collection
  • Reducing memory allocations

Quick Navigation

Optimization Patterns

NeedLoad SkillLevel
Span, ArrayPool, ref structdotnet-performance-patternsAdvanced
Type design for performancedotnet-csharp-type-design-performanceAdvanced
LINQ optimizationdotnet-linq-optimizationIntermediate

Memory Management

NeedLoad SkillLevel
GC tuning, LOH/POHdotnet-gc-memoryAdvanced
Struct vs class decisionsdotnet-csharp-type-design-performanceAdvanced

Measurement

NeedLoad SkillLevel
BenchmarkDotNet setupdotnet-benchmarkdotnetIntermediate
Profiling toolsdotnet-profilingAdvanced
CI performance gatesdotnet-ci-benchmarkingAdvanced

AOT & Compilation

NeedLoad SkillLevel
Native AOT publishingdotnet-native-aotAdvanced
AOT architecture patternsdotnet-aot-architectureAdvanced
WASM AOTdotnet-aot-wasmAdvanced
Trimmingdotnet-trimmingIntermediate
Multi-targetingdotnet-multi-targetingIntermediate

Platform-Specific

NeedLoad SkillLevel
MAUI iOS/Catalyst AOTdotnet-maui-aotAdvanced

Performance Decision Trees

Which Optimization Technique?

Reduce allocations → Span<T>, ArrayPool<T> (dotnet-performance-patterns)
        ↓
Improve throughput → Struct optimization (dotnet-csharp-type-design-performance)
        ↓
Reduce startup time → Native AOT (dotnet-native-aot)
        ↓
Optimize queries → LINQ optimization (dotnet-linq-optimization)

Which Measurement Tool?

GoalToolSkill
MicrobenchmarksBenchmarkDotNetdotnet-benchmarkdotnet
Live profilingdotnet-tracedotnet-profiling
Memory analysisdotnet-countersdotnet-profiling
Crash dumpsdotnet-dumpdotnet-profiling
CI gatingAutomated benchmarksdotnet-ci-benchmarking

When to Use Native AOT?

ScenarioRecommendation
CLI toolsStrongly recommended
MicroservicesConsider for fast startup
ContainersGood for size reduction
Web APIsEvaluate trade-offs
LibrariesUse IsTrimmable

Complete Skill List

Optimization Patterns (3 skills)

  • dotnet-performance-patterns - Span, ArrayPool, ref struct
  • dotnet-csharp-type-design-performance - Struct vs class design
  • dotnet-linq-optimization - IQueryable vs IEnumerable

Memory & GC (2 skills)

  • dotnet-gc-memory - GC tuning, LOH/POH
  • dotnet-performance-patterns - Memory patterns

Benchmarking & Profiling (3 skills)

  • dotnet-benchmarkdotnet - BenchmarkDotNet
  • dotnet-profiling - dotnet-counters, trace, dump
  • dotnet-ci-benchmarking - CI performance gating

AOT & Compilation (5 skills)

  • dotnet-native-aot - PublishAot, descriptors
  • dotnet-aot-architecture - AOT-first design
  • dotnet-aot-wasm - Blazor/Uno WASM
  • dotnet-trimming - Trimming annotations
  • dotnet-multi-targeting - Polyfills, multi-TFM

Platform-Specific (1 skill)

  • dotnet-maui-aot - MAUI iOS/Catalyst optimization

Build Optimization (2 skills)

  • dotnet-build-optimization - Slow build diagnosis
  • dotnet-artifacts-output - UseArtifactsOutput

Performance Patterns

Zero-Allocation Patterns

// Use Span<T> instead of arrays
public void Process(Span<byte> data) { }

// Use ArrayPool<T> for temporary buffers
var buffer = ArrayPool<byte>.Shared.Rent(1024);
try { /* use buffer */ }
finally { ArrayPool<byte>.Shared.Return(buffer); }

// Use stackalloc for small fixed buffers
Span<int> stack = stackalloc int[100];

Struct Design

// Mark readonly for immutability
public readonly struct Point(double x, double y);

// Use ref readonly for large structs
public ref readonly Point GetOrigin();

// Seal classes for devirtualization
public sealed class Calculator { }

GC Optimization

  • Use GC.TryStartNoGCRegion for critical sections
  • Pool objects to reduce Gen 0 collections
  • Avoid LOH fragmentation with ArrayPool
  • Consider GC configs for server apps

Cross-References

  • Fundamentalsdotnet-fundamentals
  • Architecturedotnet-architecture
  • Securitydotnet-security
  • Webdotnet-web

Version Assumptions

  • .NET 8.0+ for modern patterns
  • Native AOT requires .NET 7.0+
  • HybridCache requires .NET 8.0+
  • BenchmarkDotNet works on all versions

Anti-Patterns to Avoid

  1. Premature optimization - Measure first
  2. Ignoring GC pressure - Monitor allocations
  3. Using ValueTask incorrectly - Don't await twice
  4. Async void methods - Always use Task
  5. Ignoring async state machine overhead - Consider sync for hot paths

See Also

When not to use it

  • When the focus is on .NET fundamentals, architecture, security, or web development.
  • When using .NET versions older than 7.0 for Native AOT or 8.0 for modern patterns.

Limitations

  • It is a meta-skill that navigates to other skills, not an optimization tool itself.
  • Native AOT requires .NET 7.0+.
  • Modern patterns assume .NET 8.0+.

How it compares

This skill provides a structured entry point to various .NET performance topics by directing users to specific sub-skills, rather than offering a single, monolithic solution.

Compared to similar skills

dotnet-performance side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
dotnet-performance (this skill)05moNo flagsAdvanced
performance-benchmark34moNo flagsIntermediate
asynkron-profiler01moReviewIntermediate
try-fix13moReviewAdvanced

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry