Test

From tykisgod/quick-question · View interactive version

Test is an AI agent skill from the GitHub repository tykisgod/quick-question. Run Unity unit/integration tests and check for runtime errors.

How to use this skill

Skill file

Respond in the user's preferred language (detect from their recent messages, or fall back to the language setting in CLAUDE.md).

Run qq scripts as ${CLAUDE_PLUGIN_ROOT}/bin/<name>: they are not on PATH, so a bare unity-test.sh exits 127.

The test scripts drive the open Unity Editor from the CLI (the official unity command / unity job, or tykit HTTP), so the tests can run from here — don't skip them assuming they can't. If the scripts cannot reach an Editor they exit 2 and say why; there is no batch-mode fallback. Report that message and let the user decide (open the Editor, or confirm nothing holds the project lock and ask for --batch). Never add --batch yourself: -batchmode grabs the project lock and corrupts the Library of an Editor that is open but undetectable.

Channel: the test scripts pick it themselves; you need it only for Steps 1–2. qq-unity-cli.py channel --project "$PWD" prints unity-cli, tykit or none (CODE4 explains them; never open or print Library/Pipeline/.unity-pipeline-port — it holds an eval token). On tykit, or when the Editor is reached only through MCP tools (tykit_mcp, mcp-unity, Unity-MCP), read CODE8 now: it holds Step 1B and the MCP variants of Steps 2–3.

Arguments: $ARGUMENTS

Steps

0. Read project state

qq-project-state.py --pretty

Explicit arguments (mode, --filter, --assembly) always win. With no mode argument, default_test_scope (the repo's effective default, derived from policy_profile unless configured) picks the command in Step 3: editmode → EditMode only, all → EditMode, then PlayMode. Tell the user which default you used and why.

1. Editor health check (by channel)

Run the check for the project's channel: 1A below, or Step 1B in CODE0 on tykit. If the channel is none, skip to Step 3 — the test script makes the final call and exits 2 with a reason if it cannot reach an Editor.

1A. Official Unity CLI
unity command --project-path "$PWD" --json --no-banner --timeout 20 editor_status

Rules (every channel):

2. Clear Console + Mark Editor.log position

source "${CLAUDE_PLUGIN_ROOT}/scripts/platform/detect.sh"
EDITOR_LOG="$(qq_get_editor_log_path)"
BASELINE=$(wc -l < "$EDITOR_LOG")
# official Unity CLI channel:
unity command --project-path "$PWD" --json --no-banner clear_console
# tykit channel (PORT from Step 1B):
if [ -n "$PORT" ]; then
  curl -s --connect-timeout 5 --max-time 15 -X POST http://localhost:$PORT/ \
    -d '{"command":"clear-console"}' -H 'Content-Type: application/json'
fi

3. Run tests

Select command based on arguments:

| Argument | Command |

|----------|---------|

| (none) + default_test_scope=all | unity-unit-test.sh |

| (none) + default_test_scope=editmode | unity-test.sh editmode |

| editmode | unity-test.sh editmode |

| playmode | unity-test.sh playmode |

| with filter/assembly | unity-test.sh <mode> --filter "X" or unity-test.sh <mode> --assembly "Y" |

4. Check runtime errors

Check Editor.log even when all tests pass (it does not depend on the console buffer):

tail -n +$((BASELINE + 1)) "$EDITOR_LOG" | \
  grep -iE "NullReferenceException|Exception:|Error\b" | \
  grep -v "^UnityEngine\.\|^Cysharp\.\|^System\.Threading\.\|^  at \|CompilerError\|StackTrace" | \
  sort -u

Show all errors to the user — do not filter or omit any. Give each a source assessment (e.g. "from a safety test, likely expected") and let the user decide whether to act.

On test failure

Read the failing test and the code under test, say whether the current changes introduced the failure or it was pre-existing, propose a concrete fix, and ask whether to apply it.

Handoff

After tests complete, recommend the next step:

--auto mode: skip asking:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.