agentleFS
mkolewmkolew/ai/skills/reviewer/reviewer-unity/SKILL.md

reviewer-unity

Skill0 starsChanged 57 days agoMITView on GitHub

Review Unity projects: C# scripts (.cs), WebGL JavaScript plugins (.jslib), WebGL templates, Packages/manifest.json and ProjectSettings. Use when reviewing changes to any of these files, or when the user types /reviewer-unity. Catches destroyed-object null checks, per-frame allocations, lifecycle order bugs, lost serialized data, WebGL threading and interop mistakes, editor code that breaks player builds, and missing .meta files. Part of the reviewer bundle.

The file

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 0 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Run what the project has: EditMode/PlayMode tests via -runTests in batchmode, or a scripted build.

    line 14
  2. Very specific:

    No per-frame allocations: LINQ, string concatenation or interpolation, boxing, new lists, closures in Update.

    line 32
  3. Very specific:

    Avoid SendMessage and reflection in hot paths.

    line 33
  4. Very specific:

    Prefer [SerializeField] private fields to public fields.

    line 38
  5. Very specific:

    Every new asset and folder has its .meta committed.

    line 52
  6. Very specific:

    Use the reviewer format: [severity] path:line — problem, then failure: (the concrete input, state or platform → wrong result) and fix: (the …

    line 76

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Unity reviewer

Scope: *.cs, *.jslib, Assets/WebGLTemplates/**, Packages/manifest.json, ProjectSettings/**, and the presence of .meta files. Check ProjectSettings/ProjectVersion.txt for the editor version.

Before reviewing

  • Find the build entry points (an editor BuildScript, CI batchmode commands) and the target platforms.
  • Run what the project has: EditMode/PlayMode tests via -runTests in batchmode, or a scripted build. These need a licensed editor; if one isn't available, say so instead of guessing.

Checklist

Unity objects

  • ?. and ?? on UnityEngine.Object skip Unity's overloaded == null. A destroyed object passes the check and throws MissingReferenceException. Use == null or the implicit bool.
  • GetComponent, Find* and Camera.main inside Update should be cached in Awake.
  • Destroy takes effect at the end of the frame. Code after it still sees the object.

Lifecycle

  • Awake → OnEnable → Start. Cross-object references set in another object's Awake may not exist yet in yours. Physics and forces go in FixedUpdate; input in Update; Time.deltaTime inside FixedUpdate is the fixed step.
  • Coroutines stop when their GameObject is disabled. Subscriptions made in OnEnable must be removed in OnDisable, or destroyed listeners keep firing.
  • async methods keep running after the object is destroyed. Check for that, or pass a cancellation token.

Performance (WebGL and mobile)

  • No per-frame allocations: LINQ, string concatenation or interpolation, boxing, new lists, closures in Update. They cause GC hitches.
  • Avoid SendMessage and reflection in hot paths.

Serialization

  • Renaming a serialized field loses its saved value in every scene and prefab. Use [FormerlySerializedAs("old")].
  • Prefer [SerializeField] private fields to public fields.
  • Changing a ScriptableObject at runtime in the editor writes to the asset permanently.

WebGL

  • WebGL is single-threaded: Task.Run, Thread and blocking waits deadlock or throw. Code must stay on the main thread.
  • [DllImport("__Internal")] calls need #if UNITY_WEBGL && !UNITY_EDITOR guards with an editor fallback.
  • .jslib: functions go inside mergeInto(LibraryManager.library, {...}). Read C# strings with UTF8ToString (Pointer_stringify is removed). Return strings with _malloc plus stringToUTF8. Callback names passed to SendMessage must match the GameObject and method exactly. Event listeners added there must be removable.
  • PlayerPrefs on WebGL writes to IndexedDB lazily. Call PlayerPrefs.Save() after important writes.
  • Template: %UNITY_*% tokens intact. The compression format must match server headers (Content-Encoding for .br/.gz, or the decompression fallback on). A service worker must not serve an old build after a deploy.

Builds

  • Code using UnityEditor must live under an Editor/ folder, or behind #if UNITY_EDITOR. Otherwise player builds fail.
  • Every new asset and folder has its .meta committed. A changed GUID breaks every reference to the asset.
  • Packages/manifest.json versions are pinned. Version bumps match packages-lock.json and the editor version.

Conventions

  • PascalCase types, methods and properties; _camelCase private fields, or the project's own convention.
  • /// XML doc comments where the project documents.
  • Gameplay numbers in the project's tuning or data file, not hard-coded.

Readability

Apply reviewer-readability to the same files (names, structure, dead code, and whether comments are true, needed and well-shaped), plus:

  • /// XML doc comments on public types and members the project documents; [Tooltip] on serialized fields designers edit.
  • #region blocks that hide a long class are a smell: the class does too much.
  • Update bodies read as a short list of named steps, not 100 lines of inline logic.

Not findings

  • Allocation in code that runs once (setup, menus) rather than per frame.
  • public fields in a project that uses them consistently.

Report

Use the reviewer format: [severity] path:line — problem, then failure: (the concrete input, state or platform → wrong result) and fix: (the smallest change). Most severe first. Prove each finding before reporting it, and say No findings with what you checked when there are none.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.