From qq
Enforces strict git worktree isolation for automatic execution of multi-step plans, with auto-compilation, subagent dispatch, checkpoint resume, and live Unity Editor integration.
npx claudepluginhub tykisgod/quick-questionThis skill uses the workspace's default tool permissions.
Respond in the user's preferred language (detect from their recent messages, or fall back to the language setting in CLAUDE.md).
Executes implementation plans with automatic sequential/parallel orchestration, handling worktree verification, resume detection, phase dispatch, and quality verification.
Executes work from plans, task packs, or prompts: triages input complexity, scans repos for patterns and tests, builds task lists, implements features while following conventions and maintaining quality.
Executes written implementation plans: load and critically review, run tasks in git worktrees with checkpoints and drift checks, finish branches via sub-skills. Use for separate review sessions.
Share bugs, ideas, or general feedback.
Respond in the user's preferred language (detect from their recent messages, or fall back to the language setting in CLAUDE.md).
Read a plan, execute it fully. Execution is always automatic — never ask "proceed?" or "start?" during implementation. The user invoked execute; that IS the go-ahead.
Live Unity editing during execution: if a plan step needs to poke the live Unity Editor (inspect a component, modify a scene object, invoke a runtime method) instead of writing new C# code, consult
shared/tykit-reference.mdfor the command map. Use tykit commands directly via the MCP tools (unity_query,unity_object,unity_assets,unity_physics) or direct HTTP (/ping,/health,/focus-unityfor recovery). Only fall back to code-writing for changes that need version control or compile-time validation.
Arguments: $ARGUMENTS
--no-worktree: skip worktree guard--auto: after completion, auto-select and run the next workflow step instead of asking the user (includes push — user should be aware)Docs/qq/Worktree isolation is non-negotiable for /qq:execute. Executing a multi-step plan directly on a shared branch pollutes main, blocks parallel work, and makes rollback surgical instead of trivial. You MUST enter a worktree unless one of these three conditions is explicitly met:
git rev-parse --show-toplevel — if it matches .git/worktrees/<name>/ in the output of git worktree list, you're in one). Skip to step 2.--no-worktree as a literal flag in $ARGUMENTS. Not "semantically meant" — the exact token must be present. Agent-invented --no-worktree semantics is forbidden.Do NOT invent other bypass conditions. If you encounter an obstacle that seems to require skipping the worktree, fix the obstacle, don't skip the safety check. Common obstacles and their correct fixes:
| Obstacle | ❌ Wrong reaction | ✅ Correct reaction |
|---|---|---|
| Plan file is untracked | "switching worktree loses plan → skip worktree" | git add <plan_file> && git commit -m "docs(plan): <slug>" → now plan is in git → enter worktree → plan is visible from worktree. |
| Uncommitted unrelated changes in working tree | "dirty tree → can't worktree → skip" | Commit them (if related to this plan) or stash them (if unrelated). Then enter worktree. If user wants to keep them dirty, they must pass --no-worktree explicitly. |
| Conversation has ephemeral state (open files, scratch edits) | "would lose context → skip" | Conversation state IS lost on worktree entry by design — that's the point of isolation. Re-load plan from disk in the new session. Do not skip for this reason. |
EnterWorktree tool unavailable | "no tool → skip" | Fall back to ${CLAUDE_PLUGIN_ROOT}/bin/qq-worktree.py create --name <slug>, tell the user to reopen in the new path, and stop. Don't proceed in the main dir. |
The procedure:
Verify plan is in git. If the plan file is untracked or has uncommitted changes:
git status -- <plan_file>
If dirty, commit it now:
git add <plan_file>
git commit -m "docs(plan): <slug> plan document"
Announce: "Committed plan doc before entering worktree so it's accessible from the new worktree."
Capture source state BEFORE creating the worktree (required for verification in step 5):
SOURCE_BRANCH=$(git rev-parse --abbrev-ref HEAD)
SOURCE_HEAD=$(git rev-parse HEAD)
echo "Source: $SOURCE_BRANCH @ $SOURCE_HEAD"
Remember these — you'll verify the new worktree inherits them.
Derive a slug from the plan filename (lowercase, dashes, no extension).
Enter the worktree: call EnterWorktree with name: <slug>. If EnterWorktree is unavailable, fall back to ${CLAUDE_PLUGIN_ROOT}/bin/qq-worktree.py create --name <slug> (which uses current branch correctly by design), tell the user to reopen in the new path, and stop.
CRITICAL: Verify the new worktree inherited the source branch's HEAD. EnterWorktree is documented as "based on HEAD" but in practice it sometimes creates the worktree branch from the repo's default branch (develop/main) instead of the current feature branch — silently losing your plan commit and any other recent commits. You MUST verify after every EnterWorktree call:
WT_HEAD=$(git rev-parse HEAD)
if git merge-base --is-ancestor "$SOURCE_HEAD" HEAD 2>/dev/null; then
echo "✓ Worktree HEAD ($WT_HEAD) includes source HEAD ($SOURCE_HEAD)"
else
echo "✗ BUG: worktree HEAD ($WT_HEAD) does NOT include source HEAD ($SOURCE_HEAD)"
echo " EnterWorktree branched from a different ref. Recovering..."
# Hard-reset the new worktree branch to the source HEAD.
# This works because the new worktree branch was just created and has no
# commits of its own yet (worst case it had a single auto-generated commit).
git reset --hard "$SOURCE_HEAD"
echo " ✓ Reset worktree to $SOURCE_HEAD"
fi
Why this matters: if you skip verification, the worktree's branch is silently rooted at develop. When you eventually commit-push and try to merge back, you'll be merging develop's history (zero source-branch commits) into your feature branch — losing the plan commit and any other source-branch context. Do not skip this verification. Cherry-pick is NOT a sufficient recovery — it brings over commits but the branch's merge-base is still wrong, which breaks git diff source...HEAD-style scoping later.
Seed local runtime files in the new worktree (qq scripts, AGENTS.md, CLAUDE.md, .mcp.json, qq.yaml, baseline state, run records, AND the worktree.json metadata that registers it as qq-managed). Without this step, EnterWorktree-created worktrees lack scripts/platform/detect.sh (every qq script call exits 127), and downstream consumers like commit-push Type B closeout, qq-codex-exec --add-dir injection, and qq-project-state.py see isManagedWorktree=false.
${CLAUDE_PLUGIN_ROOT}/bin/qq-worktree.py seed-local-runtime --project . --source "<SOURCE_PROJECT>"
Seed runtime cache (Unity Library/, etc.) in the new worktree. Now that step 6 has written .qq/state/worktree.json with sourceWorktreePath, this command can resolve the source from metadata and persist runtimeCacheSeed state back into the same file (so qq-project-state and qq-doctor see the seed completed). Pass NO --source flag — the metadata is now authoritative.
${CLAUDE_PLUGIN_ROOT}/bin/qq-worktree.py seed-runtime-cache --project .
If you decide to skip the worktree under any condition above, state the exact reason in your first message (e.g. "Skipping worktree: user passed --no-worktree in arguments" / "Skipping worktree: already inside .git/worktrees/demo-loop" / "Skipping worktree: plan is 2 steps, 1 file, no compile"). Do NOT skip silently.
Find the plan (user arg → conversation → Docs/qq/ scan → ask).
Resume check: Run:
qq-execute-checkpoint.py resume --project .
If it returns progress with status: "running" or "paused", resume from the first uncompleted step. Report: "Resuming from step N (steps 1–M already complete)."
If empty, fall back to scanning the plan for checked boxes (- [x]) for backward compatibility.
Read the plan. Read CLAUDE.md and AGENTS.md (if it exists).
Before starting execution, read prior decisions for context:
qq-decisions.py summary --project .
This shows what design and plan phases decided and why — use this context to make consistent implementation choices.
Do NOT write a new plan, enter plan mode, or save files to .claude/plans/. The plan already exists — your job is to execute it, not rewrite it.
Classify the plan:
Use judgment for borderline cases.
Output a brief summary to the user (plain text, not a file):
Executing: <plan name> (coordinator mode, N phases)
Phase 0: ... → Phase 1: ... → ...
Then initialize checkpoint and begin immediately:
qq-execute-checkpoint.py save \
--project . --plan "<PLAN_PATH>" --step 0 --total <M> \
--mode <coordinator|direct> --phase "<FIRST_PHASE>" --status running
Before writing any engine source code, run the preflight check. Use the project_dir from qq-project-state.py output (§3) as $PROJECT — do not assume CWD is the project root.
qq-preflight.py --project "$PROJECT" --fix --pretty
--fix auto-repairs recoverable issues (e.g., injects tykit into manifest.json if missing).
Interpret the output:
ready: true → continue to §4.block_reason: "virgin_project" → STOP immediately. Tell the user to open the project in the engine's editor (Unity Hub / Godot / Unreal), wait for import, then confirm. Save checkpoint with --status paused. Do NOT write any source files until the user confirms.block_reason: "missing_tykit" → re-run with --fix, then ask user to open Unity so it resolves the package.ready: false → report the message and stop.After ready: true, do a test compile to verify the pipeline end-to-end:
qq-compile.sh --project "$PROJECT"
If this fails, diagnose and resolve before proceeding.
Mechanical backstop: The
compile-gate-check.shPreToolUse hook independently blocks engine source writes whenLibrary/is missing (virgin project) or the last compile failed. Even if you miss this pre-flight, the hook will catch it. But running preflight explicitly gives better diagnostics and enables--fix.
Why this matters: The auto-compile hook now sets a compile-gate on failure, but the gate only blocks the next edit — it cannot undo code you already wrote in a non-compiling state. Running preflight + test compile upfront catches issues before any code is written.
Follow existing project patterns.
Always pass context inline in subagent prompts. Never ask subagents to read CLAUDE.md, AGENTS.md, or the plan file — paste the relevant content directly. This saves tool calls and ensures subagents get exactly the context they need.
For each step, decide:
The main agent writes zero implementation code. Execute phases in the order the plan specifies (which may not be numeric — e.g. Phase 9.1 before Phase 2).
Dependency rule: Read the plan to identify which phases are sequential (have dependencies) vs. parallel (independent). The plan typically indicates this explicitly (e.g. "Phase 3 + Phase 4 parallel").
Sequential phases (downstream depends on upstream interfaces):
For each phase:
qq-compile.sh --project "$PROJECT" explicitly and check exit code 0. If fails: dispatch fix subagent (max 3 rounds, then --status paused)qq-execute-checkpoint.py saveParallel phases (independent, no shared interfaces):
qq-compile.sh --project "$PROJECT" and check exit code 0Key constraint: Do NOT parallelize phases that have interface dependencies. If Phase B uses interfaces defined in Phase A, Phase A must pass review before Phase B starts.
For truly large module-crossing refactors (10+ files, 3+ independent modules), consider dispatching subagents with isolation: "worktree" to avoid file conflicts.
Implementation subagent context — pass inline:
Review subagent context — pass inline:
Review prompt:
"Review the changes made in [PHASE_NAME] for behavior correctness. Compilation already passed — focus on logic errors that the compiler cannot catch:
- Are event triggers conditional on the right state? (e.g. only on kill, not every hit)
- Is state stored on the right lifecycle object? (e.g. persistent data on DontDestroyOnLoad singletons, not scene-scoped objects)
- Are edge cases handled? (null checks at system boundaries, empty collections) Report findings as [Critical] / [Moderate] / [Minor]. Be concise."
Checkpoint command (this is NOT optional — it is a fixed workflow step):
qq-execute-checkpoint.py save \
--project . --plan "<PLAN_PATH>" --step <N> --total <M> \
--mode <MODE> --phase "<PHASE_NAME>" --step-title "<STEP_TITLE_TEXT>"
This atomically updates .qq/state/execute-progress.json AND the plan file checkbox. Do NOT Edit the plan file separately.
After each step completes:
throw new NotImplementedException() or // TODO markers?qq-compile.sh --project "$PROJECT" and check exit code 0. The auto-compile hook sets a compile-gate on failure, but explicit verification catches issues immediately. Fix before proceeding. If unfixable after 3 attempts, save --status paused and stop.Clear the checkpoint:
qq-execute-checkpoint.py clear --project .
Summarize: what was implemented, deviations from plan, issues resolved.
Without --auto: recommend next step, wait for user:
/qq:claude-code-review (review first, then test)/qq:test/qq:commit-pushDo NOT recommend /qq:commit-push as the first next step. The order is always: review → test → commit-push.
With --auto: run qq-execute-checkpoint.py pipeline-advance --project . --completed-skill "/qq:execute" --next-skill "/qq:claude-code-review", then take the full path automatically:
/qq:claude-code-review → /qq:test → /qq:commit-push
/qq:add-tests over hand-writing test files