Best practice

From tykisgod/quick-question · View interactive version

Best practice is an AI agent skill from the GitHub repository tykisgod/quick-question. Quick Unity best-practice check — run after editing C# files to catch anti-patterns, performance issues, and runtime safety problems.

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-policy-check.sh exits 127.

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

Quick best-practice check for Unity C# code: anti-patterns, performance traps and runtime safety issues in what just changed.

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:best-practice" --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.

Scope Detection

  1. If the user specified files or a scope → use that
  2. If .cs files were edited in this conversation → check those files
  3. If there are uncommitted changes → git diff --name-only HEAD -- '*.cs'
  4. If none of the above → ask the user what to check

Deterministic Policy Layer

If qq-policy-check.sh is available, run it first against the selected scope:

qq-policy-check.sh --json <files...>

Treat those results as established findings — don't rediscover them; add contextual review, prioritization, explanation and fix suggestions on top.

Review Rules

Anti-Pattern Detection

  1. FindObjectOfType / FindObjectsOfType
  1. Message system calls with untyped object[] parameters
  1. Accessing shared data in Awake/Start
  1. Caching a read-only interface reference then mutating through it
  1. SendMessage / BroadcastMessage / SendMessageUpwards
  1. Unsolicited UI code changes

Performance

  1. GetComponent in Update / FixedUpdate / LateUpdate
  1. Per-frame heap allocations
  1. Coroutines started without cleanup
  1. gameObject.tag == string comparison

Runtime Safety

  1. Event subscription without unsubscription
  1. Missing [RequireComponent] for GetComponent dependencies

Architecture Checks

  1. Circular dependency risk
  1. Missing .asmdef references
  1. Incorrect namespace conventions
  1. Public fields instead of [SerializeField] private

Code Quality

  1. Excessive null checks
  1. Missing documentation comments

Project rules

Also apply the project's own coding rules from CLAUDE.md and AGENTS.md (read AGENTS.md if it exists).

Output Format

Group output by severity:

## 🔴 Critical (High severity — must fix)
- [file:line] Issue description → suggested fix

## 🟠 Moderate (Medium severity — should fix)
- [file:line] Issue description → suggested fix

## 🟡 Suggestions (Notice — nice to fix)
- [file:line] Issue description → suggested fix

## ✅ Code Quality Highlights
- Brief list of things done well

Execution

  1. Determine scope (see Scope Detection above)
  2. Run qq-policy-check.sh --json if available
  3. Read all relevant .cs files
  4. Check the rules above, treating deterministic policy findings as already established
  5. Merge deterministic findings with model findings in the output format above
  6. If critical issues are found, ask whether to auto-fix them

Handoff

After the check completes, recommend the next step:

--auto mode: skip asking, take the strictest path:

auto-fix all issues, then run qq-execute-checkpoint.py pipeline-advance --project . --completed-skill "/qq:best-practice" --next-skill "/qq:claude-code-review", then invoke /qq:claude-code-review --auto.

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.