Finds unnecessary heap allocations in C# hot paths — LINQ in loops, boxing, closures, string concatenation, params arrays, async state machines — and rewrites to reduce GC pressure.
Ships in TheCodeMan .NET AI ToolKit. 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.
Spot avoidable heap allocations on hot paths and rewrite them to cut GC pressure — without sacrificing readability where it doesn't matter.
Works on a target: a file, folder, project, or GitHub URL. Focus on hot paths (request handlers, loops, serialization). Find candidates: grep -rn "\.Select(\|\.Where(\|\.ToList()\|+ \"\|string.Format\|new \[\]" --include=*.cs <target>.
Where/Select/ToList allocate iterators + lists per call. In a tight loop, a plain for with no intermediate collection avoids it.object/interface (e.g. int into a non-generic API, struct enumerator boxing). Use generics; avoid object.static () => ...).StringBuilder or string.Create/interpolation handler.params arrays — hidden array allocation per call; provide non-params overloads on hot APIs.async — a method that often completes synchronously → ValueTask to avoid the Task allocation.in/ref readonly.List/Dictionary capacity to avoid re-allocation.// allocates: closure + iterator + list, every call
var ids = items.Where(i => i.IsActive).Select(i => i.Id).ToList();
// hot path: no intermediate allocations
var ids = new List<int>(items.Count);
foreach (var i in items) if (i.IsActive) ids.Add(i.Id);
[MemoryDiagnoser] (benchmarkdotnet-setup) before and after — guesses mislead.## Findings (hot paths only)
- <file:line> [closure] ... → ...
## Rewritten
<code>
## Verify
Benchmark with [MemoryDiagnoser]; compare Allocated/Gen0.
"Why does this allocate so much", "reduce GC pressure in this handler", "find boxing/closures here", "cut allocations in this hot loop". Pairs with benchmarkdotnet-setup and gc-pressure-auditor.
What SKILL.md sets; muted values are Claude Code's defaults
/dotnet-ai-toolkit:memory-allocation-analyzerfrom TheCodeMan .NET AI ToolKit
npx claudepluginhub stefanthecode/dotnet-ai-toolkit --plugin dotnet-ai-toolkit49 skills in this plugin
/adonet-data-access-auditorAudit 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./async-await-auditorAudit C#/.NET code for async/await anti-patterns and concurrency bugs. Use this skill whenever the user shares async C# code or asks about deadlocks, async void, .Result/.Wait(), blocking calls, ConfigureAwait, sync-over-async, fire-and-forget tasks, CancellationToken usage, or "why does my async code hang/deadlock". Always use this skill for async correctness/performance reviews instead of answering from memory; it applies a fixed checklist and rewrites the code./authorization-policy-generatorDesign ASP.NET Core authorization — policy-based, role-based, and claims/requirement-based with custom authorization handlers and resource-based checks. Use this skill whenever the user wants authorization policies, role/claim checks, custom AuthorizationHandler, resource-based authorization, permission checks, or asks "how do I authorize this / policy vs role / restrict this endpoint to X". Always use this skill for authorization requests; it generates policies, handlers, and endpoint wiring.Other plugins' skills for the same job