uw-cmd-debug

A four-phase debugging workflow for Unity projects. It uses error evidence, reproduction, isolation, hypothesis testing, and verification to guide bug fixes.

In plain words
What is it for?
Use it to investigate Unity console errors, null references, execution-order problems, timing issues, cleanup bugs, and interactions between game systems.
Why use it?
It reduces guesswork by requiring the bug to be reproduced and the suspected cause to be tested before changing code.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/devdavv/unity-ai-workflow/uw-cmd-debug
Clone the repo
git clone --depth 1 https://github.com/devdavv/unity-ai-workflow

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 486 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00486
Opus 5 $0.00000 $0.00243
Sonnet 5 $0.00000 $0.00097
Haiku 4.5 $0.00000 $0.00049

Measured 2d ago against content hash 78689d42ffb6, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

uw-cmd-debug scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/uw-cmd-debug.md · 52 lines

What it actually says

/uw-cmd-debug — Debugging Workflow

Apply the 4-phase debugging framework to identify and fix bugs.

Skills

Load uw-unity-debugging from .claude/skills/uw-unity-debugging/SKILL.md.

Phase 1: Gather Evidence

  1. Read the error — Via Unity MCP read_console or user-provided logs.
  2. Reproduce — What are the exact steps to trigger the bug?
  3. Scope — Single script? System interaction? Timing?
  4. Recent changes — Check git log -5 for what changed.

Phase 2: Isolate

  1. Narrow the search — Comment out systems to find the culprit.
  2. Add targeted logs — Use GameDebug.Log at decision points.
  3. Common causes checklist:
    • Execution order (Awake vs Start vs OnEnable)
    • Null reference (destroyed object, unassigned field)
    • Threading (Unity API on background thread)
    • State not reset (OnDisable/OnDestroy cleanup)
    • Physics timing (Update vs FixedUpdate)

Phase 3: Hypothesize & Test

  1. State the hypothesis: "I believe [X] happens because [Y]."
  2. Write a test that proves or disproves the hypothesis.
  3. Run the test. If it fails -> back to Phase 2 with new info.

Phase 4: Fix & Verify

  1. Implement the minimal fix.
  2. Run the specific test from Phase 3.
  3. Run the full test suite for regressions.
  4. Clean up temporary debug logs.
  5. Commit with: fix({scope}): {root cause description}

Common Unity Pitfalls

Symptom Common Cause
NullRef in Awake Execution order — use [DefaultExecutionOrder]
MissingComponent Destroyed object still referenced
Works in Editor, fails in build Editor-only API usage
Intermittent failure Race condition or timing
Physics jitter Wrong update loop

Output

  • Root cause identified and documented
  • Fix implemented with test coverage
  • Regression suite passing

$ARGUMENTS

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 52 lines · 0 tokens per session scan A 78689d42ffb6

Subscribe to this mod's changes

uw-cmd-debug is a command published in the GitHub repository devdavv/unity-ai-workflow (41 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 486 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.