Create Flow Documentation
ASecurityGenerate black-box behavioral flow documentation from user journeys (Phase 2 — The "What"). USE THIS SKILL when user mentions: create flow, generate flow, flow specification, journey to flow, user flow documentation, create journey documentation, flow spec, document user journey, create flow from journey, flow diagram, sequence diagram flow, or any request to turn a user journey into detailed flow documentation. This skill creates behavioral flow specs with 2 Mermaid diagrams (Actor-to-System...
- 2 stars
- 0 votes
- 0 copies
- 2 views
- Added November 6, 2026
Security analysis
100/100Pro scans all 7 files and shows the line behind each finding
npx -y skills add faparicior/sdlc-skills --skill create-flow-documentation --agent claude-codeAre you the author of Create Flow Documentation?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/faparicior-create-flow-documentation)---
name: create-flow-documentation
description: >-
Generate black-box behavioral flow documentation from user journeys (Phase 2 — The "What"). USE THIS SKILL when user mentions:
create flow, generate flow, flow specification, journey to flow, user flow documentation,
create journey documentation, flow spec, document user journey, create flow from journey,
flow diagram, sequence diagram flow, or any request to turn a user journey into detailed flow documentation.
This skill creates behavioral flow specs with 2 Mermaid diagrams (Actor-to-System sequence, decision flowchart),
step-by-step walkthroughs, Gherkin acceptance criteria, edge cases, and Business Rules (BR-XXX) — keeping
flows agnostic of internal domain modeling (which belongs in Phase 3: /create-entity-lifecycle).
disable-model-invocation: true
---
# PROTOCOL: CREATE-FLOW-DOCUMENTATION (EXECUTION LEVEL 3)
<state_machine>
CURRENT_STEP -> REQUIRED_TOOL -> REQUIRED_OUTPUT -> MANDATORY_HALT
Step 1: Read Inputs -> read_file (journey/USM/PRD/code) -> Persona, goal, steps, bounded context, ubiquitous concepts -> Continue to Step 2
Step 2: Write Flow -> read_file(templates/flows.md) -> bounded-contexts/{ctx}/flows/journey-XX-[name].md (2 diagrams) -> Continue to Step 3
Step 3: Extract BRs -> read_file(templates/business-rules.md) -> BR-XXX files with `Traces up to` -> Flow & Journey -> Continue to Step 4
Step 4: Update Index -> edit_file (flows/README.md) -> Updated Master Flow Catalog & BR index -> 🛑 HALT TURN (Present flow & BRs)
</state_machine>
<execution_invariants>
1. WORKFLOW IMMUTABILITY: You may reason freely INSIDE each step to map user actions, observable system reactions, and business policies, but you are strictly forbidden from skipping steps, omitting either of the 2 required Mermaid diagrams, or improvising document structure (`workflow structure = immutable | step reasoning = flexible`).
2. TEMPLATE LOCK: Reconstructing template headers or tables from internal memory is strictly forbidden. You MUST call `read_file` on `templates/flows.md` and `templates/business-rules.md` before generating those files.
3. BLACK-BOX & GREENFIELD TRUTH INVARIANT (THE "WHAT", NOT THE "HOW"): Flow documentation in Phase 2 MUST remain agnostic of internal implementation and domain-model design. You are strictly forbidden from inventing or embedding Entity State Diagrams, concrete database tables/columns/indexes, DTO schemas, HTTP route contracts, Domain Exception class names, internal repository calls, or Domain Events.
- Entity lifecycles, state machines, Value Objects, Domain Services, and Domain Invariants (`INV-XXX`) belong in **Phase 3 (`/create-entity-lifecycle`)**.
- Technical contracts, HTTP error mappings, concurrency/TOCTOU guards, and layer scopes belong in **Phase 3b (`/create-features`)**.
- In Greenfield flows, set `Maturity Status: ⏳ Planned (Behavioral Spec)` and leave `Enforced Invariants` and `Linked Domain Models` as `⏳ Pending Phase 3 (Domain Modeling)` — Phase 3 will close those reciprocal links without rewriting the flow body.
- Only mark `✅ Built (Verified against code)` if verified by reading real code with `read_file`.
4. BUSINESS RULES ONLY (NO `INV-XXX` IN PHASE 2): Extract **Business Rules (`BR-XXX`)** in Step 3 (`../guidelines/business-rules-vs-invariants.md`). Do NOT create `INV-XXX` files in Phase 2 — an invariant belongs synchronously inside an Aggregate Root, which is modeled in Phase 3. Capture strict "must never happen" or concurrency constraints in plain business language under `Candidate Domain Constraints (Input for Phase 3)` so `/create-entity-lifecycle` formalizes them as `INV-XXX`.
5. NO PROACTIVE BUSINESS DECISIONS: If an open question or business ambiguity exists that was not in the source journey/USM/PRD, do not silently invent the policy. Record it in an Open Questions note or ask the user.
6. BIDIRECTIONAL TRACEABILITY: Every governing `BR-XXX` must be extracted to its owning bounded context with `Traces up to` linking back to this flow and journey, and this flow's `Enforced Business Rules` linking to the `BR-XXX` (`../guidelines/traceability.md`).
7. ESCAPE HATCH: If the situation does not fit the contract, do not silently improvise and do not force-fit: declare the deviation in one line and ask.
</execution_invariants>
<output_contract>
- FLOW DOCUMENT:
- TARGET_PATH: `docs/product/bounded-contexts/{bounded-context-name}/flows/journey-[XX]-[feature-name].md`
- SOURCE_TEMPLATE: `templates/flows.md` (MUST call `read_file` before writing)
- SCHEMA_INVARIANCE: Preserve all sections (`Overview`, `Governing Business Rules (PM Summary)`, `Visual Flow & Sequence (Actor ↔ System)`, `Decision Flow (Flowchart)`, `Step-by-Step Walkthrough (Happy Path)`, `Acceptance Criteria & Scenarios`, `Edge Cases, Errors & Boundary Conditions`, `Linked Documentation`) verbatim.
- BUSINESS RULES:
- TARGET_PATHS: `docs/product/bounded-contexts/{owning-bounded-context}/business-rules/BR-[XXX]-[rule-name].md`
- SOURCE_TEMPLATE: `templates/business-rules.md` (MUST call `read_file` before writing)
- ESCAPE_HATCH: Never silently omit or invent template sections or either of the 2 required Mermaid diagrams. If a subsection genuinely does not apply (e.g., `External & Operational Failures` for a purely local flow with no external services), preserve the heading and write `"N/A — [1-line rationale]"`.
</output_contract>
> **Paths**: the locations shown are the pack defaults; if `.sdlc/config.json` exists (written by `/setup-sdlc`), honour its `docsRoot` / `productDocsDir` / `adrDir` overrides.
---
## 🔄 Position in the SDLC Workflow
```mermaid
flowchart LR
P1["Phase 1: Discovery"] --> P2["Phase 2: Behavioral Flow Spec<br/>(/create-flow-documentation)<br/>The 'What' + BR-XXX"]
P2 --> P3["Phase 3: Domain Model<br/>(/create-entity-lifecycle)<br/>The 'How' + INV-XXX"]
P3 --> P3b["Phase 3b: Feature Slicing<br/>(/create-features)<br/>Contracts & Slices"]
P3b --> P4["Phase 4: Implementation<br/>(/implement-flow)"]
```
---
## 📋 Input Context
This skill accepts inputs from **Lean Inception**, **User Story Mapping**, **PRD**, or a **Direct Request**:
### Source A: Lean Inception
- **Journey Reference:** `docs/inception/5-user-journeys/*.md` (document and step number)
- **Persona:** `docs/inception/3-personas/` ([Persona Name] / [Role])
- **Goal:** [What the persona wants to accomplish]
- **Feature to Document:** `docs/inception/7-features-and-sequencing.md` (Specific feature & wave)
- **Journey Steps:** [Copy the relevant journey table from source document]
### Source B: User Story Mapping
- **Backbone Reference:** `docs/user-story-mapping/2-map-the-big-picture.md` (User Activity & Steps)
- **Story Cards:** `docs/user-story-mapping/3-explore-to-fill-the-body.md` (Title, Narrative, Acceptance Criteria)
- **Release Slice:** `docs/user-story-mapping/4-slice-out-a-release-strategy.md` (Wave 1 MVP vs Wave 2)
- **Persona:** Extracted from Step 1 (`docs/user-story-mapping/1-frame-the-problem.md`) or Story Narrative
### Source C: PRD or Direct Request (Greenfield / Brownfield)
- **Reference:** `docs/product/prd/*.md` or the user's request itself — derive persona, goal, and steps from the description (and real code if brownfield). Do not invent upstream docs that do not exist.
### Common Metadata
- **Bounded Context:** [Identify the owning bounded context for this journey]
- **Domain Concepts (Ubiquitous Language):** [High-level business nouns mentioned by the user/journey — conceptual only, not internal classes]
---
## 🎨 Mermaid Diagram Requirements
The flow document MUST include **2 complete Mermaid diagrams** (black-box behavioral view):
### 1. Sequence Diagram (`Actor ↔ System`, with Error Paths)
- Shows the complete **observable** interaction between the User/Actor, the System (Bounded Context as a black box), and any relevant External Services.
- **Do NOT** include internal domain classes, repository calls, database tables, or outbox workers — those belong in Phase 3 / Phase 3b.
- **Must include colored `rect` blocks for error scenarios** (not just happy path):
- Happy path: `rgb(232, 245, 233)` (green)
- Error paths: `rgb(255, 235, 238)` (red)
- Steps must align 1:1 with the Step-by-Step Walkthrough table.
### 2. Decision Flow (Flowchart)
- Shows business decision points and branching logic.
- Color-code outcomes: success (green `#c8e6c9`), error/failure (red `#ffcdd2`), decision/warning (yellow `#fff9c4`).
- Must cover all major decision points and alternative paths from the flow.
> **Why no State Diagram here?** Entity state machines have a single source of truth in Phase 3 (`/create-entity-lifecycle`). Omitting the state diagram from Phase 2 prevents inventing draft states in the flow and having to rewrite the flow after domain modeling.
---
## 🔄 Mermaid Diagram & Walkthrough Consistency
The Mermaid sequence diagram and Step-by-Step Walkthrough table MUST be aligned:
1. **Step Numbering:** Each step in the walkthrough table corresponds to a logical action in the Mermaid diagram.
2. **Sequence Alignment:** The order of steps in the table matches the sequence shown in the Mermaid diagram.
3. **Completeness:** Every major action in the Mermaid diagram has a corresponding step in the walkthrough.
4. **Detail Level:** The walkthrough provides additional detail for each interaction (User Action, Observable System Reaction, Business / Conceptual Impact).
5. **Numbering Strategy:** Use sequential numbering (1, 2, 3, ...).
---
## 📐 Business Rules Extraction (`BR-XXX` Only)
During flow creation, identify all **Business Rules** (policies, workflows, limits, permissions, user-visible validations) that govern this user flow:
1. Use the template at `templates/business-rules.md`.
2. **Classify each rule by bounded context** — a rule belongs to the context that owns and enforces it, not necessarily the context where it has visible effects.
3. Extract each identified business rule to:
- `docs/product/bounded-contexts/{owning-bounded-context}/business-rules/BR-[XXX]-[rule-name].md`
4. **Prominent Placement for PMs:** Place the extracted rules in **Section 2 (`## 📜 Governing Business Rules (PM Summary)`)** right after Overview, AND in `## 🔗 Linked Documentation → ### Enforced Business Rules`.
5. **Complete `Traceability` on every `BR-XXX` you create** (`templates/business-rules.md` §5, convention in `../guidelines/traceability.md`):
- `Traces up to`: link back to the Journey and this Flow document (required for reciprocity).
- `Enforced by` / `Verified by`: in Greenfield, add a single `⏳ Planned — To be modeled in Phase 3 (/create-entity-lifecycle)` row (do not invent class or file paths). In Brownfield, cite verified files/guards you actually read.
6. **What about Invariants (`INV-XXX`)?** Do NOT create `INV-XXX` files in Phase 2 (`../guidelines/business-rules-vs-invariants.md`: invariants are strict aggregate constraints). Instead, capture any "must never happen" or concurrency constraints in plain business language under `⚠️ Edge Cases → 4. Candidate Domain Constraints (Input for Phase 3)`. Phase 3 (`/create-entity-lifecycle`) will formalize them as `INV-XXX` and add the reciprocal link to this flow's `Linked Documentation → Enforced Invariants`.
---
## 📑 Flow Index (`docs/product/flows/README.md`)
After creating or updating a flow, update the master flow catalog and index at:
```
docs/product/flows/README.md
```
**Rules for updating the index:**
- Add the new flow to the **Master Flow Catalog** table (Journey, Context, BR links, Status; mark Entities / INVs as `⏳ Pending Phase 3` if Greenfield).
- Add or update the **Master Index: Business Rules** table.
- Add a Flow Details summary section for the journey.
- Update the Last Updated date and Total Flows count.
---
## 📁 Output Path
Write the result in:
```
docs/product/bounded-contexts/{bounded-context-name}/flows/journey-[XX]-[feature-name].md
```
Where:
- `{bounded-context-name}` is the kebab-case name of the bounded context (e.g., `event`, `submission`, `review`, `scheduling`)
- `[XX]` is the journey number (e.g., `01`, `02`)
- `[feature-name]` is the kebab-case feature name (e.g., `setup-event`, `submit-proposal`)
---
## 📖 Documentation Structure
This skill is **100% language-, framework-, and domain-implementation-agnostic**.
The generated flow document is a **single, comprehensive behavioral document** containing:
1. **Overview** — User story format (`As a... I want... So that...`), Bounded Context, Domain Concepts (ubiquitous language)
2. **Governing Business Rules (PM Summary)** — Table of `BR-XXX` policies
3. **Visual Flow & Sequence (Actor ↔ System)** — Observable sequence diagram with happy + error paths
4. **Decision Flow (Flowchart)** — Business decision points and branching logic
5. **Step-by-Step Walkthrough (Happy Path)** — Aligned 1:1 with the sequence diagram
6. **Acceptance Criteria & Scenarios** — Gherkin format scenarios (observable outcomes)
7. **Edge Cases, Errors & Boundary Conditions** — Business failures, validation boundaries, external failures, and Candidate Domain Constraints for Phase 3
8. **Linked Documentation** — `Enforced Business Rules` (`BR-XXX`), `Enforced Invariants` (closed in Phase 3), and `Linked Domain Models & ADRs` (closed in Phase 3)
**Do NOT create separate flow map files** — both diagrams must be embedded in the main flow specification document.
---
## ⏭️ Next Step in the SDLC Workflow
Once the behavioral flow specification (`journey-XX-[name].md`) and its Business Rules (`BR-XXX`) are approved:
* **Invoke `/create-entity-lifecycle` (Phase 3 — Domain Modeling)** to design the Entities/Aggregates, State Machines, Value Objects, Domain Services, and Domain Invariants (`INV-XXX`) that realize this flow, and close the reciprocal links in `Linked Documentation`.
* After Phase 3 is approved, invoke **`/create-features` (Phase 3b)** to slice the flow + domain model into technical vertical slices ready for `/implement-flow` (Phase 4).
---
## 📚 Bundled Resources
### Templates
| Template | Purpose |
|----------|---------|
| `templates/flows.md` | Black-box behavioral flow document template (2 Mermaid diagrams) |
| `templates/business-rules.md` | Business rule documentation template (`BR-XXX`) |
| `templates/bounded-contexts-readme.md` | Flow index template — seed for `docs/product/bounded-contexts/README.md` |
### Guidelines
| Guideline | Purpose |
|-----------|---------|
| `../guidelines/flow-documentation-structure.md` | Flow documentation standards and best practices |
| `../guidelines/business-rules-vs-invariants.md` | When to use BR (Phase 2) vs INV (Phase 3) |
| `../guidelines/traceability.md` | Linking rules to flows, entities, code and tests — both ends of every edge |
---
<self_validation_gate>
Before ending your turn, verify every item below with concrete evidence (not just a checkmark). If any item cannot be cited with real evidence from this turn, DO NOT produce your final response — return to the failed step and fix the violation first:
- [ ] **Template Read Evidence:** Exact `templates/flows.md` and `templates/business-rules.md` paths passed to `read_file`: `<paths>`
- [ ] **Black-Box & Greenfield Evidence:** Confirm the flow contains NO Entity State Diagram, NO DB tables/schemas/endpoints, NO Domain Exception class names, and NO newly created `INV-XXX` files. State whether `Greenfield (⏳ Planned)` or `Brownfield (✅ Built)`: `<status & evidence>`
- [ ] **Flow Output & 2-Diagram Evidence:** Exact flow doc path written and step counts matched across Sequence Diagram (`Actor ↔ System`), Flowchart, and Step-by-Step Walkthrough table: `<path, N steps>`
- [ ] **BR Extraction & Reciprocity Evidence:** List all `BR-XXX` files created/updated in their owning bounded context with `Traces up to` pointing back to this flow AND listed in `Enforced Business Rules`: `<BR paths>`
- [ ] **Master Index Evidence:** Exact index file (`docs/product/flows/README.md` or equivalent) updated via `edit_file`: `<path>`
</self_validation_gate>
---
**Last Updated:** 2026-11-28
**Version:** 3.0 (Black-Box Behavioral Spec — Decoupled from Phase 3 Domain Modeling)
Files in this skill
- README.md
- SKILL.md
- evals/evals.json
- templates/bounded-contexts-readme.md
- templates/business-rules.md
- templates/flows.md
- templates/invariants.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.