coder-csharp-performance
npx skills add https://github.com/ozerohax/assistagents --skill coder-csharp-performance
Agent 安装分布
Skill 文档
<skill_overview> Improve runtime performance with allocation-aware and measurable changes Profiling slow code paths Reducing allocations or GC pressure Optimizing async or I/O-heavy code Improving startup or throughput .NET Performance Memory and Spans GC Fundamentals </skill_overview> Measure before and after every change Use representative inputs and realistic data sizes Optimize the slowest 10% first Avoid unnecessary allocations in hot paths Reuse buffers with ArrayPool for large temporary arrays Use StringBuilder for repeated concatenation Prefer stackalloc + Span<T> for small, short-lived buffers Span<byte> buffer = stackalloc byte[128]; // Fill buffer without heap allocation <spans_and_memory> Prefer Span<T> and ReadOnlySpan<T> for sync APIs Use Memory<T> only when data must outlive the stack frame Do not capture Span<T> across async/await </spans_and_memory> <linq_and_enumeration> Avoid multiple enumeration; materialize once if needed Prefer simple loops over complex LINQ in hot paths </linq_and_enumeration> <async_performance> Use ValueTask for cached or synchronous completions Avoid sync-over-async (.Result, .Wait) Pass CancellationToken to cancellable operations </async_performance> <gc_considerations> Keep large objects (>= 85 KB) to a minimum Dispose IDisposables promptly Avoid long-lived object graphs when possible </gc_considerations> <anti_patterns> Optimizing without measurements Heavy LINQ in tight loops Repeated LOH allocations </anti_patterns>