agentleFS
XenoneqqXenoneqq/unity-ai-skills/skills/unity-agent-worker/SKILL.md

unity-agent-worker

Skill1 starsChanged 29 days agoMITView on GitHub

Carry one Unity task end to end in the user's own checkout: read the project's rules first, work in verifiable milestones, do all engine work through `unity-scene-habits` (prefab-first, Unity CLI, never hand-edit YAML), work in files first and use Unity in one batch pass, keep every new asset paired with its `.meta`, verify before every commit, and never push or switch branches. Use when handed a single Unity task to implement — by a user, or as a worker spawned by `unity-manage-work`.

The file

Show its rules and text

We split this skill into the rules it gives an agent

15 rules. About 0 are common, 11 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈11

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If a manager spawned you, it locked the branch, the decisions and the baseline.

    line 17
  2. Very specific:

    Stay on the branch you were given: Never checkout another branch, never create one, never rename one.

    line 57
  3. Distinctive:

    Stay inside your file set: If the task needs a file nobody mentioned, that is a finding to report, not a licence to spread.

    line 61
  4. Distinctive:

    If the working tree contains changes you did not make, stop and report it.

    line 65
  5. Distinctive:

    Prefer the smallest diff that fully solves the task.

    line 75
  6. Distinctive:

    The project's rule wins: If the project's CLAUDE.md says who drives the editor, follow it over this section.

    line 109
  7. Very specific:

    If your brief names an editor agent instead (unity-manage-work), send it the branch, exactly what to run and what counts as pass, one …

    line 111
  8. Very specific:

    Read references/verification.md.

    line 117
  9. Distinctive:

    Rung 0 and 1 run before every commit: Never commit on a red gate, and never commit something you have not run.

    line 121
  10. Very specific:

    Check git status for files outside your task, delete the leftover test scenes, and revert the rest unless the task meant it …

    line 154
  11. Distinctive:

    Code first, tests after: Write the whole change, or the whole batch of small tasks, then test it in the Unity pass.

    line 172
  12. Distinctive:

    Rung 4 is a human, and it blocks: When nothing above proves the feature behaves — which on a project without tests is most features — write …

    line 196
  13. Distinctive:

    Commit rarely — one coherent finished chunk, not one per file and not one at the end.

    line 203
  14. Distinctive:

    A pure move lands first: If the task needs a rename, a split, or converting loose scene objects into prefabs to make room, that is its own …

    line 204
  15. Distinctive:

    If you could not finish: say what landed, what did not, what blocked it, and what you would do next.

    line 226

≈ “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 agent worker

One task, start to finish, in the checkout you were given. You implement; you do not manage, and you do not spawn subagents.

If a manager spawned you, it locked the branch, the decisions and the baseline. Treat that brief as authoritative and report to the manager, never to the user.

Size the process to the task

A small, clear change does not need the full process below. Take the quick path when all of these hold:

  • It changes content or data, not behaviour: swap a model, delete or move an object, flip a serialized field, retune a number.
  • It touches a handful of existing files and adds no new script.
  • The brief says exactly what to change. Nothing is left to design.

The quick path: read the project's CLAUDE.md, make the edit (straight through the Unity CLI; a one-off needs no builder), run one existing test that covers the area if there is one, run the rung-0 checks from section 5 (every asset paired with its .meta, the scene diff intended), and commit. If nothing automated covers it, add a one-line manual check to your report. No milestones, no screenshots, no new tests, no reading every skill.

A new mechanic, a new system, or risky code such as the player controller or the save system takes the full process. If a quick task turns out to need new code, switch to it and say so.

1. Read before you write

In this order, stopping as soon as you have what you need:

  1. The project's own rules — CLAUDE.md, AGENTS.md, CONTRIBUTING.md, contributor notes. These outrank this skill and every skill it references.
  2. The anchor files you were given, or the nearest equivalents. Mirror what is already there: folder layout, naming, assembly definitions, how existing prefabs are built. Where the brief names doc sections to skim, read those sections, not the whole file.
  3. unity-scene-habits — the engine mechanics. Everything you do to a prefab, a scene, an asset or the editor CLI follows it. Do not re-derive it and do not work around it.

2. You are in a shared checkout

