.claude/skills/code-style/SKILL.md
Code style rules, naming conventions, forbidden patterns, field grouping, and class layout order. Auto-loads for all C# code work. Use when writing or reviewing any C# code in this project.
npx skillsauth add punkfuncgames/tetris-clone code-styleInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
| Element | Convention | Example |
|---------|-----------|---------|
| Private fields | _camelCase | _playerHealth |
| Properties/Methods | PascalCase | GetPlayerHealth() |
| Constants | UPPER_SNAKE_CASE | MAX_HEALTH |
| Visibility | Always explicit private | private int _count; |
Never use var. Always declare the concrete type.
// Correct
Dictionary<string, int> scores = new Dictionary<string, int>();
CurrencyContainer gold = _wallet.GetContainer("Gold");
// Forbidden
var scores = new Dictionary<string, int>();
var gold = _wallet.GetContainer("Gold");
Never chain attributes on the same line. Each attribute gets its own line.
// Correct
[SerializeField]
[Range(0f, 1f)]
private float _alpha;
// Forbidden
[SerializeField, Range(0f, 1f)]
private float _alpha;
// Forbidden
[SerializeField][Range(0f, 1f)]
private float _alpha;
Use implicit bool for any UnityEngine.Object subclass (MonoBehaviour, ScriptableObject, Component, GameObject). Unity overrides == for lifecycle tracking — using == null / != null bypasses this.
// Correct — handles Unity's fake-null
if (myTransform)
{
myTransform.SetParent(parent);
}
if (!myGameObject)
{
_logService.Error("Missing reference");
}
// Forbidden — bypasses Unity lifecycle checks
if (myTransform != null) { ... }
if (myGameObject == null) { ... }
When both System.Object and UnityEngine.Object are in scope, always use fully qualified name or alias:
// At file top
using Object = UnityEngine.Object;
// Or inline
UnityEngine.Object.Destroy(go);
Group fields by their full declaration signature (modifiers + type). Same-signature fields are contiguous (no blank lines between them). Different-signature groups are separated by a blank line.
private readonly IWalletService _walletService;
private readonly ISaveService _saveService;
private readonly ILogService _logService;
private readonly CompositeDisposable _disposables = new();
private bool _isInitialized;
private bool _isDirty;
private float _saveInterval;
///)All blocks require braces, even single-line:
// Correct
if (condition)
{
DoSomething();
}
// Forbidden
if (condition)
DoSomething();
[Inject] method injectionCancellationTokenUniTaskVoid + .Forget() for fire-and-forgetthis.GetCancellationTokenOnDestroy()async Task in production code (only in test methods for NUnit)ReactiveProperty<T> for mutable stateReadOnlyReactiveProperty<T> for exposure.AddTo(_disposables) for pure C# classes.AddTo(this) for MonoBehavioursIDisposable and dispose CompositeDisposableUnityEngine.Input (Input.GetMouseButtonDown, Input.mousePosition, Input.GetKey, etc.)IInputService from the input package (#if PUNKFUNC_INPUT)OnPrimaryAction, OnSecondaryAction, OnInteract, OnPauseMovement.CurrentValue, MousePosition.CurrentValue, IsPrimaryHeld.CurrentValue#if PUNKFUNC_INPUT so the project compiles without the packagereadonly structbuilder.RegisterMessageBroker<T>(options) in installersdevelopment
WalletModule reference — currency management with BigDouble support, reactive properties, caps, lifetime stats, and persistence. Use when working with currencies, wallets, or financial systems.
development
UnlockConditionModule reference — composable unlock conditions using ScriptableObjects with AND/OR/NOT logic, stat/currency/upgrade/prestige/gamestate/boolean checks, reactive service layer with progress tracking. Use when implementing unlock systems, gating, or progression requirements.
development
UndoModule reference — command pattern with undo/redo stacks, command merging, and reactive state. Use when implementing undo/redo, undoable actions, or command patterns.
tools
Unity UI Toolkit reference — UXML documents, USS styling, MVVM pattern (ViewModel + Presenter), custom VisualElements, responsive layout, animations, performance guidelines, and complete Figma-to-UI-Toolkit property mapping. Use when building or modifying UI with UI Toolkit, creating UXML/USS files, writing ViewModels or Presenters, designing screens/panels/components, or converting Figma designs to UI Toolkit.