一键导入
qgenerate-spec
Use when a plan or task needs spec documents: TASK_REQUEST and VERIFY_CHECKLIST. Use Qplan for roadmap/phases; use Qexecute after the spec exists.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when a plan or task needs spec documents: TASK_REQUEST and VERIFY_CHECKLIST. Use Qplan for roadmap/phases; use Qexecute after the spec exists.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Use when collecting verified project-local coding guidance into .claude/skills based on the project tech stack, with TTL and user-edit protection.
Shows QE Framework usage overview. With no arg, prints the full catalog. With a skill name arg (e.g., /Qhelp Qcommit), reads that skill's SKILL.md and summarizes it in the user's language. Also supports find/search skills mode via reference/find-skills.md.
QE framework (Query Executor) initial setup. Creates the QE state directory, client-specific instruction/config artifacts, and .gitignore entries in a new project, then auto-analyzes the project. Use when the user wants to initialize a project or set up the framework.
Diagnoses and repairs QE installation health across qe-framework, MCP client config, and the project .qe directory. Use for 'doctor', 'check QE health', dependency verification, corrupted .qe state, or repair guidance. Distinct from Qupdate, which updates installed assets.
Use when executing a TASK_REQUEST/VERIFY_CHECKLIST or when already-changed code needs the test-review-fix quality loop. With no flag it auto-selects sequential or parallel-wave execution; `-verify` runs verification. Use Qautoresearch for iterative code-optimization loops and Qscenario-test for scenario/E2E.
Use when the user invokes Qgs or a Qplan handoff needs TASK_REQUEST + VERIFY_CHECKLIST generation. Alias for Qgenerate-spec. Use Qplan for roadmap; use Qexecute after specs exist.
| name | Qgenerate-spec |
| description | Use when a plan or task needs spec documents: TASK_REQUEST and VERIFY_CHECKLIST. Use Qplan for roadmap/phases; use Qexecute after the spec exists. |
| invocation_trigger | When a new project, task, or bug fix spec needs to be defined. |
| user_invocable | true |
| recommendedModel | haiku |
You are a specialist document writer acting as a sub-component of the Qplan ecosystem. Your primary goal is to transform a high-level roadmap Phase into Haiku-Ready Atomic Tasks.
AskUserQuestion and MUST NOT print options as plain text. Codex interactive may print concise plain-text choices because AskUserQuestion is not a Codex primitive. Codex non-interactive MUST select the deterministic recommended default and report it.Interaction rules:
AskUserQuestion for Step 3 and any other structured choice.Command rendering rules:
adapter.commandPrefix./Q..., for example /Qexecute {UUID}.$Q..., for example $Qexecute {UUID}.| # | Filename | Path | Description |
|---|---|---|---|
| 1 | Project instruction artifact | Project root | Client-specific project context when needed. Claude adapter writes CLAUDE.md; Codex-capable projects may use AGENTS.md or an existing instruction artifact. Must reference QE_CONVENTIONS.md for QE rules. Task history is in .qe/TASK_LOG.md. |
| 2 | TASK_REQUEST_{UUID}.md | .qe/tasks/pending/ | Task request — what, how, checklist, notes |
| 3 | VERIFY_CHECKLIST_{UUID}.md | .qe/checklists/pending/ | Verification checklist — validation criteria, additional notes |
pending/.Before executing the spec generation workflow, resolve SIVS engine routing:
.qe/sivs-config.json from the project root (via scripts/lib/codex_bridge.mjs → loadSivsConfig()).resolveEngine("spec", config).
claude (default): Proceed with the standard workflow below. Claude owns the spec, but may delegate bounded repo search/context gathering to Codex when useful.codex: Delegate spec generation through codex_bridge.mjs / codex-plugin-cc. If the bridge is unavailable, warn and fall back to Claude.codex: Use the native Codex execution path. If native subagent delegation is unavailable, keep the work in the lead session as a role-separated inline pass and mark the route degraded-inline.claude: Delegate through Qclaude-rescue / claude_bridge.mjs when available. If the bridge is unavailable, warn and run the spec stage on Codex with crossmodel=false.detectLegacyConfig(). If non-null, display the migration warning to the user before proceeding.Codex Spec Delegation Format: When delegating to Codex, pass the following prompt structure:
Generate a TASK_REQUEST and VERIFY_CHECKLIST for: {user's task description}
Project context: {from active project instruction artifact, e.g. CLAUDE.md or AGENTS.md}
Phase context: {from ROADMAP.md active phase}
Format: Markdown with checklist items
Fallback guarantee: If .qe/sivs-config.json does not exist, all stages default to Claude. This preserves existing single-engine workflows while Codex routing remains available through SIVS config.
If spec generation depends on a user-requested MCP server, invoke
{adapter.commandPrefix}Qmcp ensure to check local client configuration before
using that server.
PASS → the requested MCP server may be used.WARN → continue with local-only spec generation and record the degraded MCP path.FAIL → stop only when the requested spec explicitly depends on that MCP server;
otherwise continue without claiming MCP coverage.Before collecting user info, identify the strategic context:
{slug}: (where slug is [a-z0-9][a-z0-9-]{0,63}), use that as the plan slug and strip it from the argument string..qe/state/current-session.json → extract session_id → read .qe/planning/.sessions/{session_id}.json → extract activePlanSlug..qe/planning/ACTIVE_PLAN (single-line slug pointer)..qe/planning/ROADMAP.md + STATE.md and proceed as before..qe/planning/plans/{slug}/ROADMAP.md and plans/{slug}/STATE.md. When falling back, read the flat files.{adapter.commandPrefix}Qplan first to maintain the PSE Chain integrity.Before gathering spec details, run a lightweight ambiguity check. If the incoming requirement is ambiguous AND the task scale is Small or larger, perform a concise Socratic clarification pass before drafting. (Source: adapted from Superpowers' brainstorming stage — but scale-aware, not mandatory; see D019 in .qe/planning/DECISION_LOG.md.)
This is our deliberate differentiator from Superpowers' blanket-mandatory brainstorming: a one-line bug fix must never be forced through a clarification round.
Gate condition = ambiguous(requirement) AND scale ≥ Small.
Qplan Step 0.7 (Micro / Small / Full / Workflow). Micro tasks always skip this gate.On gate trigger: produce one of:
PASS → ambiguity resolved (or never present); continue to Step 2 with the sharpened requirement.CLARIFY → unresolved gaps remain; surface its questions to the user before drafting. Do not draft specs from an unclarified CLARIFY requirement.Skip the gate entirely when: scale is Micro, the requirement already cites specific file paths / functions / reproduction steps, or the task type is docs/analysis with a clear target. The gate is a clarification prompt, not a hard block — a PASS proceeds immediately with no added friction.
... (omitted) ...
Required information:
code|analysis|docs|other), validation criteria (checks), verification notes, and optional decision rationale (chosen approach, alternatives, consequences)type: code task, include a mandatory risk section that names worst-case failure, data loss/corruption risk, security/permission risk, concurrency/race risk, rollback strategy, and unverified assumptions. If a category is not applicable, write N/A with the reason; do not omit it.Write drafts using templates from templates/ directory (TASK_REQUEST_TEMPLATE.md, VERIFY_CHECKLIST_TEMPLATE.md). For any generated project instruction artifact, reference QE_CONVENTIONS.md (project root) for QE rules (file naming, task status, completion criteria) and include a reference line pointing to it. Replace {{placeholder}} with actual content.
Before drafting specs, verify that any external platform features, APIs, or tools referenced in the task actually exist and work as claimed.
When to run: Any task that depends on features outside the project's own codebase — Claude Code CLI features, npm packages, OS commands, API endpoints, plugin.json fields, hook events, etc.
Procedure:
command --help or command --version via Bash and check the outputhooks.json eventsnpm info {package} version to confirm existenceOutcome:
[UNVERIFIED] in TASK_REQUEST and alert the user via additionalContext: "This task depends on unverified external feature: {feature}. Confirm before proceeding."Skip conditions: Tasks with no external dependencies (pure local logic, documentation, analysis).
After drafting, verify spec quality. Skip conditions (fast path): checklist ≤ 3 items OR type: docs/analysis → skip entirely, proceed to Step 3.
When verification runs, perform both structural and executability checks in a single pass:
Structural criteria (S1-S5) — Use Haiku:
Executability criteria (E1-E4) — Use Sonnet:
| # | Criterion | Fail Example |
|---|---|---|
| E1 | Single-action executability | "Design API and implement routes" — two distinct edits |
| E2 | Output path validity | → output: src/utils/helper — missing extension |
| E3 | Logical ordering | Item 3 references file from Item 5 |
| E4 | Verifiable completion | "Refactor code appropriately" — subjective |
For complex tasks (8+ items): Spawn Plan agent (subagent_type: "Plan", model: Haiku) for S1-S5 review while self-checking E1-E4 in parallel using Sonnet. Max 2 iterations.
For simple tasks (4-7 items): Self-check all 9 criteria without agent spawn. Use Sonnet for full-pass or Haiku for S1-S5 if splitting. Max 1 iteration.
Any fail → fix automatically. After max iterations, proceed with best version.
Step 2.5 checks spec quality with the same model that drafted it — which cannot catch errors rooted in that model's own blind spots (the self-reference problem, acute when the SIVS engine is homogeneously all-Claude or all-Codex). Step 2.6 closes that gap with an independent adversarial gate.
This gate ALWAYS runs. Unlike Step 2.5, it has no skip conditions — it runs regardless of item count or task type (DECISION_LOG D011). Spec-stage errors are independent of size, so size-based skipping would reopen the exact hole this gate exists to close.
Procedure:
{adapter.commandPrefix}Qcritical-review --stage spec against the just-drafted TASK_REQUEST
(+ VERIFY_CHECKLIST). The gate spawns the Structural Reviewer + Critical
Reviewer + Edge Case Finder in parallel and returns a PASS/WARN/FAIL verdict.
Engine routing is automatic: same-engine baseline always, with the Critical
Reviewer auto-upgraded to codex when reachable — no config required. Full
protocol: skills/Qcritical-review/reference/spec-gate-protocol.md.Skip conditions: none. (Autonomous mode still runs the gate; on FAIL it auto-revises up to the iteration cap, then proceeds Generate-Only.)
AskUserQuestion.selected_default=Generate Only.{adapter.commandPrefix}Qexecute with the generated UUIDs.On "Generate & Execute":
{adapter.commandPrefix}Qexecute {UUID} immediately. (Sets <!-- chained-from: Qgenerate-spec --> flag so Qexecute skips approval)On "Generate Only":
mkdir -p)TASK_REQUEST_*.md / VERIFY_CHECKLIST_*.md found in project root, suggest migrating to .qe/tasks/pending/ and .qe/checklists/pending/.claude/settings.json and project .mcp.json are expected but missing, suggest creating them with defaults./hooks workflow when needed..gitignore management: Add missing shared entries under # QE Framework section:
# QE Framework
.claude/settings-local.json
.qe/tasks/
.qe/checklists/
TASK_REQUEST_*.md
VERIFY_CHECKLIST_*.md
ANALYSIS_*.md
Output status summary after file creation:
✅ Generation complete (spec documents only):
- Project instruction artifact when this invocation created or migrated one
- .qe/tasks/pending/TASK_REQUEST_{UUID}.md
- .qe/checklists/pending/VERIFY_CHECKLIST_{UUID}.md
❌ Not yet created (actual deliverables):
- {expected output files from TASK_REQUEST checklist}
On "Generate & Execute" with multiple tasks:
{adapter.commandPrefix}Qexecute {UUID1} {UUID2} ... {UUIDn} with all generated UUIDs space-separated in a single call. Qexecute handles parallel execution.When called from Qexecute -utopia (autonomous mode), Qgenerate-spec:
<!-- chained-from: Qgenerate-spec --> on generated TASK_REQUEST filesSee Qexecute -utopia for autonomous execution modes (-utopia, -utopia -verify).
TASK_REQUEST and VERIFY_CHECKLIST must match the user's language.
CLAUDE.md, Codex-capable projects may use AGENTS.md or an equivalent QE-managed instruction file..qe/TASK_LOG.md. The instruction artifact only contains a reference pointer: ## Task Log → see .qe/TASK_LOG.md- [ ] {desc} <!-- depends_on: [UUID/Item#] -->.→ output: {file-path} for direct accountability.type: code): Add this section before the checklist and fill every field:
## Risk Register
- Worst-case failure:
- Data loss / corruption risk:
- Security / permission risk:
- Concurrency / race risk:
- Rollback strategy:
- Unverified assumptions:
The register is a hard SIVS contract. Empty fields, placeholder text, or omitted categories block execution until fixed..qe/TASK_LOG.md task list to ✅type: code → add: "No security vulnerabilities (OWASP Top 10) in changed code", "All existing tests pass", "Worst-case failure path is identified", "Data loss/corruption, security/permission, and concurrency/race risks are explicitly evaluated or marked N/A with reason", "Unverified assumptions and residual risks are reported in the final handoff", "High-risk findings are mitigated by tests, defensive code, or an explicit defer rationale"type: code + auth/crypto/payment → add: "Authentication/encryption implementation is secure (Esecurity-officer or manual review)"type: docs → add: "All links in documentation are valid", "Terminology and formatting are consistent"a1b2c3d4), generated randomlyTASK_REQUEST_{UUID}.md already exists in .qe/tasks/pending/ or .qe/tasks/completed/. If it exists, generate a new random UUID and check again.openssl rand -hex 4 (produces 8-char hex)After draft creation (Step 2) and before handing off, check whether the TASK_REQUEST opts into contract candidate extraction.
Opt-in marker: If the TASK_REQUEST body contains the exact HTML-comment marker <!-- contract-candidates: auto -->, enter this flow. If absent, skip entirely.
Flow:
extractCandidates(taskRequestText) from hooks/scripts/lib/contract-candidate-extractor.mjs.{name, targetPath, suggestedSignature}:
.qe/contracts/TEMPLATE.md as the base.Signature body with a code block containing suggestedSignature (empty string initially — user fills in later).Purpose with a single line: Business-logic contract for \${targetPath}``Constraints, Invariants, Error Modes as lightly pre-filled placeholders (e.g., - TBD (candidate draft)).Flow (optional section) unless the user fills it..qe/contracts/pending/${name}.md..qe/contracts/active/ — user must review and promote manually. This preserves the opt-in, user-in-the-loop principle (D011).{adapter.commandPrefix}Qcontract approve after review.Skip conditions:
extractCandidates returns [] → skip with a short note ("Marker present but no .mjs output items found in checklist.").Reference: See .qe/contracts/README.md and D011 in .qe/planning/DECISION_LOG.md (DECISION_LOG stays global across all plans).
After generating spec files (on "Generate Only"), display using the standard handoff format from QE_CONVENTIONS.md:
Phase {X}: {PhaseName} — Spec complete
PSE: [x] Plan [x] Spec [>] Execute [ ] Verify
{TaskDescription — 다음 작업 내용 한 줄 요약}
Next: {adapter.commandPrefix}Qexecute {UUID}
Note: "Generate & Execute" auto-chains, so the handoff is only needed for "Generate Only".