Procedural skills are in the skills/ directory.
Package: com.wallstop-studios.unity-helpers
Version: 3.7.2
Repository: https://github.com/wallstop/unity-helpers
Root Namespace: WallstopStudios.UnityHelpers
Design Principles: Zero boilerplate, performance-proven (19,000+ tests, IL2CPP/WebGL compatible), DRY architecture, self-documenting code (minimal comments, descriptive names).
Runtime/ # Runtime C# libraries
Core/ # Attributes, DataStructure, Extension, Helper, Math,
# Model, OneOf, Random, Serialization, Threading
Tags/ # Effects/attribute system (AttributeEffect, TagHandler, Cosmetics)
Visuals/ # Visual components (EnhancedImage, LayeredImage)
Editor/ # Editor-only tooling
CustomDrawers/ # Property drawers (including Odin/ subdirectory)
CustomEditors/ # Custom inspectors (including Odin inspectors)
Tools/ # Editor windows (Animation Creator, Texture tools, etc.)
Tests/ # Runtime/ (PlayMode), Editor/ (EditMode), Core/ (shared utilities)
Samples~/ # Sample projects (imported via Package Manager)
See the generated Skills Index. Regenerate it after adding or editing any
skill's trigger comment with pwsh -NoProfile -File scripts/generate-skills-index.ps1 (validated by
scripts/lint-llm-instructions.ps1).
See create-csharp-file for detailed C# rules.
-
usingdirectives INSIDE namespace;#ifblocks INSIDE namespace;#defineat file top -
NO underscores in method names (including tests)
-
Explicit types over
var. Prefer compiler-proven definite assignment or direct initialization over placeholderdefaultassignments; retaindefaultwhen it expresses a real return or failure contract. -
NEVER use
#regionor#endregion(see no-regions) -
NEVER use nullable reference types (
string?) -
One file per MonoBehaviour/ScriptableObject (production AND tests). One member ordering across the codebase (#672): const, events, delegates, static properties, static fields, properties, fields, constructors, static methods, methods -- each tier ordered public → protected → internal → private, including const. A nested type goes at the END of its containing type or in its own file, never between members.
npm run lint:nested-type-placementenforces both and:fixreorders what it can; a member whose move would cross a#ifboundary or a directive is reported, never moved (#575, #672; see create-csharp-file) -
NEVER use
?.,??,??=on UnityEngine.Object types -
Aim for zero comments. Reach for a better name before a better sentence, and spell names out rather than abbreviating. A comment that survives that explains why, never what; a non-doc comment INSIDE a type or member spanning more than one line uses the
/* ... */block form, the two-line license header excepted (see create-csharp-file).npm run lint:comment-block-formenforces the block form and:fixconverts what it can;Runtime/,Editor/,Tests/andGenerator~/are enforced without baseline exemptions (#635). Delete before converting -- a run that only restates the code says what -
Generate
.metafiles with./scripts/generate-meta.sh <path>after creating ANY file/folder -- never commit Unity's auto-written stub, which omits the importer block. And anAddComponent-able MonoBehaviour belongs in a runtime-capable test assembly: Unity refuses one it can identify as an editor script, and a type with noMonoScriptmerely escapes that policy until someone gives it a correctly-named file (12 red tests, session 244).npm run lint:editor-assembly-monobehavioursnow holds it statically fromincludePlatformsplus asmdef ownership, over the 14 that legitimately live in an Editor-only assembly -- each carrying a reason and a FROZENAddComponentsite count, so a new call site reds the excuse instead of hiding behind it (#678). Exception: no.metafor dot folders (.llm/,.github/,.git/,.vscode/). See create-unity-meta -
Enums: explicit values,
None/Unknown= 0 with[Obsolete](see create-enum) -
Never reflect on our own code; expose actual implementation members through
internal+[InternalsVisibleTo]. Production code must contain no test-only methods, wrappers, state, callbacks, branches or instrumentation. Do not add or renameForTest,ForTesting,ForTests,TestHooksorTestOnlymembers. Keep test setup and simulated failures in test assemblies; use real implementation phases and filesystem/lifecycle controls. Legitimate production discovery of test assemblies remains supported (see avoid-reflection). -
Never use magic strings; use
nameof()(see avoid-magic-strings) -
All code must follow high-performance-csharp and defensive-programming (never throw from public APIs; use
TryXxxpatterns; handle all inputs gracefully) -
For forbidden patterns and alternatives, see forbidden-patterns reference
-
All editor mutation paths must follow the complete undo policy (see editor-undo-complete); classify paths as Tier A/B/C and never claim full reversal for Tier C file/reimport side effects
-
AssetPostprocessorcallbacks MUST defer non-trivial work throughAssetPostprocessorDeferral.Scheduleto avoidSendMessage cannot be called...warnings during Unity's import phase — and deferral is necessary, not sufficient: a deferredLoadAllAssetsAtPathstill deserializes the asset and still runs the consumer'sOnValidate, so never answer a metadata question with a load (see asset-postprocessor-safety) -
The package ships four compiler-input assemblies; diagnostics belong to their matching analyzer.
WPROTO###(Generator~/WallstopStudios.UnityHelpers.Proto.Generator) reports a serialization contract that cannot be honoured, so it is an error -- the alternative is an exception from inside a shipped player.WUH###(Generator~/WallstopStudios.UnityHelpers.Analyzers) reports an allocation or footgun in code that already works, so it is capped atDiagnosticSeverity.Warningand suppressible: taking a package upgrade must never fail a consumer's build. On by default, with nine exceptions --WUH010(a dictionary read by indexer),WUH013(a counting loop that can useforeach),WUH018(string equality whose comparison policy is implicit),WUH019(repeated stable loop bounds),WUH021(repeated size observations),WUH023(public structs without typed equality),WUH024(typed enum helper suggestions),WUH029(member declaration order), andWUH030(implicit string comparison or culture) remain opt-in for consumers because their correct shapes are ubiquitous. The package opts into WUH010, WUH013, and WUH018 in its shared check-project ruleset; WUH019, WUH021 and WUH023 are enabled by the production-only ruleset for Runtime, Editor, and integration checks. The excluded-source audit covers WUH013, WUH019, WUH021, WUH023, WUH026 and WUH028 with reporting controls. The enum generator (Generator~/WallstopStudios.UnityHelpers.Enum.Generator) reportsWENUM001as a warning when an annotated enum cannot receive generated overloads; it never changes a build result. Every ownedGenerator~project self-hosts all shipped compiler inputs and promotes sharedWUH###policies; WUH019, WUH021 and WUH023 promotion is limited to production checks; the five Unity source gates cover Runtime, Editor, integrations, and both test trees without changing consumer defaults. Retain indexed loops when the index is needed or enumeration changes behavior. The independent Odin migration generator emits editor bindings without depending on the protobuf generator DLL. All four DLLs are committed underRuntime/Analyzers, byte-compared in CI, and an edit to any of them is not finished until you rebuild it. See analyzers -
NEVER size an allocation from a number a payload states -- only from what it delivers. A length prefix is safe because the reader refuses one longer than the bytes it holds; a capacity is a bare claim, and six bytes can ask for 8 GB. Clamp it with
SerializationCapacityLimits.Clampwhere it is a growth hint, refuse it withTryAcceptwhere it is semantic. Astackallocsized from a caller's argument is the same rule with a worse failure --StackOverflowExceptionis caught by nothing, so a length must be a compile-time constant or compared against one in the same statement, with aSystemArrayPoolrent aboveStackAllocation.MaxByteBudget;npm run lint:unsafe-codeholds it over 56 sites (#637). See untrusted-payload-limits. The same gate refuses[Il2CppSetOption(Option.NullChecks, false)]and theArrayBoundsChecks/DivideByZeroChecksforms, however spelled -- deleting IL2CPP's runtime checks reaches the same undefined behaviour asunsafewith neither the keyword norallowUnsafeCode, so nothing else can see it. Writing one withtrue, or with no value, leaves the check on and stays green. Zero sites exist and there is no baseline: the first one reds the build, and the gate carries a positive control because a zero-subject scan cannot prove itself -
Named methods and local functions use brace bodies; properties, accessors, operators and lambdas may use expression bodies. Use prefix increment when the prior value is discarded; retain postfix when its value is used.
npm run lint:csharp-syntaxenforces both with Roslyn over all conditional-symbol combinations in Runtime, Editor, Tests, Generator, Samples and Styles sources; Local Gates runs it with reporting and compiled IL-equivalence controls (#836, #866). -
Default to
string.IsNullOrWhiteSpacefor string validation, including identifiers, GUIDs, paths, required names and labels. KeepIsNullOrEmptyonly when whitespace is valid data or an empty-only serialization branch must preserve invalid-content handling; record that contract and test it. Never mechanically change payloads, literal queries, separators or persisted keys (see defensive-programming). -
Public ordinary structs implement
IEquatable<TSelf>with matching object equality and hashing; Unity C# cannot apply this interface to ref structs. Put each new named class in its own.csfile. The current file-naming gate only enforces this forMonoBehaviourandScriptableObject; #865 tracks the wider migration and enforcement policy.
- Documentation is NOT optional. Every user-facing change MUST update: CHANGELOG, XML docs, feature docs in
docs/ - CHANGELOG is for USER-FACING changes ONLY. Internal changes (CI/CD, build scripts, dev tooling) do NOT belong
- CHANGELOG entries are SHORT -- one or two sentences, plain language, lead with the user-visible effect, and start with the verb its section names (
Add,Fix,Bound, ...). No root-cause narration, no mechanism, no run IDs or "verified on...". Longer explanations go in adocs/guide with a link.npm run lint:changelogfails an entry over 300 rendered characters (issue references and link targets are not counted), so the limit is enforced rather than remembered - A fix for a defect that was never in a release -- including a post-merge review correction -- is NOT a
Fixedentry (nor aChanged/Securityone). The feature ships correct: fold what the fix guarantees a user into that feature's[Unreleased]Addedentry and update that same entry in the follow-up PR; if thatAddedentry is already in a released section, leave the released section unchanged and add noFixedentry for the defect. When asked why no entry exists, cite the existing line. Decide by reading or running the tagged implementation and tracing the affected path (not only whether the file, symbol or current code pattern exists) --git show <tag>:<path>-- not memory - Public members carry a minimal
<summary>-- this is a public library, and a consumer reads the API surface without the source. Minimal means one short sentence;<remarks>is for when it is genuinely needed - See update-documentation for detailed standards
- Internal links MUST use
./or../prefix; never use absolute GitHub Pages paths (/unity-helpers/...) - Never use backtick-wrapped markdown file references; use proper links
- Escape example links with code blocks/backticks; escape pipe characters in tables with
\| - Markdown code blocks require language specifiers; never use emphasis as headings
Run formatters/linters immediately after each file change, not batched at task end:
- C#, MSBuild, and XML:
dotnet tool run csharpier format <file>(ornpm run format:csharpfor the whole repository).npm run agent:preflight:fixformats changed supported files andnpm run agent:preflight/validate:localfail on formatting drift, including linker XML, so a later edit is caught locally rather than by CI - Non-C# (
.md,.json,.yaml,.yml):node scripts/run-prettier.js --write -- <file>(repo-local launcher; runnpm installfirst on the host that runs hooks) - Markdown:
npm run lint:docs+npm run lint:markdown - YAML:
pwsh -NoProfile -File scripts/lint-yaml.ps1 -Paths <changed files>(thenactionlint <changed workflows>) - Spelling:
npm run lint:spelling(add valid terms tocspell.json). Run it manually before completion;npm run agent:preflightand CI provide the final safety net - Tests:
pwsh -NoProfile -File scripts/lint-tests.ps1 -FixNullChecks -Paths <changed test files>, thenpwsh -NoProfile -File scripts/lint-tests.ps1 -Paths <changed test files>. Passing more than one path only works because every-Pathsscript declares BOTH aValueFromRemainingArgumentssibling and[CmdletBinding(PositionalBinding = $false)]--pwsh -Filebinds the first token and offers the rest to the other named parameters positionally, so the sibling alone only works when every neighbor happens to be a[switch]. Measured:ensure-editor.ps1 -RequiredEditorPayloadRelativePath a bputbin-InstallRoot.PWS005enforces both halves - Skills, references and context:
pwsh -NoProfile -File scripts/lint-skill-sizes.ps1after edits; files of 200 or more lines fail, and default preflight also rejects the critical 199-line boundary - Commit prep: stage files, then run
npm run agent:preflight:fix(includes changed spell-checkable file checks) before any commit attempt - Pre-push validation: run
npm run validate:prepushbefore push; it is a roughly one-second last-resort Git/config safety check. Run relevant changed-file checks throughnpm run agent:preflight; usenpm run validate:localonly when a complete repository-wide aggregate is warranted. When hook or agent-preflight behavior changes, also runnpm run validate:tests:hook-regressions. CI always runs the combinedvalidate:testsaggregate. Treat git hooks as last-resort only. Follow ship-changes Step 9 for the push step.
See formatting and validate-before-commit for details.
Read technical rules when changing runtime, editor, or test code.
| Element | Convention | Example |
|---|---|---|
| Types, public members | PascalCase | SerializableDictionary |
| Non-private fields, locals | camelCase | keyValue, itemCount |
| Private instance fields | _camelCase |
_itemCount |
| Interfaces | I prefix |
IResolver, ISpatialTree |
| Type parameters | T prefix |
TKey, TValue |
| Events | On prefix |
OnValueChanged |
| Constants (public) | PascalCase | DefaultCapacity |
- C# files: 4 spaces indentation; config files (
.json,.yaml,.asmdef): 2 spaces - Preserve existing serialized field names and raw Unity JSON keys. The naming gate carries explicit historical field exceptions; a style rename must not change persisted data.
- Line endings: CRLF for most files; YAML/
.github/**/Markdown/Jekyll includes use LF - Encoding: UTF-8 (no BOM)
Add unknown words to the appropriate dictionary in cspell.json:
| Dictionary | Purpose | Examples |
|---|---|---|
unity-terms |
Unity Engine APIs, components, lifecycle | MonoBehaviour, GetComponent, OnValidate |
csharp-terms |
C# language features, .NET types | readonly, nullable, LINQ, StringBuilder |
package-terms |
This package's public API and type names | WallstopStudios, IRandom, SpatialHash |
tech-terms |
General programming/tooling terms | async, config, JSON, middleware |
root words |
Project-specific tokens, incl. lint-error-code prefixes | UNH, PWS (covers UNH001, PWS002…) |
Lint-error-code prefixes (^[A-Z]{2,}\d{3}$ tokens like UNH001, PWS002) must be registered in the root words array. npm run validate:lint-error-codes is the contract test and will fail with a copy-pasteable patch on drift.
| Assembly | Purpose |
|---|---|
WallstopStudios.UnityHelpers |
Runtime code |
WallstopStudios.UnityHelpers.Editor |
Editor code |
WallstopStudios.UnityHelpers.Tests.Runtime |
Runtime tests |
WallstopStudios.UnityHelpers.Tests.Editor |
Editor tests (parent) |
WallstopStudios.UnityHelpers.Tests.Editor.* |
Feature-specific editor tests |
WallstopStudios.UnityHelpers.Tests.Core |
Shared test utilities |
Critical: Test assemblies use overrideReferences: true, so each must independently list ALL required precompiled DLLs it directly compiles against. Odin-specific source must list the Sirenix DLLs it directly compiles against and define WALLSTOP_UNITY_HELPERS_ODIN_INSPECTOR from the odininspector package. Runtime Odin bases use that package-owned define with Unity fallbacks, and the runtime asmdef stays in editor-style auto-reference mode (overrideReferences: false) so no-Odin registry installs never name missing Sirenix DLLs. See manage-assembly-definitions.
Keep the root goal limited to the general objective of advancing the root plan and broad completion criteria;
keep the root plan a general strategy to drive open issues toward zero, ordered by priority. Never store
specific issue selections, PR state, session logs, progress tracking, status updates, validation
results, or retrospectives in either file; follow maintain-plan.
Route session records and temporary next actions to ignored progress/ files, scope and remaining
acceptance to canonical issues, durable evidence to issues or commit bodies, and reusable guidance
to context, skills, or references. A cleanup does not complete or cancel the underlying work.
Read build commands before running local checks. Read agent operations before GitHub, git, or review work. Read CI and test guidance before validation or pushing.