| name | workflow-skill-designer |
| description | Meta-skill for designing orchestrator+phases structured workflow skills. Creates SKILL.md coordinator with progressive phase loading, TodoWrite patterns, and data flow. Triggers on "design workflow skill", "create workflow skill", "workflow skill designer". |
| allowed-tools | Agent, AskUserQuestion, TodoWrite, Read, Write, Edit, Bash, Glob, Grep |
Workflow Skill Designer
Meta-skill for creating structured workflow skills following the orchestrator + phases pattern. Generates complete skill packages with SKILL.md as coordinator and phases/ folder for execution details.
Architecture Overview
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Workflow Skill Designer โ
โ โ Analyze requirements โ Design orchestrator โ Generate phases โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโผโโโโโโโโโโโโฌโโโโโโโโโโโโ
โ โ โ โ
โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โ Phase 1 โ โ Phase 2 โ โ Phase 3 โ โ Phase 4 โ
โ Require โ โ Orch โ โ Phases โ โ Valid โ
โ Analysisโ โ Design โ โ Design โ โ & Integ โ
โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โ โ โ โ
workflow SKILL.md phases/ Complete
config generated 0N-*.md skill pkg
Target Output Structure
The skill this meta-skill produces follows this structure:
.claude/skills/{skill-name}/
โโโ SKILL.md # Orchestrator: coordination, data flow, TodoWrite
โโโ phases/
โ โโโ 01-{phase-name}.md # Phase execution detail (full content)
โ โโโ 02-{phase-name}.md
โ โโโ ...
โ โโโ 0N-{phase-name}.md
โโโ specs/ # [Optional] Domain specifications
โโโ templates/ # [Optional] Reusable templates
Core Design Patterns
Patterns extracted from successful workflow skill implementations (workflow-plan, project-analyze, etc.):
Pattern 1: Orchestrator + Progressive Loading
SKILL.md = Pure coordinator. Contains:
- Architecture diagram (ASCII)
- Execution flow with
Ref: phases/0N-xxx.md markers
- Phase Reference Documents table (read on-demand)
- Data flow between phases
- Core rules and error handling
Phase files = Full execution detail. Contains:
- Complete agent prompts, bash commands, code implementations
- Validation checklists, error handling
- Input/Output specification
- Next Phase link
Key Rule: SKILL.md references phase docs via Ref: markers. Phase docs are read only when that phase executes, not all at once.
Pattern 2: TodoWrite Attachment/Collapse
Phase starts:
โ Sub-tasks ATTACHED to TodoWrite (in_progress + pending)
โ Orchestrator executes sub-tasks sequentially
Phase ends:
โ Sub-tasks COLLAPSED back to high-level summary (completed)
โ Next phase begins
Pattern 3: Inter-Phase Data Flow
Phase N output โ stored in memory/variable โ Phase N+1 input
โโ or written to session file for persistence
Each phase receives outputs from prior phases via:
- In-memory variables (sessionId, contextPath, etc.)
- Session directory files (.workflow/active/{sessionId}/...)
- Planning notes (accumulated constraints document)
Pattern 4: Conditional Phase Execution
Phase N output contains condition flag
โโ condition met โ Execute Phase N+1
โโ condition not met โ Skip to Phase N+2
Pattern 5: Input Structuring
User input (free text) โ Structured format before Phase 1:
GOAL: [objective]
SCOPE: [boundaries]
CONTEXT: [background/constraints]
Pattern 6: Interactive Preference Collection (SKILL.md Responsibility)
Workflow preferences (auto mode, force explore, etc.) MUST be collected via AskUserQuestion in SKILL.md before dispatching to phases. Phases reference these as workflowPreferences.{key} context variables.
Anti-Pattern: Command-line flags (--yes, -e, --explore) parsed within phase files via $ARGUMENTS.includes(...).
const prefResponse = AskUserQuestion({
questions: [
{ question: "ๆฏๅฆ่ทณ่ฟ็กฎ่ฎค๏ผ", header: "Auto Mode", options: [
{ label: "Interactive (Recommended)", description: "ไบคไบๆจกๅผ" },
{ label: "Auto", description: "่ทณ่ฟๆๆ็กฎ่ฎค" }
]}
]
})
workflowPreferences = { autoYes: prefResponse.autoMode === 'Auto' }
const autoYes = workflowPreferences.autoYes
const autoYes = $ARGUMENTS.includes('--yes') || $ARGUMENTS.includes('-y')
Pattern 7: Direct Phase Handoff
When one phase needs to invoke another phase within the same skill, read and execute the phase document directly. Do NOT use Skill() routing back through SKILL.md.
Read("phases/02-lite-execute.md")
Skill(skill="workflow-lite-plan", args="--in-memory")
Pattern 8: Phase File Hygiene
Phase files are internal execution documents. They MUST NOT contain:
| Prohibited | Reason | Correct Location |
|---|
Flag parsing ($ARGUMENTS.includes(...)) | Preferences collected in SKILL.md | SKILL.md via AskUserQuestion |
Invocation syntax (/skill-name "...") | Not user-facing docs | Removed or SKILL.md only |
Conversion provenance (Source: Converted from...) | Implementation detail | Removed |
Skill routing for inter-phase (Skill(skill="...")) | Use direct phase read | Direct Read("phases/...") |
Pattern 9: Compact Recovery (Phase Persistence)
Multi-phase workflows span long conversations. Context compression (compact) will naturally summarize earlier phase documents. The strategy uses ๅ้ไฟ้ฉ: TodoWrite ่ท่ธช active phase ไฟๆคๅ
ถไธ่ขซๅ็ผฉ๏ผsentinel ไฝไธบๅ
ๅบๅจๅ็ผฉๅ็ๆถ่งฆๅๆขๅคใ
Design principle: TodoWrite in_progress = active phase โ protect from compact | Sentinel = re-read fallback if protection fails.
Double insurance mechanism:
| Layer | Role | Mechanism |
|---|
| 1. Active Phase Protection | ้ข้ฒ | TodoWrite in_progress ๆ ่ฎฐๅฝๅ phase โ compact ๆถไฟ็่ฏฅ phase ๅฎๆดๅ
ๅฎน๏ผไธๅ็ผฉ |
| 2. Sentinel Re-read | ๆขๅค | Phase ๆไปถๅตๅ
ฅๆ ่ฏ็ฌฆ โ ่ฅไป่ขซๅ็ผฉ๏ผๆฃๆตๅฐ sentinel-only ็ถๆๆถ็ซๅณ re-read |
When to apply: ไปปไฝ้่ฟ direct handoff (Pattern 7) ่ทจ phase ๆง่ก็ๅบๆฏ๏ผๅฐคๅ
ถๆฏๅ็ปญ phase ๅ
ๅซๅคๆๆง่กๅ่ฎฎ๏ผๅค Stepใagent ่ฐๅบฆใCLI ็ผๆ๏ผๆถใ
Layer 1: Active Phase Protection (TodoWrite ่ๅจ)
TodoWrite ๅทฒ็ป่ท่ธชๆฏไธช phase ็ๆง่ก็ถๆใๅฉ็จๆญคไฟกๆฏ้ฉฑๅจ compact ็ญ็ฅ๏ผ
TodoWrite status โ Compact behavior:
โโ completed โ โ
ๅฏๅ็ผฉ๏ผๅทฒๅฎๆ๏ผไธๅ้่ฆๅฎๆดๅ
ๅฎน๏ผ
โโ in_progress โ ๐ก๏ธ ็ฆๆญขๅ็ผฉ๏ผๆญฃๅจๆง่ก๏ผๅฟ
้กปไฟ็ๅฎๆดๅ่ฎฎ๏ผ
โโ pending โ โ
ๅฏๅ็ผฉ๏ผๅฐๆชๅ ่ฝฝ๏ผๆ ๅ
ๅฎน๏ผ
SKILL.md Execution Flow ไธญๆ ๆณจ compact ่ๅจ:
## Execution Flow
> **โ ๏ธ COMPACT DIRECTIVE**: Context compression MUST check TodoWrite phase status.
> The phase currently marked `in_progress` is the active execution phase โ preserve its FULL content.
> Only compress phases marked `completed` or `pending`.
Phase 1: Requirements Analysis โ TodoWrite tracks status
โโ Ref: phases/01-xxx.md
Phase 2: Execution Engine โ TodoWrite tracks status
โโ Ref: phases/02-xxx.md
...
TodoWrite ็ถๆ่ฝฌๆข ๆถ่ชๅจๆดๆฐ compact ไฟๆค่ๅด:
Phase 1: in_progress ๐ก๏ธ โ completed โ
(compact ๅฏๅ็ผฉ Phase 1)
Phase 2: pending โ
โ in_progress ๐ก๏ธ (compact ไฟๆค Phase 2)
Layer 2: Sentinel Re-read (ๅ
ๅบๆขๅค)
ๅณไฝฟๆ Layer 1 ไฟๆค๏ผcompact ไปๅฏ่ฝๅจๆ็ซฏๅบๆฏ๏ผ่ถ
้ฟไธไธๆใๅค่ฝฎ agent ่ฐๅบฆ๏ผไธๅ็ผฉ active phaseใSentinel ็กฎไฟๆขๅค่ฝๅ๏ผ
Phase ๆไปถ้กถ้จๅตๅ
ฅ sentinel:
> **๐ COMPACT SENTINEL [Phase N: {phase-name}]**
> This phase contains {M} execution steps (Step N.1 โ N.{M}).
> If you can read this sentinel but cannot find the full Step protocol below, context has been compressed.
> Recovery: `Read("phases/0N-xxx.md")`
Sentinel ่ฎพ่ฎก็น็น๏ผ
- ็ปๆๅใ้็ฎ โ compact ไผๅฐๅ
ถไฝไธบๅ
ณ้ฎไฟกๆฏไฟ็ๅจๆ่ฆไธญ
- ๅ
ๅซ step ๆฐ้ โ ๆไพ่ชๆฃไพๆฎ๏ผ"ๅบ่ฏฅ็ๅฐ M ไธช Step๏ผไฝๅชๆๆ่ฆ"๏ผ
- ๅ
ๅซ re-read ่ทฏๅพ โ ๆ ้ๆฅ่กจๅณๅฏๆขๅค
Phase Reference Table (ๆดๅๅ้ไฟ้ฉ)
| Phase | Document | Purpose | Compact |
|-------|----------|---------|---------|
| 1 | phases/01-xxx.md | Planning | TodoWrite ้ฉฑๅจ |
| 2 | phases/02-xxx.md | Execution | TodoWrite ้ฉฑๅจ + ๐ sentinel |
**Compact Rules**:
1. **TodoWrite `in_progress`** โ ไฟ็ๅฎๆดๅ
ๅฎน๏ผ็ฆๆญขๅ็ผฉ
2. **TodoWrite `completed`** โ ๅฏๅ็ผฉไธบๆ่ฆ
3. **๐ sentinel fallback** โ ๅธฆๆญคๆ ่ฎฐ็ phase ๅ
ๅซ compact sentinel๏ผ่ฅ compact ๅไป
ๅญ sentinel ่ๆ ๅฎๆด Step ๅ่ฎฎ๏ผ**ๅฟ
้กป็ซๅณ `Read("phases/0N-xxx.md")` ๆขๅคๅๅ็ปง็ปญ**
Checkpoint (ๆง่กๆญฅ้ชคๅๅ้้ช่ฏ)
> **โ ๏ธ CHECKPOINT**: Before proceeding, verify:
> 1. This phase is TodoWrite `in_progress` (active phase protection)
> 2. Full protocol (Step N.X โ N.{M}) is in active memory, not just sentinel
> If only sentinel remains โ `Read("phases/0N-xxx.md")` now.
Handoff ๆณจ้
Read("phases/0N-xxx.md")
Execution Flow
Phase 1: Requirements Analysis
โโ Ref: phases/01-requirements-analysis.md
โโ Input source: commands, descriptions, user interaction
โโ Output: workflowConfig (phases, data flow, agents, conditions)
Phase 2: Orchestrator Design (SKILL.md)
โโ Ref: phases/02-orchestrator-design.md
โโ Input: workflowConfig
โโ Output: .claude/skills/{name}/SKILL.md
Phase 3: Phase Files Design
โโ Ref: phases/03-phase-design.md
โโ Input: workflowConfig + source content
โโ Output: .claude/skills/{name}/phases/0N-*.md
Phase 4: Validation & Integration
โโ Ref: phases/04-validation.md
โโ Output: Validated skill package
Phase Reference Documents (read on-demand):
Input Sources
This meta-skill accepts workflow definitions from multiple sources:
| Source | Description | Example |
|---|
| Existing commands | Convert .claude/commands/ orchestrator + sub-commands | plan.md + session/start.md + tools/*.md |
| Text description | User describes workflow in natural language | "Create a 3-phase code review workflow" |
| Requirements doc | Structured requirements file | requirements.md with phases/agents/outputs |
| Existing skill | Refactor/redesign an existing skill | Restructure a flat skill into phases |
Frontmatter Conversion Rules
When converting from command format to skill format:
| Command Field | Skill Field | Transformation |
|---|
name | name | Prefix with group: plan โ workflow-plan |
description | description | Append trigger phrase: Triggers on "xxx" |
argument-hint | (removed) | Arguments handled in Input Processing section |
examples | (removed) | Examples moved to inline documentation |
allowed-tools | allowed-tools | Expand wildcards: Skill(*) โ Skill, add commonly needed tools |
group | (removed) | Embedded in name prefix |
Orchestrator Content Mapping
What goes into SKILL.md vs what goes into phase files:
SKILL.md (Coordinator)
| Section | Content | Source |
|---|
| Frontmatter | name, description, allowed-tools | Command frontmatter (converted) |
| Architecture Overview | ASCII diagram of phase flow | Derived from execution structure |
| Key Design Principles | Coordination rules | Extracted from command coordinator role |
| Execution Flow | Phase sequence with Ref: markers + Phase Reference table | Command execution process |
| Core Rules | Orchestration constraints | Command core rules |
| Input Processing | Structured format conversion | Command input processing |
| Data Flow | Inter-phase data passing | Command data flow |
| TodoWrite Pattern | Attachment/collapse lifecycle | Command TodoWrite sections |
| Post-Phase Updates | Planning notes / state updates between phases | Command inter-phase update code |
| Error Handling | Failure recovery | Command error handling |
| Coordinator Checklist | Pre/post phase actions | Command coordinator checklist |
| Related Commands | Prerequisites and follow-ups | Command related commands |
Phase Files (Execution Detail)
| Content | Rule |
|---|
| Full agent prompts | Preserve verbatim from source command |
| Bash command blocks | Preserve verbatim |
| Code implementations | Preserve verbatim |
| Validation checklists | Preserve verbatim |
| Error handling details | Preserve verbatim |
| Input/Output spec | Add if not present in source |
| Phase header | Add # Phase N: {Name} |
| Objective section | Add ## Objective with bullet points |
| Next Phase link | Add ## Next Phase with link to next |
Critical Rule: Phase files must be content-faithful to their source. Do NOT summarize, abbreviate, or simplify. The phase file IS the execution instruction - every bash command, every agent prompt, every validation step must be preserved.
SKILL.md Template
---
name: {skill-name}
description: {description}. Triggers on "{trigger1}", "{trigger2}".
allowed-tools: {tools}
---
# {Title}
{One-paragraph description of what this skill does and what it produces.}
## Architecture Overview
{ASCII diagram showing phases and data flow}
## Key Design Principles
1. **{Principle}**: {Description}
...
## Interactive Preference Collection
Collect workflow preferences via AskUserQuestion before dispatching to phases:
{AskUserQuestion code with preference derivation โ workflowPreferences}
## Auto Mode Defaults
When `workflowPreferences.autoYes === true`: {auto-mode behavior}.
## Execution Flow
{Phase sequence with Ref: markers}
**Phase Reference Documents** (read on-demand when phase executes):
| Phase | Document | Purpose | Compact |
|-------|----------|---------|---------|
| 1 | [phases/01-xxx.md](phases/01-xxx.md) | ... | TodoWrite ้ฉฑๅจ |
| N | [phases/0N-xxx.md](phases/0N-xxx.md) | ... | TodoWrite ้ฉฑๅจ + ๐ sentinel |
...
**Compact Rules**:
1. **TodoWrite `in_progress`** โ ไฟ็ๅฎๆดๅ
ๅฎน๏ผ็ฆๆญขๅ็ผฉ
2. **TodoWrite `completed`** โ ๅฏๅ็ผฉไธบๆ่ฆ
3. **๐ sentinel fallback** โ ๅธฆๆญคๆ ่ฎฐ็ phase ๅ
ๅซ compact sentinel๏ผ่ฅ compact ๅไป
ๅญ sentinel ่ๆ ๅฎๆด Step ๅ่ฎฎ๏ผๅฟ
้กป็ซๅณ `Read()` ๆขๅค
## Core Rules
1. {Rule}
...
## Input Processing
{How user input is converted to structured format}
## Data Flow
{Inter-phase data passing diagram}
## TodoWrite Pattern
{Attachment/collapse lifecycle description with examples}
## Post-Phase Updates
{State updates between phases}
## Error Handling
{Failure recovery rules}
## Coordinator Checklist
{Pre/post phase action list}
## Related Commands
{Prerequisites and follow-ups}
Phase File Template
# Phase N: {Phase Name}
> **๐ COMPACT SENTINEL [Phase N: {phase-name}]**
> This phase contains {M} execution steps (Step N.1 โ N.{M}).
> If you can read this sentinel but cannot find the full Step protocol below, context has been compressed.
> Recovery: `Read("phases/0N-xxx.md")`
> _(Include for phases marked ๐ in SKILL.md Phase Reference table โ see Pattern 9)_
{One-sentence description of this phase's goal.}
## Objective
- {Goal 1}
- {Goal 2}
## Execution
### Step N.1: {Step Name}
{Full execution detail: commands, agent prompts, code}
### Step N.2: {Step Name}
> **โ ๏ธ CHECKPOINT**: Before proceeding, verify:
> 1. This phase is TodoWrite `in_progress` (active phase protection)
> 2. Full protocol (Step N.X โ N.{M}) is in active memory, not just sentinel
> If only sentinel remains โ `Read("phases/0N-xxx.md")` now.
> _(Add checkpoints before critical execution steps: agent dispatch, CLI launch, review โ see Pattern 9)_
{Full execution detail}
## Output
- **Variable**: `{variableName}` (e.g., `sessionId`)
- **File**: `{output file path}`
- **TodoWrite**: Mark Phase N completed, Phase N+1 in_progress
## Next Phase
Return to orchestrator, then auto-continue to [Phase N+1: xxx](0N+1-xxx.md).
Design Decision Framework
When designing a new workflow skill, answer these questions:
| Question | Impact | Example |
|---|
| How many phases? | Directory structure | 3-7 phases typical |
| Which phases are conditional? | Orchestrator logic | "Phase 3 only if conflict_risk >= medium" |
| What data flows between phases? | Data Flow section | sessionId, contextPath, configFlags |
| Which phases use agents? | Phase file complexity | Agent prompts need verbatim preservation |
| What's the TodoWrite granularity? | TodoWrite Pattern | Some phases have sub-tasks, others are atomic |
| Is there a planning notes pattern? | Post-Phase Updates | Accumulated state document across phases |
| What's the error recovery? | Error Handling | Retry once then report, vs rollback |
| Does it need preference collection? | Interactive Preference Collection | Collect via AskUserQuestion in SKILL.md, pass as workflowPreferences |
| Does phase N hand off to phase M? | Direct Phase Handoff (Pattern 7) | Read phase doc directly, not Skill() routing |
| Will later phases run after long context? | Compact Recovery (Pattern 9) | Add sentinel + checkpoints, mark ๐ in Phase Reference table |