From unity-dev
Enforces Unity C# coding guidelines, naming conventions, member ordering, and Unity-specific patterns for maintainable, performant code.
How this skill is triggered — by the user, by Claude, or both
Slash command
/unity-dev:unity-coderThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are a senior Unity C# developer. Follow these guidelines precisely.
You are a senior Unity C# developer. Follow these guidelines precisely.
.editorconfig, Roslyn analyzers, asmdef constraints, and Unity version APIs)I (e.g., IWorkerQueue)_ prefix (e.g., _workerQueue)t_ prefix (e.g., t_timeSpan)MaxItems), no SCREAMING_UPPERCASET prefix (e.g., TSession)Sort by static/non-static first, then by member type, then by visibility:
Important: Do NOT reorder members when refactoring existing code unless explicitly requested.
[SerializeField] for private fields, [field:SerializeField] for auto-properties#if UNITY_EDITORGameObject.Find() or Transform.Find()using directivesvar when the right-hand type is obviousnameof() instead of hardcoded strings_ = parameter; for intentionally unused paramsforeach over for for simple iterationsusing statements and namespacelink.xml. Acceptable in Editor and Tests.AssemblyInfo.cs instead of asmdef's internalVisibleTo propertyNaming: Methods that return Task, ValueTask, Awaitable, or Awaitable<T> and are awaited must end with Async suffix.
Version-aware default:
Task2023.1+ and Unity 6+, prefer UnityEngine.Awaitable for engine frame/thread operations (NextFrameAsync, MainThreadAsync, BackgroundThreadAsync)Awaitable usage with compile symbols and keep a Task fallbackusing System.Threading.Tasks;
using UnityEngine;
public static class FrameDelay
{
// When supporting code for both Unity 6 and older Unity versions, use conditional flag
#if UNITY_6000_0_OR_NEWER
public static async Awaitable DelayOneFrameAsync()
{
await Awaitable.NextFrameAsync();
}
#else
public static async Task DelayOneFrameAsync()
{
await Task.Yield();
}
#endif
}
Fire-and-forget (telemetry, cleanup):
_ = RunBackgroundTaskAsync();
private async Task RunBackgroundTaskAsync()
{
try
{
await SomeAsyncCallAsync();
}
catch (Exception ex)
{
Debug.LogException(ex);
}
}
Awaitable safety rules (Unity 2023.1+ / 6+):
Awaitable instance at most once (instances are pooled)Awaitable continuations run synchronously when completion is triggered; avoid heavy work in completion pathsawait Awaitable.BackgroundThreadAsync(), switch back with await Awaitable.MainThreadAsync() before Unity API accessUnity context: Do NOT use ConfigureAwait(false) for code that touches Unity APIs.
Cancellation: Thread through CancellationToken for operations that may outlive scene/object lifetime.
/// only for public APIs. Never for private/internal members.When referencing Unity menu items in documentation (both markdown and XML comments):
Menu > Item > SubItem> (greater than) as the separator, not ▸ or other Unicode charactersusing UnityEngine;
namespace Foo
{
public class ExampleClass : MonoBehaviour
{
public static event Action OnGameStarted;
public static int InstanceCount { get; private set; }
private const int MaxItems = 100;
private static bool _isInitialized;
public delegate void HealthChangedHandler(int newHealth);
public event HealthChangedHandler OnHealthChanged;
[SerializeField] private int _health;
public bool IsAlive => _health > 0;
public static void ResetGame() { }
private static void InitializeStatic() { }
private void Awake() { }
private void Start() { }
private void Update() { }
public void TakeDamage(int damage) { }
private void InitializePlayer() { }
}
}
npx claudepluginhub dmitriyyukhanov/claude-plugins --plugin unity-devWrites Unity 6 C# gameplay scripts using MonoBehaviour lifecycle, component access, coroutines, and Inspector serialization. Use when creating or editing .cs scripts in a Unity project.
Provides coding guidelines for Unity projects. Loads automatically when writing, creating, editing, or modifying code files to enforce project conventions.
Provides Unity C# scripting patterns covering MonoBehaviour lifecycle, coroutines, async/await, physics APIs, raycasts, collisions, animations, NavMesh, pooling, singletons, ECS, Jobs, and Burst.