There is no worktree and no isolated copy. The tree you are editing is the user's own. The one exception is a speed-mode files-lane task (unity-manage-work), which runs in a worktree of its own: never open the editor there.

  • Stay on the branch you were given. Never checkout another branch, never create one, never rename one.
  • Never git stash, reset --hard, checkout --force, or delete a branch. There is nothing to recover from.
  • Stay inside your file set. If the task needs a file nobody mentioned, that is a finding to report, not a licence to spread.
  • Leave session-materials/ alone, apart from anything your brief lets you write there. It is the manager's.
  • If the working tree contains changes you did not make, stop and report it. Do not build on top of someone else's uncommitted work.

3. Work in milestones

Split the task into chunks that can each be shown to work. For each one: make the change, check it where that is cheap (a compile outside the editor, the intended diff), then move on. Do not build the whole thing and only check it at the end. Unity-backed checks, .meta pairing and test runs among them, happen in the Unity pass (section 4), not per milestone.

Prefer the smallest diff that fully solves the task. Do not delete comments or code the task does not require you to touch, and do not tidy things nobody asked about.

4. Files first, then one Unity pass

Most of a task needs no Unity at all. Write it as files: C# as files, and scene, prefab and asset changes as builder scripts per unity-scene-habits (prefab-first, edit prefab assets rather than scenes, never hand-edit .unity, .prefab or .meta). Check the compile outside the editor where the project has a recorded way to. Then use Unity once per task, or once per batch of small tasks. In batch mode, the default, with the editor closed:

  1. one unity run … -executeMethod per group of builders,
  2. filtered unity test calls for what changed,
  3. one full unity test per mode at the end.

That pass creates the .meta files for new assets, so commit after it, never before. Visual and feel work that someone has to watch is the exception and uses a live editor, on demand. references/files-first.md has the detail.

You drive Unity yourself, and only one agent uses it at a time: one project can be held by one editor, batch included, and an import is expensive.

  • Run batch tests through the batch test script, unity-scene-habits' references/batch-tests.sh, or the copy your brief names. Nothing to focus, no window.
  • If an editor holds the project (exit 2, "an editor holds the project"), it is probably the user testing. Never close it. Do your non-Unity work, then report it.
  • On the connected path, only when your brief chose it or the job needs a live editor and the brief's autonomy mode lets you open one (otherwise ask your manager and keep working), run tests through unity-scene-habits' references/run-tests.sh. Exit 3 means recover once: run references/editor-recover.sh from the same skill, retry once, and report if it is still stuck. Its exit 6 means the screen is locked and the editor was closed: carry on in batch mode. Exit 7 means the editor is the user's: leave it and report. It acts only on an editor an agent opened and marked.
  • In speed mode your brief may give an editor queue: pass --queue <dir>. The wait is bounded; on exit 4, work on something else, try once more, then report. Never loop on it.
  • The project's rule wins. If the project's CLAUDE.md says who drives the editor, follow it over this section.
  • If your brief names an editor agent instead (unity-manage-work), send it the branch, exactly what to run and what counts as pass, one request at a time. To wait, end your turn: the reply resumes you.

5. Verify — as far as the project allows

Read references/verification.md. Most game projects have no automated tests, so verification is a ladder: climb as far as this project allows, then say which rung you reached. Never report "tests pass" or "verified" for a project that has no tests.

Rung 0 and 1 run before every commit. Never commit on a red gate, and never commit something you have not run.

  • It compiles. No error CS anywhere in the run.
  • Tests pass if the project has any: the isolated tests for what changed, and one full run before the last commit (test budget, below), apart from the known-failing baseline you were given, by name. A failure outside that list is yours and blocks the commit. Chasing one inside it is wasted work; hiding a real one behind "already broken" is worse. If the project has no tests, say that rather than reporting a green suite.
  • No new import errors beyond the baseline: missing references, broken shaders, console errors on a clean import.
  • No new broken references. The most common real breakage in Unity and it needs no test framework. references/verification.md has the scan; run it on the base branch too, so only the new ones count as yours.
  • Every asset is paired with its .meta, and every .meta with its asset. An unpaired new asset breaks references for everyone on merge — a blocker, not a nitpick:
