Generate an Implementation Map from an Epic and its Stories with dependency matrix, phase computation, critical path analysis, ASCII phase diagrams, Mermaid dependency graphs, phase summary tables, and strategic observations.
Take the Epic and all Story files and compute the implementation plan: which stories can run in parallel, what the minimum implementation time is, where the bottlenecks are, and how to optimize team allocation. Produce ASCII phase diagrams, Mermaid dependency graphs, and strategic observations for sprint planning.
/x-epic-map <epic_file> — generate implementation map from epic and stories| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
<EPIC_FILE> | Path | Yes | — | Path to the Epic file (with story index and dependency declarations) |
Read the following files before starting:
Template (output structure):
.claude/templates/_TEMPLATE-IMPLEMENTATION-MAP.md — The exact structure to followRequired inputs:
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh start x-epic-map Phase-1-DAG-Build
Read every story's Section 1 (Dependencias) and the Epic's story index. Also read each
story's **Chave Jira:** field (if present). Build a complete matrix:
| Story | Titulo | Chave Jira | Blocked By | Blocks | Status |
|---|
The Chave Jira column is placed between Titulo and Blocked By. If a story does not
have a Jira key (field is — or <CHAVE-JIRA>), set the column value to —.
Validation checks:
If inconsistencies are found, fix them and note the corrections.
Add a > **Nota:** block for any implicit dependencies not declared in the stories but
functionally required (e.g., "story-0001-0009 provides configuration data that story-0001-0002 needs even
though story-0001-0002 does not explicitly declare it").
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh end x-epic-map Phase-1-DAG-Build ok
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh start x-epic-map Phase-2-Phase-Computation
Group stories into phases using the dependency DAG:
Within each phase, all stories can run in parallel.
Create the ASCII phase diagram using box-drawing characters. Follow the exact style from
the template — +=+, |, +=+ for phase boxes, +-+, |, +-+ for story boxes,
|-->, v for arrows.
Each story box shows: ID + short scope description (max ~20 chars). Each phase box shows: phase number + name + "(paralelo)" if multiple stories.
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh end x-epic-map Phase-2-Phase-Computation ok
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh start x-epic-map Phase-3-Critical-Path
The critical path is the longest chain of dependencies from any root to any leaf. Count phases, not individual stories.
Render as a simple ASCII diagram:
story-0001-0001 -+
+---> story-0001-0002 -> story-0001-0003 --+
story-0001-0009 -+ +---> story-0001-0011
story-0001-0002 -> story-0001-0010 --+
Fase 0 Fase 1 Fase 2 Fase 3
State: N phases in the critical path, M stories in the longest chain. Explain the impact: any delay in a critical path story directly delays the final delivery.
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh end x-epic-map Phase-3-Critical-Path ok
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh start x-epic-map Phase-4-Mermaid
Create a full graph TD with all stories and their dependency edges.
Naming convention: SXXXX_YYYY["story-XXXX-YYYY<br/>Short Title"]
If Jira keys are available, include them in node labels:
SXXXX_YYYY["story-XXXX-YYYY (PROJ-123)<br/>Short Title"]
Phase coloring (use these exact classDef values for consistency):
classDef fase0 fill:#1a1a2e,stroke:#e94560,color:#fff
classDef fase1 fill:#16213e,stroke:#0f3460,color:#fff
classDef fase2 fill:#533483,stroke:#e94560,color:#fff
classDef fase3 fill:#e94560,stroke:#fff,color:#fff
classDef faseQE fill:#0d7377,stroke:#14ffec,color:#fff
classDef faseTD fill:#2d3436,stroke:#fdcb6e,color:#fff
classDef faseCR fill:#6c5ce7,stroke:#a29bfe,color:#fff
Assign classDef by phase. Group edges by phase transition (comment with %% Fase N -> N+1).
Bash command: $CLAUDE_PROJECT_DIR/.claude/hooks/telemetry-phase.sh end x-epic-map Phase-4-Mermaid ok
| Fase | Historias | Camada | Paralelismo | Pre-requisito |
|---|---|---|---|---|
| 0 | story-0001-0001, story-0001-0009 | Infra + API | 2 paralelas | — |
Include total count: N historias em M fases.
Add notes about transversal phases (QE, Tech Debt) that can execute independently of business phases.
For each phase, create a subsection with:
Table: Story | Escopo Principal | Artefatos Chave
Entregas da Fase N (bullet list of concrete deliverables — what exists after this phase that did not exist before).
Be specific about artifacts: class names, table names, endpoints, configurations, test infrastructure.
These are the highest-value part of the map. Analyze:
Gargalo Principal: Which story blocks the most others? Investing extra time in it pays off. This is usually the Layer 1 core story.
Historias Folha (sem dependentes): Stories that do not block anything. They can absorb delays without impacting the critical path. Good candidates for junior developers or parallel streams.
Otimizacao de Tempo: Where is parallelism maximized? Which stories can start immediately? How should teams be allocated across phases?
Dependencias Cruzadas: Stories in later phases that depend on stories from different branches of the dependency tree. Identify convergence points.
Marco de Validacao Arquitetural: Which story should serve as the architectural checkpoint before expanding scope? What does it validate (patterns, pipeline, integration)?
If stories contain a Section 8 (Sub-tarefas / Tasks) with formal task IDs
(TASK-XXXX-YYYY-NNN), build a task-level dependency graph across all stories.
For each story, read the task list (Section 8) and their depends on declarations.
Identify cross-story task dependencies — tasks in one story that depend on tasks from
a different story. Build a table:
| Task | Depends On | Story Source | Story Target | Type |
|---|---|---|---|---|
| TASK-XXXX-YYYY-NNN | TASK-XXXX-ZZZZ-MMM | story-XXXX-YYYY | story-XXXX-ZZZZ | data/interface/schema/config |
Type indicates the nature of the dependency:
data — depends on data model or entity from another storyinterface — depends on a port/interface defined in another storyschema — depends on a DB schema or migration from another storyconfig — depends on configuration or infrastructure from another storyFor every cross-story task dependency, validate that the corresponding story-level dependency exists:
| Validation | Action |
|---|---|
| Cross-story task dep without story-level dep | ERROR: "TASK-X depends on TASK-Y but story-A does not depend on story-B" |
| Cycle detected in task graph | ERROR: "Cycle detected: TASK-A -> TASK-B -> TASK-C -> TASK-A" |
| Story-level dep without cross-story task dep | WARNING: "story-A depends on story-B but no cross-story task dependencies found" |
If an ERROR is detected, abort generation and report the inconsistency. If only WARNINGs exist, proceed but include them in the output.
Apply topological sort to the full task dependency graph (intra-story + cross-story):
Produce a merge order table:
| Order | Task ID | Story | Parallelizable With | Phase |
|---|---|---|---|---|
| 1 | TASK-XXXX-YYYY-NNN | story-XXXX-YYYY | TASK-XXXX-ZZZZ-MMM | 0 |
Create a graph LR with tasks as nodes, colored by story:
-->)-.->) with |cross-story| labelUse these story colors (cycle through for more stories):
style story-1 fill:#e8f4fd
style story-2 fill:#fde8e8
style story-3 fill:#e8fde8
style story-4 fill:#fdf8e8
style story-5 fill:#f0e8fd
style story-6 fill:#e8fdfa
Example:
graph LR
subgraph story-XXXX-0001["Story 0001 (Foundation)"]
style story-XXXX-0001 fill:#e8f4fd
T001["TASK-XXXX-0001-001<br/>Domain Model"]
T002["TASK-XXXX-0001-002<br/>Port Interface"]
T001 --> T002
end
subgraph story-XXXX-0002["Story 0002 (State)"]
style story-XXXX-0002 fill:#fde8e8
T003["TASK-XXXX-0002-001<br/>State Record"]
T004["TASK-XXXX-0002-002<br/>State Enum"]
T003 --> T004
end
T002 -.->|cross-story| T003
If stories do not contain formal task IDs, skip this step entirely and note: "Task-level dependency graph skipped — stories do not contain formal task definitions (TASK-XXXX-YYYY-NNN)."
Save as IMPLEMENTATION-MAP.md in the same directory as the Epic and Stories (inside plans/epic-XXXX/).
Report: total stories, phases, critical path length, maximum parallelism, main bottleneck.
If task-level dependencies were computed, also report: total tasks, task phases, cross-story dependencies count.
| Scenario | Action |
|---|---|
| Template file missing | Abort with message: "Template _TEMPLATE-IMPLEMENTATION-MAP.md not found" |
| Epic file missing or unparseable | Abort with message: "Epic file not found or invalid format" |
| Story files missing | Abort with message: "No story files found in epic directory" |
| Circular dependency detected | Warn with cycle details; break the cycle and proceed |
| Asymmetric dependency (A blocks B but B does not list A) | Fix automatically and note the correction |
| No root stories (all have blockers) | Warn: "All stories have blockers — review for missing root stories" |
| Cross-story task dep without story-level dep (RULE-012) | Abort with error listing the inconsistent dependencies |
| Cycle in task dependency graph | Abort with cycle path: "Cycle detected: TASK-A -> TASK-B -> TASK-A" |
| Stories without formal task IDs | Skip Section 8 with note; proceed with story-level map only |
| Skill | Relationship | Context |
|---|---|---|
| x-epic-create | reads | Reads the Epic file with story index and dependencies |
| x-story-create | reads | Reads generated story files for dependency details |
| x-epic-decompose | called-by | Orchestrator invokes x-epic-map in Phase D |
| x-epic-implement | reads | Epic implementation reads the map for execution order |
| Knowledge Pack | Usage |
|---|---|
| story-planning | Phase computation, dependency DAG, critical path analysis |