2.3 KiB
2.3 KiB
Workflow Structure
The standard anatomy of a workflows/*.md document, and what makes one
compliant.
Required sections
# Workflow: <Name>
## When to use
## Inputs required
## Output
## Subtasks (or "Phases")
- When to use - trigger conditions, so a router (human or model) can match a request to this workflow without reading the whole file.
- Inputs required - named parameters the caller must supply.
- Output - what gets written and where (file path, or "returned to caller").
- Subtasks/Phases - the ordered steps. Each one states:
- Who does it - main thread or subagent, with model tier (Haiku/Sonnet/Opus) if a subagent
- Must read - any file the step needs, if applicable
- Do - the concrete instructions
Ownership clarity
Every subtask/phase must unambiguously assign ownership:
- Main-thread tasks require user interaction or judgment about scope
- Subagent tasks are dispatched with an explicit model tier
- A main-thread step must never silently perform subagent-tier work (file writes, content drafting) — delegate it
Completeness checklist
- Purpose and trigger conditions are clear
- Inputs are well-defined (names, not just prose)
- Output format and location specified
- Every subtask/phase has necessary context (what to read)
- Verification step included if the workflow modifies files
- No missing steps in the flow (a reader could execute this cold)
Quality bar
- Logical step ordering — later steps don't need something an earlier step hasn't produced yet
- Subagent model assignments match the work (mechanical → Haiku, drafting/ analysis → Sonnet, judgment/synthesis → Opus)
- File artifacts (task docs, scratch files) are passed between phases by path, not assumed shared context
- No redundant steps
Minimal skeleton
# Workflow: <name>
## When to use
- <trigger 1>
- <trigger 2>
## Inputs required
- **<input_name>** - <description>
## Output
- <what gets written, and where>
---
## Subtasks
### 1. <step name>
Subagent: <main | haiku | sonnet | opus>.
Read: <files this step needs, if any>
**Do:**
- <instruction>
Creating a new workflow
Follow the cc-architect workflow:
→ ${CLAUDE_PLUGIN_ROOT}/workflows/create-workflow.md