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
npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a claude-codeWhat 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
inparameter - 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>.Sharedwith proper cleanup in a finally block. - Optimize this struct to prevent defensive copies when passed via
inparameter.
How to install dotnet-performance-patterns
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a claude-code2Manually: put the files in place
~/.claude/skills/dotnet-performance-patterns/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/dotnet-performance-patterns/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a codex2Manually: put the files in place
.agents/skills/dotnet-performance-patterns/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a cursor2Manually: put the files in place
.cursor/skills/dotnet-performance-patterns/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install wshaddix/dotnet-skills skills/dotnet-performance-patterns2Manually: put the files in place
.github/skills/dotnet-performance-patterns/SKILL.md1Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a gemini-cli2Platform CLI
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/dotnet-performance-patternsManually: put the files in place
.devin/skills/dotnet-performance-patterns/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add wshaddix/dotnet-skills --skill dotnet-performance-patterns -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
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.