$npx -y skills add tranhieutt/software_development_department --skill map-workflowGenerates a structured multi-agent workflow graph from a pattern and agent list. Supports Sequential, Parallel, Hierarchical, and Iterative patterns. Used by @producer to plan feature delivery before any implementation begins.
| 1 | # Map Workflow |
| 2 | |
| 3 | Generate a workflow graph for a multi-agent task using one of four patterns. |
| 4 | Present the graph to the user for approval before any agent is dispatched. |
| 5 | |
| 6 | ## Steps |
| 7 | |
| 8 | ### 1. Parse arguments |
| 9 | |
| 10 | Extract from `$ARGUMENTS`: |
| 11 | |
| 12 | | Flag | Required | Default | Description | |
| 13 | | :--- | :--- | :--- | :--- | |
| 14 | | `--pattern` | yes | — | `Sequential`, `Parallel`, `Hierarchical`, or `Iterative` | |
| 15 | | `--agents` | yes | — | Comma-separated agent names in execution order | |
| 16 | | `--task` | yes | — | One-sentence description of what this workflow delivers | |
| 17 | | `--max-iter` | no | `3` | Max loop iterations (Iterative pattern only) | |
| 18 | | `--save` | no | none | If set, write the graph to `.tasks/[filename].workflow.md` | |
| 19 | |
| 20 | If `--pattern` or `--agents` or `--task` is missing, print usage and stop: |
| 21 | |
| 22 | ```text |
| 23 | Usage: /map-workflow --pattern <Sequential|Parallel|Hierarchical|Iterative> \ |
| 24 | --agents "<agent1,agent2,...>" \ |
| 25 | --task "<what this workflow delivers>" \ |
| 26 | [--max-iter <N>] [--save <filename>] |
| 27 | |
| 28 | Patterns: |
| 29 | Sequential — linear pipeline, one agent after another |
| 30 | Parallel — fan-out to multiple agents simultaneously, then merge |
| 31 | Hierarchical — supervisor delegates to specialists |
| 32 | Iterative — test-driven loop until quality gate passes |
| 33 | |
| 34 | Reference: docs/templates/workflow-graph.md |
| 35 | ``` |
| 36 | |
| 37 | ### 2. Validate agents |
| 38 | |
| 39 | For each agent name in `--agents`, verify it exists in `.claude/agents/`. |
| 40 | If an agent is not found, warn but continue: |
| 41 | |
| 42 | ```text |
| 43 | ⚠️ Agent "foo-developer" not found in .claude/agents/ — check spelling. |
| 44 | Proceeding with remaining agents. |
| 45 | ``` |
| 46 | |
| 47 | ### 3. Generate the workflow graph |
| 48 | |
| 49 | Using the pattern and agents, fill in the workflow schema from |
| 50 | `docs/templates/workflow-graph.md`. Apply these rules per pattern: |
| 51 | |
| 52 | **Sequential:** Each agent becomes one node. `on_pass` chains to the next agent. |
| 53 | `on_fail: stop` for all nodes. |
| 54 | |
| 55 | **Parallel:** First agent in list becomes the `orchestrate` node. Last agent |
| 56 | becomes the `merge` node. All middle agents run in parallel from orchestrate |
| 57 | to merge. A `qa-engineer` node is appended after merge if not already in the list. |
| 58 | |
| 59 | **Hierarchical:** First agent becomes the `plan` (supervisor) node. |
| 60 | Remaining agents are parallel specialist nodes. First agent is also the final |
| 61 | `review` node. All specialists must complete before review. |
| 62 | |
| 63 | **Iterative:** Exactly 2 agents required — first is the implementer, |
| 64 | second is the tester. Loop: implementer → tester → [fail→implementer | pass→done]. |
| 65 | Cap at `--max-iter` iterations. |
| 66 | |
| 67 | ### 4. Display the graph |
| 68 | |
| 69 | Show the filled YAML schema and an ASCII flow diagram: |
| 70 | |
| 71 | ```text |
| 72 | 🗺️ Workflow Graph — [pattern] · [task] |
| 73 | ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 74 | |
| 75 | [YAML schema — filled in] |
| 76 | |
| 77 | Flow: |
| 78 | [ASCII diagram derived from nodes] |
| 79 | |
| 80 | Agents dispatched: [N] |
| 81 | Estimated turns: [N × 5 turns per agent, rough estimate] |
| 82 | Max iterations: [N — Iterative only, else omit] |
| 83 | |
| 84 | Verification criteria per node: |
| 85 | [node-id] (@agent): [on_pass condition description] |
| 86 | ``` |
| 87 | |
| 88 | ### 5. Ask for approval |
| 89 | |
| 90 | ```text |
| 91 | ✋ Does this workflow look correct? |
| 92 | Reply "yes" to confirm and begin dispatching agents. |
| 93 | Reply "edit [node-id] [field] [value]" to adjust a node. |
| 94 | Reply "no" to cancel. |
| 95 | ``` |
| 96 | |
| 97 | Do NOT dispatch any agent until the user confirms. |
| 98 | |
| 99 | ### 6. Save (if --save provided) |
| 100 | |
| 101 | After approval, if `--save <filename>` was passed, write the graph to |
| 102 | `.tasks/<filename>.workflow.md` and print: |
| 103 | |
| 104 | ```text |
| 105 | ✅ Workflow saved → .tasks/<filename>.workflow.md |
| 106 | ``` |
| 107 | |
| 108 | ### 7. Dispatch (after approval) |
| 109 | |
| 110 | After the user confirms, hand off to `@producer` with the instruction: |
| 111 | |
| 112 | > "Execute workflow `[id]` — dispatch agents in the order defined by the graph. |
| 113 | > For each node: run the agent, check the outcome, follow on_pass/on_fail edges. |
| 114 | > Write a ledger entry to `production/traces/decision_ledger.jsonl` at each |
| 115 | > node completion. Save a checkpoint via `/save-state [task_id]` if any node fails." |
| 116 | |
| 117 | --- |
| 118 | |
| 119 | ## Quick Examples |
| 120 | |
| 121 | ```bash |
| 122 | # Simple 3-agent pipeline |
| 123 | /map-workflow --pattern Sequential \ |
| 124 | --agents "technical-director,backend-developer,qa-engineer" \ |
| 125 | --task "Build JWT auth endpoint" |
| 126 | |
| 127 | # Parallel frontend + backend |
| 128 | /map-workflow --pattern Parallel \ |
| 129 | --agents "backend-developer,frontend-developer" \ |
| 130 | --task "Login feature — API and UI" |
| 131 | |
| 132 | # TDD loop, max 3 retries |
| 133 | /map-workflow --pattern Iterative \ |
| 134 | --agents "backend-developer,qa-engineer" \ |
| 135 | --task "Paym |