一键导入
design
Run the full design-doc-writer and design-doc-reviewer loop until consensus. Produces a polished design document with a PR plan.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Run the full design-doc-writer and design-doc-reviewer loop until consensus. Produces a polished design document with a PR plan.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Turn a PGS research finding into a three-layer technical note bundle: (1) Grade-10 plain prose, (2) embedded SVG infographic with concise figures, (3) PhD-level rigorous technical treatment; plus a PNG export of the SVG. Output lives under research/<chapter>/30-30-30-technical-note/. Use when the user asks for a "30/30/30 technical note", "30-30-30 tech note", "/30-30-30-technical-note", or wants the standard finding bundle format for a research chapter.
Reduce reasoning friction and produce the most direct, high-fidelity answer or artifact possible. Use when the user invokes /actualize, says "actualize", "cut the fluff", "direct path only", "no redirection", or wants silent pre-output self-inspection to eliminate evasion, scope creep, habitual caution, process narration, or abstraction layers that dilute task fidelity.
Use when the user asks Codex to coordinate with Grok or another local peer agent through Agent Bus MCP, mentions agent-bus, bus topics, readiness handshakes, shared MCP coordination, peer handoffs, or asks to send/read messages through the bus.
Sticky Grok→Gemini collaboration via direct local Antigravity CLI (`agy`) subprocess calls only. Use when the user invokes /agy-cli-collab, $agy-cli-collab, says "antigravity collab", or asks Grok to consult Gemini through the agy CLI. Never use MCP agy_* tools when this skill is active. Multi-turn sessions resume with --conversation (pinned UUID) or --continue fallback.
Write, review, optimize, benchmark, or reason about assembly code for speed, efficiency, SIMD/vectorization, CPU hot paths, low-level kernels, instruction selection, register pressure, cache behavior, branch behavior, or compiler output. Use when the user asks for assembly, "write the kernel in asm", "review this assembly", "optimize this hot path", "explain the instruction schedule", "reduce latency in this loop", or provides surrounding C/ code + benchmark target and wants invariant-first low-level work.
Visual-first exploratory reasoning and hypothesis development for novel ideas, unconventional framings, and early-stage research. Use when the user wants to brainstorm, says "brainstorm", asks to enter brainstorm mode, wants non-obvious insights, wants to escape conventional framing, or wants quick computational probes and visual explanations such as scripts, plots, graphs, charts, infographics, diagrams, slides, parameter sweeps, tables, or toy models to test an idea before converging on a formal plan. Strong emphasis on turning ideas into seeable artifacts early.
| name | design |
| description | Run the full design-doc-writer and design-doc-reviewer loop until consensus. Produces a polished design document with a PR plan. |
| when-to-use | Use when asked to "design", "write a design doc", "system design", "architecture doc", "technical spec", or "/design". |
| argument-hint | <description of what to design> |
You are an orchestrator that runs the write -> review -> revise loop using the design-doc-writer and design-doc-reviewer personas. Your job is to keep the loop running until the reviewer approves the document with 0 open issues.
You coordinate only. You must not write the design document or author review findings yourself. All writing is done by a subagent seeded with the design-doc-writer persona instructions. All review is done by a subagent seeded with the design-doc-reviewer persona instructions.
Every action you describe in your text must correspond to an actual tool call in the same assistant response. Emit the spawn_subagent tool call first, then once the tool result is in the history write a brief post-launch confirmation in past tense ("Writer subagent launched", "Reviewer resumed"). Never end a turn with prose that claims a writer or reviewer subagent has been launched if no spawn_subagent call appears in the same response. Do not append permission-asking questions ("Want me to check in periodically?") to launch messages — pick a sensible default and proceed.
write-round-1 — Step 1 (spawn writer)review-round-1 — Step 2 (spawn reviewer)revise-round-N / rereview-round-N — Steps 4 + 5 as rounds repeatsummarize — Step 6final-reportExit when rereview-round-N produces 0 open issues.
Reseed after compaction — the harness no longer surfaces a pre-compaction todo snapshot, so if a compaction lands mid-loop, rebuild the scaffold from the canonical ids above (write-round-1, review-round-N, revise-round-N, rereview-round-N, summarize, final-report) using round_count (stored in orchestrator state, see Setup) and the persisted artifact paths (design_doc_file, summary_file, review_file). Do not advance to the next phase until the list is back.
This skill uses the design-doc-writer and design-doc-reviewer personas. The persona instructions are defined at:
<dirname of this SKILL.md>/../shared/personas/design-doc-writer.md
<dirname of this SKILL.md>/../shared/personas/design-doc-reviewer.md
Resolve these paths once at the start of the run (the system context gives you the absolute path to this SKILL.md). Read each file with read_file and store their contents as writer_persona_instructions and reviewer_persona_instructions.
When launching a subagent for the first time, prepend the appropriate persona instructions to its prompt. Do NOT pass a persona parameter to spawn_subagent — that parameter is not supported. Instead, prefix the description with a bracketed role tag ([writer] for design-doc-writer, [reviewer] for design-doc-reviewer) so the pager's subagent label renderer surfaces the role name at the top of the subagent row instead of the generic "General" fallback. The bracketed prefix is stripped from the displayed description. On resume_from follow-ups, the persona is already in the subagent's transcript from the initial launch — do not re-inject it; do keep the bracketed tag in the description so the label remains correct.
The user runs:
/design <description>
The <description> is the design task -- it can be a feature design, system architecture, migration plan, technical spec, or any design document. If the user provides file paths, links, or additional context in the conversation, include all of that context in the writer prompt.
Generate a unique ID for this run's artifact files. Execute this via run_terminal_cmd and capture the output:
python3 -c "import uuid; print(uuid.uuid4().hex[:8])" 2>/dev/null || cat /proc/sys/kernel/random/uuid 2>/dev/null | cut -c1-8 || echo "$(date +%s)" | tail -c 9
Validate that the command succeeded and produced a non-empty string. If DESIGN_ID is empty or the command failed, report the error to the user and stop -- do not proceed with empty/malformed file paths.
Store the output as DESIGN_ID.
Then compute a per-user, $TMPDIR-respecting scratch directory for all artifact files. Never write skill artifacts directly under /tmp on a shared host: it leaks their contents to other users and ignores a user-configured $TMPDIR. Run via run_terminal_cmd and capture stdout:
scratch_dir="${TMPDIR:-/tmp}/grok-$(id -u)"; mkdir -p "$scratch_dir" && chmod 700 "$scratch_dir" && echo "$scratch_dir"
Store the output as scratch_dir. Inline the resolved absolute path into every file path below and into every subagent prompt; do not rely on a $scratch_dir shell variable surviving across separate run_terminal_cmd calls (the same reason these skills inline other resolved paths).
Then define the shared file paths (all under scratch_dir) that will be threaded through every round:
design_doc_file: ${scratch_dir}/grok-design-doc-${DESIGN_ID}.mdsummary_file: ${scratch_dir}/grok-design-summary-${DESIGN_ID}.mdreview_file: ${scratch_dir}/grok-design-review-${DESIGN_ID}.mdThese paths stay the same for the entire loop. Never regenerate them between iterations.
Additionally, initialize these state variables for the orchestrator to maintain across rounds:
round_count: 0 — incremented each time a review completes (Step 2 and Step 5).total_issues_by_severity: {} — a map from severity (e.g., critical, major, minor, nit) to cumulative count. After each review, add the count of open issues by severity to this accumulator.previous_review_snapshot: "" — after each review, before the writer revises, save a copy of the review_file contents (or at minimum, the list of issue descriptions and their statuses) so you can detect stalemates by comparing the current round's wontfix/re-opened issues against the prior round.Launch the design-doc-writer subagent by calling spawn_subagent. Emit the spawn_subagent tool call before producing any "writer is starting" narration — the post-launch confirmation belongs in a later assistant message, after the tool result is in hand.
spawn_subagent parameters:
subagent_type: "general-purpose"description: "[writer] Write design doc: <short summary>"Prepend the writer persona instructions (loaded during setup) to the prompt.
Prompt:
<writer_persona_instructions>
---
Write a design document for the following:
<full user description and all relevant context from the conversation>
Write the design document to: <design_doc_file>
Write a summary of what was produced to: <summary_file>
IMPORTANT: At the very bottom of the design document, include a section called "## PR Plan" that breaks the design into concrete, ordered pull requests. Each PR should have:
- PR title
- Files/components affected
- Dependencies on other PRs (if any)
- Brief description of changes
The PR plan should represent a realistic, incremental implementation strategy -- each PR should be independently reviewable and mergeable.
The document must also include a "## Key Decisions" section that summarizes the most important architectural and design decisions made, with brief rationale for each.
Wait for the subagent to complete. If it fails, report the error to the user and stop.
Save the returned subagent_id -- you will resume this agent for all revision rounds.
Report to the user: "Design document drafted. Starting review..."
Launch the design-doc-reviewer subagent by calling spawn_subagent.
spawn_subagent parameters:
subagent_type: "general-purpose"description: "[reviewer] Review design document"Prepend the reviewer persona instructions (loaded during setup) to the prompt.
Prompt:
<reviewer_persona_instructions>
---
Review the design document.
The design document is at: <design_doc_file>
The writer's summary is at: <summary_file>
Read both files. Review the document thoroughly.
Write your review notes to: <review_file>
Use the structured format with severity, section, description, suggestion, and status for each issue.
Every issue must have a Status field set to "open".
Pay special attention to:
- Whether the PR Plan at the bottom is realistic and properly ordered
- Whether Key Decisions are well-reasoned and complete
- Whether the design is specific enough that an engineer could implement from it
- Whether alternatives were meaningfully explored
Wait for the subagent to complete. If it fails, report the error to the user and stop.
Save the returned subagent_id -- you will resume this agent for all re-review rounds.
Read the review_file yourself. Categorize all issues by status:
Status: openStatus: wontfixStatus: needs-user-inputDecision logic:
Stalemate detection: Compare the current review_file against previous_review_snapshot from the prior round. If any issue (matched by section name and description) was marked wontfix by the writer in the previous round and has been re-opened (Status: open) by the reviewer in the current round, the writer and reviewer have reached a disagreement they cannot resolve on their own. Treat this as a stalemate -- proceed to Step 3a to escalate the disputed issue(s) to the user.
After completing Step 3 checks (and before proceeding to Step 4), update previous_review_snapshot with the current review_file contents so it is available for comparison in the next round.
For any needs-user-input issues or stalemate disputes, present each unresolved item to the user (use the appropriate ask/question tool if available):
After the user responds, resume the writer (Step 4) with the user's decisions included in the prompt. Tell the writer to treat user decisions as final -- incorporate them without further debate and set the corresponding issues to Status: addressed.
Resume the original design-doc-writer to address all review findings.
spawn_subagent parameters:
subagent_type: "general-purpose"resume_from: <writer_subagent_id>description: "[writer] Revise design doc"Prompt:
The reviewer found issues. The review_file is at: <review_file>
Read the review_file. Address ALL issues with Status: open -- including nits and minor suggestions. Nothing is too small to fix.
For each issue, revise the design document at: <design_doc_file>
Then update the review_file:
- Change Status: open -> Status: addressed
- Add a Response field explaining what you changed
You are encouraged to push back on feedback that doesn't make sense, is contradictory, or would make the design worse. If you disagree with an issue:
- Set Status: wontfix
- Write a clear, technical explanation of why the reviewer's suggestion is wrong or counterproductive
- Do NOT comply with feedback just to make the reviewer happy -- defend good design decisions
If an issue is ambiguous or requires user input to resolve -- whether it's a product decision, a technical trade-off, or anything where the user's judgment would help break a tie -- set Status: needs-user-input and explain what question the user needs to answer.
Append a Revision Summary at the bottom of the review_file.
Wait for completion. If it fails, report the error to the user and stop.
Update the saved writer subagent_id with the new one returned.
Report to the user: "Revisions applied. Running re-review..."
Resume the original reviewer to re-review the revisions.
spawn_subagent parameters:
subagent_type: "general-purpose"resume_from: <reviewer_subagent_id>description: "[reviewer] Re-review design doc"Prompt:
The writer addressed the review issues. Re-review the design document.
The updated review_file with writer responses is at: <review_file>
The design document is at: <design_doc_file>
The writer's summary is at: <summary_file>
Read all files. Review the document again thoroughly.
Rewrite the review_file with your new findings:
- If a previous issue was properly addressed, do not re-list it.
- If a revision introduced a new problem, list it as a new issue with Status: open.
- If any issue was not properly addressed, re-list it with Status: open.
- Use the same structured format (severity, section, description, suggestion, status).
Wait for completion. If it fails, report the error to the user and stop.
Update the saved reviewer subagent_id with the new one returned.
Go back to Step 3. Repeat until 0 open issues.
Once the reviewer reports 0 open issues, read the final design document from <design_doc_file>.
Read the design document and extract the "Key Decisions" section. Present a concise summary to the user listing each decision and its rationale.
Read the design document and extract the "Open Questions" section (if any remain). If there are unresolved open questions, present them to the user for resolution (use the appropriate ask/question tool if available). For each open question:
If the user provides answers, resume the writer one final time to incorporate the answers into the design document, then skip re-review (the answers are user decisions, not design issues).
If there are no open questions, skip this step.
Read and present the "PR Plan" section from the design document to the user.
The only exit condition for the write-review loop is the reviewer reporting 0 issues of any severity. There is no iteration cap. Every issue -- including nits and minor suggestions -- must be addressed before the loop terminates.
After presenting the final report, clean up the artifact files:
rm -f <summary_file> <review_file>
Keep the <design_doc_file> -- it is the deliverable.
When the loop terminates, present a final report to the user:
round_count (how many review-revise iterations it took to reach consensus).total_issues_by_severity (cumulative count across all rounds, broken down by severity).Give the user a brief status update after each phase:
design-doc-writer or design-doc-reviewer persona instructions (from the shared personas file) to the subagent prompt on initial launches. Do NOT pass a persona parameter to spawn_subagent. On resume_from follow-ups, the persona is already in the transcript from the initial launch.description with a bracketed role tag -- [writer] for design-doc-writer launches and revisions, [reviewer] for design-doc-reviewer launches and re-reviews. The pager parses the first [tag] of the description and uses it as the row label (the bracketed prefix is stripped from the displayed description). Without this, every row falls through to the generic "General" label. Keep the tag on resume_from follow-ups too so the label stays stable across rounds.spawn_subagent -- these are needed for resume_from on subsequent rounds.Status: wontfix with a technical justification. The reviewer may re-open it, but if they disagree twice, it's a stalemate that gets escalated to the user.needs-user-input issue, the writer must incorporate it without further debate.