XnaFiddle: Skill for Claude Code

.claude/skills/game-lifecycle/SKILL.md

game-lifecycle is a skill for Claude Code from vchelaru/XnaFiddle. It costs 84 tokens per session (6,664 once invoked), scanned A, original, MIT.

A technical guide to the compile-and-run lifecycle of XnaFiddle, including C# compilation, shader compilation, game replacement, and WebGL graphics resources. WebGL is the browser technology used to render 3D and 2D graphics.

In plain words
What is it for?
It helps developers change or debug the Run and DoCompileAndRun flow, Roslyn compilation, shader handling, game cleanup, and WebGL device setup.
Why use it?
It explains the ordering and cleanup rules that prevent deadlocks and graphics-context leaks when restarting a game in the browser.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

This is vchelaru/XnaFiddle's own configuration. It tells Claude Code how to work on XnaFiddle itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything XnaFiddle configures →

Reuse

Borrowing it

Nothing to install: this file belongs to vchelaru/XnaFiddle. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/vchelaru/XnaFiddle/main/.claude/skills/game-lifecycle/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/vchelaru/XnaFiddle

Made for: Claude Code.

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 game-lifecycle

README.md
[![agentmods](https://agentmods.dev/badge/skills/vchelaru/xnafiddle/game-lifecycle.svg)](https://agentmods.dev/skills/vchelaru/xnafiddle/game-lifecycle)
Your own site
<a href="https://agentmods.dev/skills/vchelaru/xnafiddle/game-lifecycle"><img src="https://agentmods.dev/badge/skills/vchelaru/xnafiddle/game-lifecycle.svg" alt="Measured on agentmods" height="20"></a>
Per session 84 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,664 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00084 $0.06664
Opus 5 $0.00042 $0.03332
Sonnet 5 $0.00017 $0.01333
Haiku 4.5 $0.00008 $0.00666

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

Security

Grade A, and why

game-lifecycle 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 2d 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.

.claude/skills/game-lifecycle/SKILL.md · 150 lines

How it starts

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

Game Lifecycle

The Run flow (Index.razor.cs -> DoCompileAndRun)

CompileAndRun() sets _pendingCompile; TickDotNet() (driven by JS requestAnimationFrame) picks it up and calls DoCompileAndRun(), so compilation runs in the rAF context rather than the Blazor sync context — this avoids a Monitor deadlock on the single WASM thread. Order inside DoCompileAndRun:

  1. Get C# source from Monaco; CompilationService.CompileAsync (Roslyn) -> IL bytes.
  2. Assembly.Load(result.ILBytes); FindGameType locates the Game subclass.
  3. CompileRegisteredShadersAsync() — compiles any .fx tabs to .mgfx via ShadowDusk. No-ops (and never downloads the ~17 MB DXC wasm) when no shader tabs exist. This await is outside the synchronous swap window below, on purpose.
  4. Drop the old game: _game = null (NOT Dispose() — see below), then LibraryRegistry.RunAllCleanups().
  5. GraphicsAdapter.UseReferenceDevice = true (the leak fix — see below), then Activator.CreateInstance(gameType), then newGame.Run() which creates the GraphicsDevice + WebGL context.

The window between _game = null and _game = newGame is deliberately await-free. WASM is single-threaded, so the only interleaving points are await boundaries; with none in that window, TickDotNet() cannot run mid-swap and its if (_game == null) return; guard is sufficient (no locking needed). The one await Task.Delay(1) before Run() only flushes the "Loading game..." status to the DOM.

Each Run rebuilds the whole game

A fresh Game/GraphicsDevice is created every Run. The old game is dropped without Dispose() on purpose: disposing the old GraphicsDevice invalidates textures that the Gum UI library caches in static fields, breaking Gum on the next run. GC reclaims the old game eventually — acceptable in a fiddle.

LibraryRegistry.RunAllCleanups() (XnaFiddle.Core/LibraryRegistry.cs) calls CleanUp() on every plugin to reset static state between runs. Notably GameWindowPlugin (XnaFiddle.Core/Plugins/GameWindowPlugin.cs) reflectively clears KNI's static BlazorGameWindow._instances dictionary (the type lives in the browser-only KNI assembly, so it is resolved by name, not a compile-time reference).

Read the full file on GitHub · 150 lines

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. 2d ago First seen · 150 lines · 84 tokens per session scan A 98d562d08064

Subscribe to this mod's changes

game-lifecycle is a skill published in the GitHub repository vchelaru/XnaFiddle (13 stars, last pushed yesterday), licensed MIT. It adds 84 tokens to every session and 6,664 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-09-04.

Related

Other skills, from other repositories

minecraft-debug-mcp

Operate and debug the live Minecraft bot through its built-in MCP REPL server. Use when work requires starting the bot with pnpm dev, connecting to the local MCP endpoint, inspecting cognitive state/logs/history, injecting synthetic chat/events, or running targeted REPL code against the running brain during…

moeru-ai/airi · 68 tokens

graphics-api-hooking

Guide for graphics API interception, overlay rendering, and render-pipeline analysis across DirectX, OpenGL, and Vulkan. Use this skill when working with Present or SwapBuffers hooks, DXGI swap chains, shader or draw-call interception, screenshot-sensitive overlays, or graphics debugging in game security research.

gmh5225/awesome-game-security · 64 tokens

console-get-logs

Retrieve Unity Editor logs from the MCP plugin's LogCollector, optionally filtered by log type or time window. Useful for debugging and monitoring Editor activity.

IvanMurzak/Unity-MCP · 35 tokens

editor-application-get-state

Return the current state of UnityEditor.EditorApplication — playmode, paused state, compilation state, and related flags.

IvanMurzak/Unity-MCP · 31 tokens

console-clear-logs

Clear the MCP log cache (used by 'console-get-logs') and the Unity Editor Console window. Useful for isolating logs to a specific action by clearing the slate first.

IvanMurzak/Unity-MCP · 41 tokens

profiler-start

Enable Unity's runtime profiler and open the Profiler window. Idempotent: calling when already enabled returns the current enabled state without error.

IvanMurzak/Unity-MCP · 32 tokens