This skill converts research into a rigorous architecture plan with 5 artifacts, guiding design, patterns, and risk mitigation through interactive checkpoints.
npx playbooks add skill benredmond/apex --skill plan
<skill name="apex:plan" phase="plan">
<overview>
Transform research findings into battle-tested implementation plans through interactive design.
Produces 5 mandatory artifacts: Design Rationale and Evidence, Tree of Thought, Chain of Draft, YAGNI Declaration, Pattern Selection.
</overview>
<phase-model>
phase_model:
frontmatter: [research, plan, implement, rework, complete]
rework: enabled
db_role: [RESEARCH, ARCHITECT, BUILDER, BUILDER_VALIDATOR, REVIEWER, DOCUMENTER]
legacy_db_role: [VALIDATOR]
source_of_truth:
gating: frontmatter.phase
telemetry: db_role
</phase-model>
<phase-gate requires="research" sets="plan">
<reads-file>./apex/tasks/[ID].md</reads-file>
<requires-section>research</requires-section>
<appends-section>plan</appends-section>
</phase-gate>
<principles>
</principles>
<initial-response>
<if-no-arguments>
I'll create a rigorous technical architecture. Please provide the task identifier.
You can find active tasks in ./apex/tasks/ or run with:/apex:plan [identifier]
</if-no-arguments>
<if-arguments>Load task file and begin architecture process.</if-arguments>
</initial-response>
<workflow>
<step id="1" title="Load task and verify phase">
<instructions>
./apex/tasks/[identifier].mdphase: research<task-contract> from the research output FIRST and treat it as authoritative scope/ACs<task-contract> is missing, STOP and ask to rerun research or add the contract with an explicit amendment rationale<research> section for context<context-pack-refs>:Contract rules:
</instructions>
</step>
<step id="2" title="Read research and spawn verification agents">
<critical>
Read ALL files mentioned in research section FULLY before any analysis.
</critical>
<agents parallel="true">
<agent type="intelligence-gatherer">Verify and extend pattern intelligence from research</agent>
<agent type="apex:systems-researcher">Map system flows for components mentioned in research</agent>
<agent type="apex:git-historian">Surface timelines and regressions for affected areas</agent>
<agent type="failure-predictor">Identify what could go wrong based on history</agent>
<agent type="apex:risk-analyst">Enumerate edge cases and mitigations</agent>
</agents>
</step>
<step id="3" title="Present initial understanding">
<template>
Based on research and analysis, I understand we need to [accurate summary].
Key Findings:
Questions Requiring Human Judgment:
Let's address these before I develop architecture options.
</template>
<wait-for-user>Get confirmation before proceeding.</wait-for-user>
</step>
<step id="4" title="Propose architecture structure">
<template>
Here's my proposed architecture approach:
Does this structure align with your vision? Should I adjust?
</template>
<wait-for-user>Get confirmation before developing artifacts.</wait-for-user>
</step>
<step id="5" title="Develop 5 mandatory artifacts">
<critical>
YOU CANNOT PROCEED WITHOUT ALL 5 ARTIFACTS.
</critical>
<artifact id="1" name="Design Rationale and Evidence">
<purpose>Explain rationale and evidence: WHY exists? WHAT problems before? WHO depends? WHERE are landmines?</purpose>
<schema>
design_rationale:
current_state:
what_exists: [Component at file:line, purpose]
how_it_got_here: [Git archaeology with commit SHA]
dependencies: [Verified from code]
problem_decomposition:
core_problem: [Single sentence]
sub_problems: [Specific technical challenges]
hidden_complexity: [Non-obvious issues from patterns/history]
success_criteria:
automated: [Test commands, metrics]
manual: [User verification steps]
</schema>
</artifact>
<artifact id="2" name="Tree of Thought Solutions">
<purpose>Generate EXACTLY 3 substantially different architectures.</purpose>
<schema>
tree_of_thought:
solution_A:
approach: [Name]
description: [2-3 sentences]
implementation: [Steps with file:line refs]
patterns_used: [PAT:IDs with confidence ratings]
pros: [Evidence-backed advantages]
cons: [Specific limitations]
complexity: [1-10 justified]
risk: [LOW|MEDIUM|HIGH with reason]
solution_B: [FUNDAMENTALLY different paradigm]
solution_C: [ALTERNATIVE architecture]
comparative_analysis:
winner: [A|B|C]
reasoning: [Why, with evidence]
runner_up: [A|B|C]
why_not_runner_up: [Specific limitation]
</schema>
</artifact>
<artifact id="3" name="Chain of Draft Evolution">
<purpose>Show thinking evolution through 3 drafts.</purpose>
<schema>
chain_of_draft:
draft_1_raw:
core_design: [Initial instinct]
identified_issues: [Problems recognized]
draft_2_refined:
core_design: [Improved, pattern-guided]
improvements: [What got better]
remaining_issues: [Still problematic]
draft_3_final:
core_design: [Production-ready]
why_this_evolved: [Journey from draft 1]
patterns_integrated: [How patterns shaped design]
</schema>
</artifact>
<artifact id="4" name="YAGNI Declaration">
<purpose>Focus on production edge cases, exclude everything else.</purpose>
<schema>
yagni_declaration:
explicitly_excluding:
why_not: [Specific reason]
cost_if_included: [Time/complexity]
defer_until: [Trigger condition]
preventing_scope_creep:
future_considerations:
complexity_budget:
allocated: [1-10]
used: [By chosen solution]
reserved: [Buffer]
</schema>
</artifact>
<artifact id="5" name="Pattern Selection Rationale">
<purpose>Justify every pattern choice with evidence.</purpose>
<critical>
YOU CANNOT FABRICATE PATTERNS.
Only use patterns that exist in:
Before listing a pattern:
VIOLATION: Claiming "PAT:NEW:THING" that wasn't in research
CONSEQUENCE: Final reflection becomes unreliable and confidence ratings become meaningless
</critical>
<intelligence-sources>
Check these sections for valid patterns:
</intelligence-sources>
<schema>
pattern_selection:
applying:
confidence_rating: [★★★★☆]
usage_stats: [X uses, Y% success]
why_this_pattern: [Specific fit]
where_applying: [file:line]
source: [ctx.patterns | ctx.impl | ctx.web]
considering_but_not_using:
why_not: [Specific reason]
missing_patterns:
workaround: [Approach without pattern]
</schema>
</artifact>
</step>
<step id="6" title="Architecture checkpoint">
<template>
I've completed the 5 mandatory artifacts. Here's the selected architecture:
Chosen Solution: [Winner from Tree of Thought]
Key Patterns: [Top 3 patterns]
Excluded Scope: [Top 3 YAGNI items]
Complexity: [X/10]
Risk Level: [LOW|MEDIUM|HIGH]
Implementation will:
Implementation will NOT:
Should I proceed with the detailed architecture, or adjust any decisions?
</template>
<wait-for-user>Get confirmation before finalizing.</wait-for-user>
</step>
<step id="7" title="Generate architecture decision record">
<schema>
architecture_decision:
decision: [Clear statement of chosen approach]
files_to_modify:
purpose: [Why changing]
pattern: [PAT:ID applying]
validation: [How to verify]
files_to_create:
purpose: [Why needed]
pattern: [PAT:ID template]
test_plan: [Test approach]
implementation_sequence:
validation_plan:
automated: [Commands to run]
manual: [User verification]
potential_failures:
mitigation: [Prevention strategy]
detection: [Early warning]
</schema>
</step>
<step id="8" title="Write plan section to task file">
<output-format>
Append to <plan> section:
<plan>
<metadata>
<timestamp>[ISO]</timestamp>
<chosen-solution>[A|B|C]</chosen-solution>
<complexity>[1-10]</complexity>
<risk>[LOW|MEDIUM|HIGH]</risk>
</metadata>
<contract-validation>
<contract-version>[N]</contract-version>
<status>aligned|amended</status>
<acceptance-criteria-coverage>
<criterion id="AC-1">[How the plan will satisfy this AC]</criterion>
</acceptance-criteria-coverage>
<out-of-scope-confirmation>[Confirm no out-of-scope work is planned]</out-of-scope-confirmation>
<amendments-made>
<amendment version="[N]" reason="[Rationale or 'none']"/>
</amendments-made>
</contract-validation>
<design-rationale>
[Full artifact]
</design-rationale>
<tree-of-thought>
<solution id="A">[Full details]</solution>
<solution id="B">[Full details]</solution>
<solution id="C">[Full details]</solution>
<winner id="[X]" reasoning="[Why]"/>
</tree-of-thought>
<chain-of-draft>
<draft id="1">[Raw design]</draft>
<draft id="2">[Refined]</draft>
<draft id="3">[Final]</draft>
</chain-of-draft>
<yagni>
<excluding>[Features cut with reasons]</excluding>
<scope-creep-prevention>[Temptations resisted]</scope-creep-prevention>
<complexity-budget allocated="X" used="Y" reserved="Z"/>
</yagni>
<patterns>
<applying>[Patterns with locations and justifications]</applying>
<rejected>[Patterns considered but not used]</rejected>
</patterns>
<architecture-decision>
<files-to-modify>[List with purposes and patterns]</files-to-modify>
<files-to-create>[List with test plans]</files-to-create>
<sequence>[Implementation order with checkpoints]</sequence>
<validation>[Automated and manual checks]</validation>
<risks>[Potential failures with mitigations]</risks>
</architecture-decision>
<builder-handoff>
<mission>[Clear directive]</mission>
<core-architecture>[Winner approach summary]</core-architecture>
<pattern-guidance>[PAT:IDs with locations]</pattern-guidance>
<implementation-order>[Numbered steps]</implementation-order>
<validation-gates>[Checks after each step]</validation-gates>
<warnings>[Critical risks and edge cases]</warnings>
</builder-handoff>
<next-steps>
Run `/apex:implement [identifier]` to begin implementation.
</next-steps>
</plan>
</output-format>
<update-frontmatter>
Set phase: plan and updated: [ISO timestamp]
</update-frontmatter>
</step>
</workflow>
<self-review-checklist>
If ANY unchecked → STOP and revise
</self-review-checklist>
<success-criteria>
</success-criteria>
<next-phase>/apex:implement [identifier] - Build and validate loop
</next-phase>
</skill>
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.