Skip to main content
skill CX Codex

dotnet-performance-patterns — Claude Code skill: guide

dotnet-performance-patterns is a Claude Code skill for .NET 8+ architecture patterns that reduce allocations using Span, Memory, and ArrayPool.

no license 122 installs ★ 92 updated 2026-02-27

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a claude-code
Open on GitHub

What dotnet-performance-patterns does

This skill focuses on memory throughput and allocation reduction in modern .NET 8+ applications. It emphasizes the rationale behind low-level optimizations: slice-based parsing with ReadOnlySpan<char>, handling memory across asynchronous boundaries via Memory<T>, and renting large byte arrays with ArrayPool<T>.Shared to avoid Large Object Heap fragmentation.

The instructions break down typical pooling pitfalls, such as relying on buffer.Length instead of the actual slice size or omitting clearArray: true on sensitive payloads. Value type design is another core topic: declaring a readonly struct stops the JIT from creating defensive copies under in parameters, while ref struct ensures data never escapes to the managed heap.

The guidance assumes a .NET 8.0 runtime baseline, meaning older framework targets cannot run several of the highlighted APIs.

What it helps with

  • eliminate GC pressure during string parsing by slicing with ReadOnlySpan<char>
  • avoid Large Object Heap allocations using rented buffers from ArrayPool<byte>
  • prevent JIT defensive copying of structs passed with the in parameter
  • pass memory slices into asynchronous stream readers using Memory<byte>

Example prompts for the agent

  • Refactor our log parsing function to use ReadOnlySpan<char> without allocating substrings.
  • Show how to read a large stream using ArrayPool<byte>.Shared with proper cleanup in a finally block.
  • Optimize this struct to prevent defensive copies when passed via in parameter.

How to install dotnet-performance-patterns

1Skills CLI (Vercel)

npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a claude-code

2Manually: put the files in place

~/.claude/skills/dotnet-performance-patterns/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/dotnet-performance-patterns/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about dotnet-performance-patterns

How do I install dotnet-performance-patterns in Claude Code?

Run npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a claude-code. The file will be placed in ~/.claude/skills/dotnet-performance-patterns/SKILL.md.

Which .NET runtime version is required?

The patterns target .NET 8.0 and newer releases as the baseline. Earlier versions lack full runtime support for modern span handling.

What common mistakes with ArrayPool does this skill cover?

It addresses bugs where code reads beyond rented bounds using buffer.Length, pool starvation from unreturned buffers, and missing data clears on sensitive arrays.

Similar skills

All skills for Backend and APIs →

From the same set24

The whole set →
dotnet-csharp-async-patterns dotnet-csharp-async-patterns teaches AI agents proper C# async patterns, stopping common blunders like .Result deadlocks, unhandled fire-and-forget tasks, and dropped cancellation tokens. CX Codex +1 136installs dotnet-architecture-patterns dotnet-architecture-patterns guides scalable .NET Minimal API architecture using vertical slices, route groups, endpoint filters, and structured error handling. CX Codex +1 125installs dotnet-csharp-dependency-injection dotnet-csharp-dependency-injection guides Microsoft DI in .NET, from service lifetimes and keyed registrations to decoration and hosted workers. CX Codex +1 125installs bootstrap5-ui bootstrap5-ui provides Bootstrap 5.3 layout patterns and component snippets for HTML and ASP.NET Core Razor views. CX Codex +1 122installs Razor Pages Patterns The Razor Pages Patterns skill gives the agent a fixed set of rules for ASP.NET Core Razor Pages: page layout, PageModel design, binding and validation, form security. Fits projects on .NET 8+ with Razor Pages as the UI. CX Codex +1 121installs dotnet-solid-principles dotnet-solid-principles — a skill for Claude Code that applies SOLID, DRY, and SRP principles in .NET projects. Detects C# anti-patterns and suggests specific refactoring steps. CX Codex +1 112installs dotnet-integration-testing The dotnet-integration-testing Claude Code skill covers .NET integration tests against real infrastructure. Ask for API test setup with an in-process server or a database running in Docker. CX Codex +1 111installs signalr-integration The signalr-integration skill provides SignalR patterns for ASP.NET Core Razor Pages, including hubs and client connections. Use it when adding live notifications or order updates. CX Codex +1 107installs

Project sponsors

Companies that keep this analytics open