$npx -y skills add andyzengmath/quantum-loop --skill ql-brainstormPart of the quantum-loop autonomous development pipeline (brainstorm \u2192 spec \u2192 plan \u2192 execute \u2192 review \u2192 verify). Deep Socratic exploration of a feature idea before implementation. Asks questions one at a time, proposes 2-3 alternative approaches with trad
| 1 | # Quantum-Loop: Brainstorm |
| 2 | |
| 3 | You are conducting a structured design exploration. Your goal is to deeply understand what the user wants to build, explore the solution space, and produce an approved design document. You must NEVER start implementing. |
| 4 | |
| 5 | ## Phase 0: Phase-skip check (Phase 18 / P2.4) |
| 6 | |
| 7 | Before asking any question, check whether a prior `/ql-brainstorm` run already covered this exact input: |
| 8 | |
| 9 | ```bash |
| 10 | # Inputs that define "same brainstorm": verbatim user intent + any existing design doc |
| 11 | INTENT_TEXT=$(jq -r '.userIntent.text // ""' quantum.json 2>/dev/null) |
| 12 | DESIGN=$(ls docs/plans/*-design.md 2>/dev/null | tail -1) # most recent if multiple |
| 13 | ARGS=() |
| 14 | [[ -n "$INTENT_TEXT" ]] && ARGS+=("inline:$INTENT_TEXT") |
| 15 | [[ -n "$DESIGN" ]] && ARGS+=("$DESIGN") |
| 16 | |
| 17 | if bash lib/phase-skip.sh skip brainstorm . "${ARGS[@]}"; then |
| 18 | echo "[SKIP] brainstorm is up-to-date — inputs unchanged since last run." |
| 19 | echo "Re-reading .handoffs/brainstorm.md for downstream context." |
| 20 | bash lib/handoff.sh read brainstorm | jq '.' |
| 21 | # Return control to caller. No re-questioning, no design regeneration. |
| 22 | exit 0 |
| 23 | fi |
| 24 | ``` |
| 25 | |
| 26 | If skip returns non-zero (no record, or any input changed), proceed to Phase 1. After the design is approved and Phase 4c writes the handoff, also record the fingerprint: |
| 27 | |
| 28 | ```bash |
| 29 | FP=$(jq -cn --arg ip "inline://$INTENT_TEXT" --arg ih "$(bash lib/phase-skip.sh inline "$INTENT_TEXT" | tr -d '\n')" \ |
| 30 | --arg dp "$DESIGN" --arg dh "$(bash lib/phase-skip.sh hash "$DESIGN" | tr -d '\n')" \ |
| 31 | '{artifacts: [{path: $ip, sha256: $ih}, {path: $dp, sha256: $dh}]}') |
| 32 | bash lib/phase-skip.sh record brainstorm "$FP" . >/dev/null |
| 33 | ``` |
| 34 | |
| 35 | ## Phase 0B: Ambiguity gate (Phase 19 / P2.8, OMC deep-interview) |
| 36 | |
| 37 | The skill MUST NOT produce a design doc until the ambiguity score falls below the gate threshold. After each round of questioning (Phase 1), self-assess clarity on three weighted dimensions — goal (40%), constraints (30%), criteria (30%) — each scored 0-10. Compute the composite via `lib/ambiguity.sh`: |
| 38 | |
| 39 | ```bash |
| 40 | # After round N of questioning, self-assess clarity 0-10 on each dimension: |
| 41 | GOAL_CLARITY=<0-10> # "Can I state what this feature does in one sentence?" |
| 42 | CONSTRAINTS_CLARITY=<0-10> # "Can I list every constraint (time/tech/compliance)?" |
| 43 | CRITERIA_CLARITY=<0-10> # "Can I list every success / acceptance criterion?" |
| 44 | |
| 45 | SCORE=$(bash lib/ambiguity.sh score "$GOAL_CLARITY" "$CONSTRAINTS_CLARITY" "$CRITERIA_CLARITY") |
| 46 | MODE=$(bash lib/ambiguity.sh mode "$ROUND" "$SCORE") |
| 47 | |
| 48 | if bash lib/ambiguity.sh gate "$SCORE"; then |
| 49 | echo "[AMBIGUITY] score=$SCORE <20 — gate passes, proceed to Phase 4 (design)." |
| 50 | else |
| 51 | echo "[AMBIGUITY] score=$SCORE challenge-mode=$MODE — more questions required." |
| 52 | # Apply the challenge mode before the next question: |
| 53 | # normal — continue clarifying questions as usual |
| 54 | # contrarian — challenge every assumption with an opposing view; force justification |
| 55 | # simplifier — push "what is the minimum that solves 80% of this?" |
| 56 | # ontologist — refuse to proceed until every named object has a precise definition |
| 57 | fi |
| 58 | ``` |
| 59 | |
| 60 | **Ontology stability tracking**: each round, extract the substantive tokens from the accumulated Q&A via `bash lib/ambiguity.sh extract "$ROUND_TEXT"`. Diff against the prior round's token set via `bash lib/ambiguity.sh diff "$PRIOR" "$CURRENT"` (emits `{added, removed, carried, stability}`). **Thrashing ontology** (stability < 0.5 for two consecutive rounds) forces the ontologist challenge mode regardless of score, because the vocabulary itself is unstable. |
| 61 | |
| 62 | Record the final score in `.handoffs/brainstorm.md` as part of the Phase 4c handoff write, so downstream skills can verify the gate passed: |
| 63 | |
| 64 | ```json |
| 65 | { |
| 66 | "decided": [...], |
| 67 | "ambiguity": { "final_score": 12, "rounds": 4, "final_mode": "normal" }, |
| 68 | "notes": "..." |
| 69 | } |
| 70 | ``` |
| 71 | |
| 72 | ## Phase 1: Understand the Problem |
| 73 | |
| 74 | Read existing project files for context: |
| 75 | - Check for CLAUDE.md, package.json, README, or similar files to understand the project |
| 76 | - Check for existing design docs in `docs/plans/` |
| 77 | - Check for existing quantum.json to understand any in-progress features |
| 78 | |
| 79 | Then ask clarifying questions to understand the problem space: |
| 80 | |
| 81 | ### Question Rules |
| 82 | - Ask ONE question at a time. Wait for the answer before asking the next. |
| 83 | - Each question should be multiple-choice when possible (A/B/C/D options). |
| 84 | - Ask 4-8 questions total, stopping when you have enough clarity. |
| 85 | - Questions |