assembly-definitions
Assembly definition management — when to create asmdefs, reference rules, Editor/Runtime/Test separation, platform filters, compilation speed optimization.
VContainer dependency injection for Unity — LifetimeScope hierarchy, registration patterns, constructor injection for plain C#, [Inject] for MonoBehaviours. Lightweight alternative to Zenject.
$ npx -y skills add XeldarAlz/everything-claude-unity --skill vcontainer --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/vcontainerContext preview
The summary Claude sees to decide when to auto-load this skill.
VContainer dependency injection for Unity — LifetimeScope hierarchy, registration patterns, constructor injection for plain C#, [Inject] for MonoBehaviours. Lightweight alternative to Zenject.
name: vcontainer description: "VContainer dependency injection for Unity — LifetimeScope hierarchy, registration patterns, constructor injection for plain C#, [Inject] for MonoBehaviours. Lightweight alternative to Zenject." globs: ["**/VContainer*", "**/*LifetimeScope*.cs", "**/*Installer*.cs", "**/Container*.cs"]
VContainer is a lightweight, fast DI framework for Unity by hadashiA. It provides constructor injection for plain C# classes, method injection for MonoBehaviours, hierarchical scoping, and lifecycle management without the complexity of Zenject.
VContainer uses `LifetimeScope` MonoBehaviours as composition roots. They form a parent-child hierarchy for dependency resolution.
RootLifetimeScope (DontDestroyOnLoad)
|- AudioService (Singleton)
|- SaveSystem (Singleton)
|- AnalyticsService (Singleton)
+- ISettingsProvider (Singleton)
|
|- MainMenuLifetimeScope (MainMenu scene)
| |- MainMenuController
| +- LeaderboardService
|
+- GameLifetimeScope (Game scene)
|- GameManager
|- SpawnSystem
+- ScoreSystemusing VContainer;
using VContainer.Unity;
public class RootLifetimeScope : LifetimeScope
{
[SerializeField] private AudioSettings _audioSettings;
protected override void Configure(IContainerBuilder builder)
{
// Singletons survive scene loads
builder.Register<AudioService>(Lifetime.Singleton).As<IAudioService>();
builder.Register<SaveSystem>(Lifetime.Singleton).As<ISaveSystem>();
builder.Register<AnalyticsService>(Lifetime.Singleton).As<IAnalyticsService>();
// ScriptableObject instance
builder.RegisterInstance(_audioSettings);
}
}public class GameLifetimeScope : LifetimeScope
{
[SerializeField] private LevelConfig _levelConfig;
protected override void Configure(IContainerBuilder builder)
{
// Scene-specific registrations
builder.Register<ScoreSystem>(Lifetime.Scoped);
builder.Register<WaveSpawner>(Lifetime.Scoped);
// Entry point with lifecycle
builder.RegisterEntryPoint<GameFlowController>();
// MonoBehaviour already in scene hierarchy
builder.RegisterComponentInHierarchy<PlayerController>();
builder.RegisterComponentInHierarchy<HUDManager>();
// Config data
builder.RegisterInstance(_levelConfig);
}
}Child scopes automatically resolve dependencies from their parent. A `GameLifetimeScope` can inject `IAudioService` registered in `RootLifetimeScope` without explicit wiring.
// GameFlowController receives IAudioService from Root + ScoreSystem from Game scope
public class GameFlowController : IStartable, ITickable, IDisposable
{
private readonly IAudioService _audio;
private readonly ScoreSystem _score;
public GameFlowController(IAudioService audio, ScoreSystem score)
{
_audio = audio;
_score = score;
}
}// Registration
builder.Register<ScoreSystem>(Lifetime.Singleton);
// The class — dependencies are constructor parameters
public class ScoreSystem
{
private readonly IAudioService _audio;
private readonly ISaveSystem _save;
public ScoreSystem(IAudioService audio, ISaveSystem save)
{
_audio = audio;
_save = save;
}
public void AddScore(int points)
{
// Use injected services
_audio.PlaySfx("score");
_save.SetInt("score", points);
}
}// Register concrete type, expose as interface
builder.Register<AudioService>(Lifetime.Singleton).As<IAudioService>();
// Multiple interfaces for same implementation
builder.Register<NetworkManager>(Lifetime.Singleton)
.As<INetworkSender>()
.As<INetworkReceiver>();
// Self + interface
builder.Register<GameManager>(Lifetime.Singleton)
.AsSelf()
.As<IGameStateProvider>();MonoBehaviours cannot use constructor injection. Use `[Inject]` method injection.
// MonoBehaviour already placed in the scene
builder.RegisterComponentInHierarchy<PlayerController>();
// Create MonoBehaviour on a new GameObject
builder.RegisterComponentOnNewGameObject<HUDManager>(
Lifetime.Scoped,
"HUDManager" // Optional GameObject name
);
// Register existing component reference from LifetimeScope's serialized fields
[SerializeField] private PlayerController _player;
// In Configure:
builder.RegisterComponent(_player);// MonoBehaviour with [Inject]
public class PlayerController : MonoBehaviour
{
private IAudioService _audio;
private IInputService _input;
[Inject]
public void Construct(IAudioService audio, IInputService input)
{
_audio = audio;
_input = input;
}
private void Update()
{
if (_input.JumpPressed)
{
Jump();
_audio.PlaySfx("jump");
}
}
}Entry points implement lifecycle interfaces and run without needing a GameObject.
builder.RegisterEntryPoint<GameFlowController>();
public class GameFlowController : IStartable, ITickable, IFixedTickable, IDisposable
{
private readonly ScoreSystem _scThe ultimate Claude Code toolkit for Unity game development. A production-ready, plug-and-play system that gives Claude Code deep Unity expertise — from writing performant C# to building scenes, profiling performance, and triggering iOS/Android builds — all
Assembly definition management — when to create asmdefs, reference rules, Editor/Runtime/Test separation, platform filters, compilation speed optimization.
Structured commit trailers — adds Constraint, Rejected, Scope-risk, and Not-tested metadata to commit messages. Captures architectural decisions and known gaps…
Ambiguity gating — detects vague feature requests and forces structured requirements gathering with scoring across scope, platform, performance, integration,…
Event system patterns — C# events, UnityEvent, SO event channels, static EventBus. When to use each, zero-allocation patterns, memory leak prevention.
Configures Claude Code's statusline to display Unity workflow state — current phase, active agent, files modified, and session duration.
Post-debugging knowledge extraction — captures non-obvious, codebase-specific learnings that pass quality gates. Invoke after resolving tricky bugs or…