Refactors hot C# code to use Span<T>, ReadOnlySpan<T>, and Memory<T> to eliminate allocations in parsing, slicing, and buffer operations. Flags where spans don't fit and enforces safety rules.
Ships in .NET Pack (legacy .NET Framework + Migration Pack to .NET 10). Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Rewrite hot parsing/slicing/buffer code to use Span<T>/ReadOnlySpan<T> (and Memory<T> for async) so it stops allocating intermediate strings and arrays - safely, and only where it pays.
Works on a target: a file, folder, project, or GitHub URL. Find candidates: grep -rn "Substring\|Split(\|ToCharArray\|new byte\[\|Buffer" --include=*.cs <target>.
Substring → slice (no allocation):
// allocates a new string per call
var year = date.Substring(0, 4);
// no allocation: a view over the original
ReadOnlySpan<char> year = date.AsSpan(0, 4);
int y = int.Parse(year);
Split in a hot loop → MemoryExtensions enumerator / manual slicing:
ReadOnlySpan<char> rest = line;
int comma;
while ((comma = rest.IndexOf(',')) >= 0)
{
ReadOnlySpan<char> field = rest[..comma];
// use field without allocating
rest = rest[(comma + 1)..];
}
Small temporary buffer → stackalloc (no heap):
Span<byte> buffer = stackalloc byte[32]; // keep small; this is stack memory
Async boundaries → Memory<T> (you can't store a Span<T> across await; use Memory<T>/ReadOnlyMemory<T>).
Span<T> is a ref struct: can't be a field, captured in a lambda, used across await, or boxed. Use Memory<T> there.stackalloc small and bounded (no user-controlled size) to avoid stack overflow.stackalloc/local memory - it dangles.[MemoryDiagnoser] - confirm allocations actually dropped."Make this parser allocation-free with Span", "replace these Substring calls with slices", "use stackalloc for this buffer", "why can't I use Span across await here". Pairs with memory-allocation-analyzer and benchmark-setup.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
span, memory, allocation-free, csharp-performance, stackalloc
12 skills in this plugin
/adonet-data-access-auditor(.NET) Audit and fix classic ADO.NET data-access code (SqlConnection / SqlCommand / SqlDataReader / DataSet) on .NET Framework. Use this skill whenever the user shares raw ADO.NET code, a DAL / repository built on SqlCommand, stored-proc calls, string-concatenated SQL, or mentions SQL injection, parameterized queries, connection leaks, "using / Dispose", reading the same column multiple times, transactions, or "why does my old data layer leak connections / is it safe". Always use this skill for classic ADO.NET review instead of answering from memory; it applies a fixed security + correctness + performance checklist and rewrites the code./aspnet-mvc-webapi-migrator(.NET) Migrate ASP.NET MVC 5 and Web API 2 code to ASP.NET Core on .NET 10, one controller at a time - actions, routes, filters, model binding, IHttpActionResult, child actions, OutputCache, bundling - plus the app plumbing around them - Global.asax, IHttpModule, IHttpHandler/.ashx, HttpContext.Current, Newtonsoft.Json formatters and XML content negotiation. Use this skill whenever the user wants to "migrate this controller", "Web API 2 to ASP.NET Core", "MVC 5 to .NET 10", "replace Global.asax", "convert this HTTP module to middleware", "port this .ashx handler", or is moving endpoints one by one in a strangler-fig migration. Always use this skill for MVC/Web API migrations instead of answering from memory; it keeps routes, status codes and payloads identical and proves it with parity tests./dotnet-pack:span-memory-refactorfrom .NET Pack (legacy .NET Framework + Migration Pack to .NET 10)
npx claudepluginhub stefanthecode/ai-for-developers --plugin dotnet-packOther plugins' skills for the same job