Writing Flows
Document how one scenario behaves at runtime as a Flow file under flows/. A Flow makes the order of operations and the branching visible at a glance — the thing specs, tasks, and ADRs can't show.
Hard Rules
- Template-driven. Every Flow follows templates/flow-template.md exactly — four sections, no freestyle.
- One Flow = one scenario. A request spanning multiple scenarios becomes multiple Flow files.
- Code is the source of truth. When code exists, read it before drawing. Never draw from assumption what can be verified by exploration.
- Never auto-modify existing Flows. Propose the diff, wait for confirmation.
- No derived index files. Never create
flows/README.mdorflows/INDEX.md— the directory listing is the index.
Directory Rules
- Flow 루트를 먼저 정한다. 사용자 전역 규칙(work-routing 류)이 이 repo 의 2급 문서를 외부 doc-root 로 보내면 Flow 루트는
<doc-root>/<repo-name>/flows/이고, 아니면 프로젝트 루트의flows/다. 아래 규칙(topic 디렉토리,NN-접두어, 인덱스 금지)은 정해진 루트를 기준으로 적용한다. - Flows live in
flows/<topic>/NN-name.mdunder that root — a closed-root dir; the directory-structure SSOT ischeck-doc-structure/golden_manifest.py(shared withwriting-specs,writing-tasks,scaffold-new-app,reconcile-docs). Topic = coherent feature/domain (auth,checkout), the same axis as ADR-0001 — never phase numbers. - Match the topic against existing
flows/*/directories before creating a new one. NNis a 2-digit index within the topic, starting01. Filenames are lowercase-with-hyphens.
Phase 1 — Search
Glob flows/**/*.mdand check whether a Flow for this scenario already exists.- Exact scenario match → 부모 세션에
SendMessage로 update / create new / cancel 을 묻고, 답이 없으면 update (기존 Flow 를 보존하며 갱신) 로 진행하고 보고에 적는다. 이 스킬은 fork 라 사용자에게 직접 물을 수 없다. - Existing Flow whose
## Sourcefiles no longer exist (verify withGlob) → report as outdated; propose an update, never apply silently.
- Exact scenario match → 부모 세션에
- Locate the scenario in code: entry point (route/handler/command), the calls it makes, and where behavior branches. Follow the chain far enough to know every actor and every branch — guessing here produces a wrong diagram.
- No relevant code (design-stage scenario)? Fall back to specs (
Glob specs/**/*.md) or conversation context, and say so in the report.
Phase 2 — Write
Read templates/flow-template.md and fill it strictly:
- Context — 2-3 sentences: the scenario, its trigger, the actors involved.
- Diagram — exactly one Mermaid diagram.
sequenceDiagramwhen the story is interaction between components/services;flowchart TDwhen it is user-facing branching between screens/states. Never both, never other types. - Steps & Branches — numbered happy path; attach branches and edge cases to the step where they diverge (
— 실패 시 → ...). - Source — the files the Flow was derived from, file paths only (no line numbers — they go stale). For design-stage Flows, list the spec or write
(design — no code yet).
Diagram and Steps must agree with each other and with the code. On update, preserve sections the user didn't ask to change.
Phase 3 — Report
End with a short report: Action (Created/Updated), File (relative path), Scenario (H1), Basis (code files explored, or spec/conversation), and any outdated Flows found in Phase 1. One actionable next step (e.g. a neighboring scenario worth documenting).
Anti-patterns
WRONG: drawing the diagram from the user's description while the code says otherwise. RIGHT: explore the code first; if it contradicts the user's description, surface the difference and ask which one the Flow should capture.
WRONG: one giant Flow covering signup, login, and password reset.
RIGHT: three Flow files in flows/auth/, each one scenario.
Boundaries
This skill only writes Flow files. Requirements belong to writing-specs, work breakdown to writing-tasks. It never modifies source code.
호출자에게
이 스킬은 fork 로 백그라운드에서 돈다. 완료 알림을 받고 파일을 확인한 뒤 다음 단계로 넘어간다. 기다리지 않으면 Phase 3 리포트가 세션 기록에서 사라진다(2026-08-18 실측: Flow 2개가 완성됐는데 부모는 6시간 뒤까지 몰랐다).