git status --porcelain -z -- Assets | while IFS= read -r -d '' e; do
  f=${e#???}
  case "$f" in
    *.meta) [ -e "${f%.meta}" ] || echo "orphan meta: $f" ;;
    */)     ;;
    *)      [ -e "$f.meta" ]    || echo "missing meta: $f" ;;
  esac
done
  • The scene diff is intended. git diff --stat -- '*.unity' should be empty unless the task genuinely needed a scene change. If it is not and you did not mean it, revert the whole file — not partial hunks — before committing.
  • No unrelated churn. Unity runs leave things behind: prefabs and materials re-serialized with default values, ProjectSettings flipped by a test run, Assets/InitTestScene*.unity. Check git status for files outside your task, delete the leftover test scenes, and revert the rest unless the task meant it (unity-scene-habits, references/builders.md lists what the editor changes on its own).

Screenshots only when asked, or for real visual work: new UI, lighting, a look the user will judge (unity-scene-habits, references/visual-checks.md). Never to show that an object is there; an existing test's raycast or bounds assert says the same for free.

New tests only for new behaviour. Swapping or deleting content updates the existing tests that name the old thing. It does not add tests.

The test budget

A filtered batch run costs about 10 s with a warm Library/; a full suite costs far more, and a run in an open editor pays a recompile and a domain reload (30-90 s) on top. The budget is on full runs; filtered batch runs are cheap enough to use freely while working. Spend runs deliberately:

  • Code first, tests after. Write the whole change, or the whole batch of small tasks, then test it in the Unity pass. Never edit, test, edit, test per task.
  • While working, test a little, isolated only: the filtered tests for the case at hand, by category or by name.
  • At the end, one full run to confirm nothing else broke, right before your final commit, unless your brief says it runs at the end of the session instead. A change to shared core code (the player controller, the save system, anything many features depend on) earns its own full run, so a late red suite can still be traced.
  • If the full run breaks: list, isolate, test, fix. List the failures, rerun each on its own to confirm it is real, reproduce it with that test, fix it, then rerun only those tests plus the area the fix touched. references/verification.md has the loop; the test script takes several names, so each rerun is one call.
  • Stay under the number of full runs your brief gives. Needing more is a finding to report.
  • A test that fails alone and passes on a rerun is a flake, not your regression, if your brief lists it as known. unity test --retries 1 reports flakes as such. A new one goes in your report.
  • Assert properties, not totals. A test that pins a count (items in a level, rooms, a loot share) breaks on every content task. Test what must hold, such as "every room has an exit", or use a wide band or a fixed seed for anything statistical.

Rungs 2 and 3 run once, when the task is otherwise done: does the game start, and does it build. Run them in the Unity pass, as in section 4. They are slow; do not run them per milestone.

Rung 4 is a human, and it blocks. When nothing above proves the feature behaves — which on a project without tests is most features — write a manual checklist: the scene to open, the exact steps, and what counts as failure. Hand it to your manager with the task. The task is not done until a person confirms it. A reported failure comes back to you as an ordinary fix round.

6. Commits

  • Commit rarely — one coherent finished chunk, not one per file and not one at the end.
  • A pure move lands first. If the task needs a rename, a split, or converting loose scene objects into prefabs to make room, that is its own first commit with no behaviour change.
  • Subject only, empty body, matching the project's own style. Check what the repo actually does:
git log --author="$(git config user.name)" -15 --format='%s'
  • Never push. Never open a PR. Never touch a remote.

7. Report back

  • The branch, and every file created or edited, with full paths.
  • Scenes and prefabs specifically — what scene diffs exist and why, what prefabs you added or changed. Your manager needs this for the conflict report; bury it and merge day gets worse.
  • The rung you reached, in one line, and what is still unproven. "Compiles, imports clean, no new broken references, build green; no automated tests in this project, behaviour unverified" is an honest report. "Verified" is not.
  • The manual checklist, whenever behaviour is not covered by anything automated.
  • Verification results, pass or fail, with the output.
  • Anything you deviated from, discovered, or left undone, and why.

If you could not finish: say what landed, what did not, what blocked it, and what you would do next. Leave the tree buildable. An honest partial handover beats a broken tree and a claim of success.

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.