Add tests

From tykisgod/quick-question · View interactive version

Add tests is an AI agent skill from the GitHub repository tykisgod/quick-question. Author Unity EditMode, PlayMode, or regression tests for the current change without conflating that with test execution.

How to use this skill

Skill file

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

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

Add or update Unity tests for the current change. This skill is for writing tests, not for running them. After authoring coverage, hand off to /qq:test.

Before deciding what to assert (component layouts, serialized values, runtime state), read the actual values from the live Editor instead of guessing from source, read-only, through the project's channel: ${CLAUDE_PLUGIN_ROOT}/bin/qq-unity-cli.py channel --project "$PWD" prints unity-cli, tykit or none (CODE4).

- Official Unity CLI: unity command --project-path "$PWD" --json --no-banner find_gameobjects -- --name X, then get_component_properties -- --target <instanceId> --type Foo or get_serialized_fields (CODE3).

- tykit: unity_query, unity_object, get-field, get-array (CODE4).

- Neither: derive the expected values from source and say they are unverified.

Arguments: $ARGUMENTS

With --auto, first make sure a pipeline tracks this run, so the handoff at the end can advance it: qq-execute-checkpoint.py pipeline-start --project . --type feature --current-skill "/qq:add-tests" --branch "$(git branch --show-current)" --if-not-running. It starts one only when none is running here (you were invoked on your own) and leaves a running one alone.

0. Read qq project state first when available

${CLAUDE_PLUGIN_ROOT}/bin/qq-project-state.py --pretty

1. Determine the target

Pick scope in this order:

  1. Explicit user input (file path, bug description, plan step, or test type)
  2. A known failing bug / regression path from the current conversation
  3. The active implementation plan step and its done criteria; if the plan has a Tests step, implement that step
  4. Current uncommitted runtime changes
  5. Ask the user one concise question if the target is still ambiguous

Narrow broad input: one system over the whole feature, one regression path over a full suite rewrite, one test assembly over new scattered files.

2. Fit the existing test layout

Read the existing tests and test .asmdef files near the code under test, reuse their helpers, fixtures, scene setup and naming, and prefer extending an existing test file. If no tests exist yet, use Assets/Tests/EditMode/ for pure logic or editor-side behavior and Assets/Tests/PlayMode/ for scene/lifecycle/integration behavior.

3. Choose the right test kind

Unless the user forced a mode, choose the lightest one that still proves the behavior:

4. Write the tests

For a bug fix, write the regression first when the repro is clear; if the architecture makes the repro impossible to express cleanly, say so and write the next-best narrow guardrail.

5. Stop at authored coverage

--auto mode: after writing the tests, run qq-execute-checkpoint.py pipeline-advance --project . --completed-skill "/qq:add-tests" --next-skill "/qq:test", then invoke /qq:test --auto with the narrowest appropriate scope.

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.