csharp-zero-gc

csharp-zero-gc is a skill for Claude Code from tianzhiying/Unity-perf. It costs 74 tokens per session (5,587 once invoked), scanned A, original, MIT.

An engineering-planning guide for making C# code paths allocate no memory during operation. Garbage collection, or GC, is the runtime process that reclaims unused memory.

In plain words
What is it for?
It helps plan allocation-free systems, set performance acceptance criteria, choose applicable techniques, and add checks for allocation regressions.
Why use it?
It defines what zero allocation means, how to prove it, and how to prevent later code changes from reintroducing memory allocations.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents.

Part of the unity-perf plugin — 3 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/tianzhiying/unity-perf/csharp-zero-gc
Any agent
npx skills add tianzhiying/Unity-perf --skill csharp-zero-gc
Clone the repo
git clone --depth 1 https://github.com/tianzhiying/Unity-perf

Made for: Claude Code.

Or install unity-perf, the plugin that ships this one along with the rest of its 3 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for csharp-zero-gc

README.md
[![agentmods](https://agentmods.dev/badge/skills/tianzhiying/unity-perf/csharp-zero-gc.svg)](https://agentmods.dev/skills/tianzhiying/unity-perf/csharp-zero-gc)
Your own site
<a href="https://agentmods.dev/skills/tianzhiying/unity-perf/csharp-zero-gc"><img src="https://agentmods.dev/badge/skills/tianzhiying/unity-perf/csharp-zero-gc.svg" alt="Measured on agentmods" height="20"></a>
Per session 74 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 5,587 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00074 $0.05587
Opus 5 $0.00037 $0.02794
Sonnet 5 $0.00015 $0.01117
Haiku 4.5 $0.00007 $0.00559

Measured 6d ago against content hash 4a080f080a06, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

csharp-zero-gc scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/csharp-zero-gc/SKILL.md · 112 lines

How it starts

The opening of the file, as written. The whole thing — 112 lines — stays where its author put it; the contents beside it link to each section on GitHub.

C# zero-GC engineering plans

Zero GC is not a pile of tricks; it is an engineering commitment: which paths are promised allocation-free, how that is accepted, and how it is still zero six months from now. This skill pins down three things — the target, the acceptance definition, and the guardrail requirement. How you get there is yours to design: the allocation-free techniques you know, the newer language features (Span, ref struct, params collections, interceptors, source generators, and whatever is newer), and the library ecosystem are all more complete and more current than any list here. Zero GC without guardrails gets eaten away by everyday commits, so preventing regressions matters as much as getting to zero.

1. Target tiers

Declare the commitment before you start. The following are non-negotiable acceptance criteria.

Tier Commitment Applies to Acceptance definition
L1 Peak controlled Allocation is concentrated in the loading phase; runtime peak stays within the device's memory budget The floor for every project PerfDog PSS peak passes; steps in the Mono Reserved curve appear only on loading frames
L2 Zero B/frame on hot paths Combat, main loop, UI refresh, and network send/receive allocate 0 GC bytes within a frame The target for the vast majority of games; standard Profiler GC Alloc column stays at 0 B; CI allocation assertions all green
L3 Zero B throughout No code path allocates after the loading screen; GC can be turned off Lockstep, competitive, VR — genres with zero tolerance for spikes Over an N-minute soak, the delta in GC.CollectionCount is 0; memory stays flat during the GC-off window

Declare the tier before starting work: L2 and L3 differ by an order of magnitude in cost (L3 requires third-party libraries and SDKs to be allocation-free too, which constrains your options). For most projects the right answer is L2 plus localized L3 (for example, the lockstep simulation frame).

Read the full file on GitHub · 112 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 112 lines · 74 tokens per session scan A 4a080f080a06

Subscribe to this mod's changes

csharp-zero-gc is a skill published in the GitHub repository tianzhiying/Unity-perf (2 stars, last pushed 1mo ago), licensed MIT. It adds 74 tokens to every session and 5,587 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

bootstrap-solution

Bootstrap or guide a reproducible .NET solution with explicit F# or C# language choice, SDK selection, project layout, test project setup, and initial validation commands.

gaelic-ghost/socket · 38 tokens

build-csharp-project

Build or modify idiomatic C# .NET projects using nullable-aware APIs, records/classes, async/task behavior, analyzer conventions, tests, and repo-local validation.

gaelic-ghost/socket · 37 tokens

unity-scripting

Unity 6 C# scripting guide. Use when writing MonoBehaviour scripts, handling lifecycle events (Awake, Start, Update, FixedUpdate), using coroutines or async/await (Awaitable), working with ScriptableObjects, events, delegates, or core APIs like Vector3, Quaternion, Time, Debug. Based on Unity 6.3 LTS documentation.

IdoCohen560/claude-unity-game-studio · 78 tokens

better-auth

Skill for integrating Better Auth - comprehensive TypeScript authentication framework for Cloudflare D1, Next.js, Nuxt, and 15+ frameworks. Use when adding auth, encountering D1 adapter errors, or implementing OAuth/2FA/RBAC features.

secondsky/claude-skills · 53 tokens

bun-bundler

This skill should be used when the user asks about "bun build", "Bun.build", "bundling with Bun", "code splitting", "tree shaking", "minification", "sourcemaps", "bundle optimization", "esbuild alternative", "building for production", "bundling TypeScript", "bundling for browser", "bundling for Node", or…

secondsky/claude-skills · 90 tokens

bun-ffi

This skill should be used when the user asks about "bun:ffi", "foreign function interface", "calling C from Bun", "native libraries", "dlopen", "shared libraries", "calling native code", or integrating C/C++ libraries with Bun.

secondsky/claude-skills · 56 tokens