Writing: read docs/skills/shared/writing-rule.md before you write a durable artifact.
/feature-diagram — Per-feature Mermaid Sub-graph
Reads the Feature Inventory at projects/<name>/feature-inventory.md (produced by /extract-features) and writes a per-feature Mermaid flowchart LR showing the HTTP routes, data models, async jobs, and UI screens that participate in one feature. Output: projects/<name>/features/<slug>.md (one file per feature).
This skill closes the gap left by the rest of the architecture-doc family:
| Skill | Slice |
|-------|-------|
| /c4 | Whole-system topology (L1 + L2) |
| /dfd | Whole-system data flows + trust boundaries |
| /process | One business process (BPMN control flow) |
| /journey | One feature, product-facing user flow (HTML modal-per-page) |
| /feature-diagram (this skill) | One feature, architectural slice (Mermaid flowchart) |
See AgDR-0035-per-feature-diagrams.md for the design rationale.
Path resolution
Read the per-project docs dir via portfolio_projects_dir from .claude/hooks/_lib-portfolio-paths.sh. Source the helper at the top of any bash block that touches that path:
source "$(git rev-parse --show-toplevel)/.claude/hooks/_lib-read-config.sh"
source "$(git rev-parse --show-toplevel)/.claude/hooks/_lib-portfolio-paths.sh"
projects_dir=$(portfolio_projects_dir)
Defaults match today's single-fork layout (./projects). Adopters in split-portfolio mode override the portfolio.{registry, projects_dir} keys in .claude/project-config.json — the helper resolves whichever mode they're in. See docs/multi-project.md.
Write targets (see me2resh/apexyard#373 + #443): paths documented as projects/<name>/X in this skill are canonical adopter-facing forms — implement them in bash as "${projects_dir}/<name>/X". Never construct from "${PWD}/projects/...", "$(git rev-parse --show-toplevel)/projects/...", or a literal ./projects/... — those break in split-portfolio v2 mode where projects_dir resolves to a sibling repo.
REQUIRED per-block preamble (see #443): Claude executes each ``bash` block as a separate shell invocation. The projects_dir assignment from the Path resolution section above does NOT carry into later blocks. Every bash block that writes to a projects/<name>/X` path MUST start with this three-line preamble so it's self-contained:
source "$(git rev-parse --show-toplevel)/.claude/hooks/_lib-read-config.sh"
source "$(git rev-parse --show-toplevel)/.claude/hooks/_lib-portfolio-paths.sh"
projects_dir=$(portfolio_projects_dir)
# ... now write to "${projects_dir}/<name>/X"
The Path resolution section's example sources the helper once for documentation purposes; it does not absolve later blocks from sourcing it themselves. Treat each ``bash`` fence as a fresh process.
Usage
/feature-diagram create-order # current project (cwd inside workspace/<name>/ or single-project fork)
/feature-diagram create-order sample-app # registered project
/feature-diagram reset-password --force # overwrite existing diagram
If <project-name> is omitted and cwd is the ops-fork root with multiple registered projects, the skill asks which project's inventory to read.
Output location
projects/<name>/features/<slug>.md ← the per-feature diagram (one file per feature)
projects/<name>/feature-inventory.md ← updated to link the Feature column to the new file
The features/ directory is created if missing.
Activated role
When /feature-diagram runs, activate the Tech Lead role — they own architectural slicing and the "which surfaces participate in this feature" view. See