/flow:design feature-description-or-issue-numberfrom flow
Designs or reviews system architecture by analyzing existing patterns, evaluating coupling, and producing structured design decisions with C4 models.
Ships in flow. Installing the plugin adds it to Claude Code.
Architecture discussion and design validation. Follows Explore > Plan > Review > Decide loop.
This command operates with these domain skills loaded:
architecture-patterns — C4 design, coupling analysis, decision frameworkcapability-discovery — detect available agents and tech stackspecification-capture — read existing specification from journal or capture missing elements (Phase 1)# Inline the Required Skills above so their rules are in context before the
# first phase runs (commands cannot preload skills from frontmatter). Ambient
# skills load whole; dispatched skills (context: fork / agent:) load their
# `## Contract` section and run in full when this command invokes
# Skill(<name>). Output per `references/command-output-format.md`.
"$(__fr="${CLAUDE_PLUGIN_ROOT:-}";[ -x "$__fr/bin/cascade-resolve.sh" ]||__fr=$({ printf '%s\n' plugins/flow;ls -d "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/plugins/cache/synapti-marketplace/flow/*/ 2>/dev/null|sort -Vr;printf '%s\n' "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/plugins/marketplaces/synapti-marketplace/plugins/flow"; }|while read -r __p;do [ -x "${__p%/}/bin/cascade-resolve.sh" ]&&{ printf '%s\n' "${__p%/}";break;};done);printf '%s\n' "$__fr")/bin/flow-load-skills.sh" architecture-patterns capability-discovery specification-capture
true
references/escalation-format.md — canonical six-field structure for any Proactive-Autonomy escalation surfaced during design. Store each escalation before asking it: bin/flow-question.sh add --journal --class <the place's tag> ... prints QUESTION_ID; record the answer after with bin/flow-question.sh answer <id> --choice <n> --journal (§ Every escalation is stored)Map existing architecture before proposing anything. Execute in parallel:
# Take the first whitespace-separated token; accept only if it is *all*
# digits. Inputs like "foo42 strategy" (greedy digit-extraction would pluck
# `42` and fire `gh issue view 42` on an unrelated issue) are rejected.
# Supports usage like /flow:design 42 (decoupled auth service architecture).
#
# Output: `###`-headed sections + KEY=value per
# `references/command-output-format.md`.
_RAW="$ARGUMENTS" # Claude Code substitutes the bare arg token, not bash parameter-expansion
ARG1="${_RAW%% *}"
case "$ARG1" in
''|*[!0-9]*) ISSUE_NUM="" ;;
*) ISSUE_NUM="$ARG1" ;;
esac
printf '%s\n' "### Project Structure"
# Prefix each entry with ENTRY= per command-output-format.md (raw `ls -la`
# rows have no KEY= label). Each row contains whitespace (permission bits,
# owner, size, date, name), so values are double-quoted per rule 2.
# Try the conventional source roots first; fall back to repo root if none
# exist. Use `printf` so an empty ls produces a detectable empty var
# rather than a silent heading.
STRUCTURE=$(ls -la src/ app/ lib/ packages/ 2>/dev/null || ls -la 2>/dev/null)
if [ -z "$STRUCTURE" ]; then
printf '%s\n' "STATE=empty"
else
# Quote each row so values containing whitespace remain a single scalar
# under one KEY=. Embedded double-quotes (rare in ls output) are escaped
# with sed before wrapping.
printf '%s\n' "$STRUCTURE" | sed 's/"/\\"/g; s/^/ENTRY="/; s/$/"/'
fi
printf '%s\n' ""
printf '%s\n' "### Issue Reference"
# Quote parenthesized fallback per command-output-format.md rule 2.
printf '%s\n' "ISSUE_NUM=${ISSUE_NUM:-\"(none — exploratory design)\"}"
printf '%s\n' ""
printf '%s\n' "### Issue Context"
if [ -n "$ISSUE_NUM" ]; then
gh issue view "$ISSUE_NUM" --json title,body,labels --jq '"TITLE=\"\(.title)\"\nLABELS=\([.labels[].name] | join(","))\nBODY_LENGTH=\(.body | length)"' 2>/dev/null
printf '%s\n' ""
printf '%s\n' "#### Issue body"
gh issue view "$ISSUE_NUM" --json body --jq '.body' 2>/dev/null
else
printf '%s\n' "STATE=empty"
fi
printf '%s\n' ""
printf '%s\n' "### Branch Context"
printf '%s\n' "BRANCH=$(git branch --show-current 2>/dev/null)"
printf '%s\n' ""
printf '%s\n' "#### Recent commits"
RECENT_COMMITS=$(git log --oneline -5 2>/dev/null)
if [ -z "$RECENT_COMMITS" ]; then
printf '%s\n' "STATE=empty"
else
printf '%s\n' "$RECENT_COMMITS" | sed 's/^/COMMIT=/'
fi
true
Parallel Agent + Skill calls:
Agent(Explore):
"Analyze the architecture of this project. Find:
1. Entry points (main files, route definitions, controllers)
2. Dependency structure (imports between modules)
3. Existing design patterns (MVC, service layers, event-driven, etc.)
4. Code related to: $ARGUMENTS
Report: module map, dependency direction, patterns found."
Skill(capability-discovery):
Discover tech stack, available agents, and project conventions.
Map user flows (from architecture-patterns skill):
Read or capture specification (when an issue is in scope):
Architecture decisions need a fence — the same ## Specification (non-goals, failure modes, interface contracts) that commands/start.md captures. Before proposing the design, invoke the specification-capture skill to read existing specification from the journal or capture missing elements. The skill is idempotent: if commands/start.md already captured the spec for this issue, the skill returns it verbatim; otherwise it captures non-goals + interface contracts (failure modes are optional during design but recommended).
Skill(specification-capture):
Inputs:
- Issue context: {pre-fetched issue title, body, comments, labels}
- Journal path: <journal dir>/issue-$ISSUE_NUM.md, the journal dir being what bin/journal-dir.sh prints (default .decisions)
- Invocation reason: design
If $ISSUE_NUM is empty (design is exploratory, not tied to an issue), skip this step: the specification section is written to an issue journal, and there is no issue. The design discussion proceeds without a frozen fence; the user is responsible for capturing the spec when the design lands in an issue.
After the skill returns, surface the non-goals and interface contracts in the design discussion explicitly: every architecture decision must be reasoned against these constraints. A design that violates a captured non-goal is a scope mismatch, not a candidate.
Create tasks to track each design activity:
TaskCreate("Map existing architecture", "Identify entry points, dependency structure, existing patterns relevant to $ARGUMENTS")
TaskCreate("Identify abstraction level", "Determine C4 level: Context, Containers, Components, or Code")
TaskCreate("Propose design", "Map components, dependencies, data flow, integration points, API surface")
TaskCreate("Coupling and convention review", "Check circular deps, god objects, dependency direction, convention alignment")
TaskCreate("Design decision", "Present trade-offs, get user approval, log to decision journal")
TaskUpdate("Map existing architecture", status: "in_progress")
Apply C4 model thinking at the appropriate level:
TaskUpdate("Map existing architecture", status: "completed") TaskUpdate("Identify abstraction level", status: "completed") TaskUpdate("Propose design", status: "in_progress")
Present the design proposal to the user. Use the decision framework from architecture-patterns:
| Field | Content |
|---|---|
| Context | {situation and forces} |
| Options | {2-4 approaches} |
| Trade-offs | {per-option analysis} |
| Recommendation | {preferred option and why} |
TaskUpdate("Propose design", status: "completed")
TaskUpdate("Coupling and convention review", status: "in_progress")
Validate the design with evidence:
Coupling check:
Agent(Explore):
"Check coupling and dependency health for this project:
1. Find circular dependencies
2. Identify god objects (files imported by many others)
3. Check dependency direction (does domain depend on infrastructure?)
4. Flag hidden coupling (shared mutable state, globals)
Report: coupling findings with file:line citations."
Convention alignment:
Present trade-offs to the user:
TaskUpdate("Coupling and convention review", status: "completed")
TaskUpdate("Design decision", status: "in_progress")
metadata: {"source": "flow:decision"}) with contextual options to ask: "Recommended design: {approach}. {rationale}. Approve?"issue-N the block below writes issue-N.md; on any other branch it writes today's session journal, <journal dir>/session-YYYY-MM-DD.md (dated by the local calendar day), and the manifest emit below records to the same file.BRANCH=$(git branch --show-current)
ISSUE_NUM=$(printf '%s\n' "$BRANCH" | grep -oE 'issue-[0-9]+' | head -1 | grep -oE '[0-9]+')
# The issue journal on an issue branch, today's session journal otherwise.
JOURNAL_SCOPE=--session
[ -n "$ISSUE_NUM" ] && JOURNAL_SCOPE=--issue
cat << 'ENTRY' | "$(__fr="${CLAUDE_PLUGIN_ROOT:-}";[ -x "$__fr/bin/cascade-resolve.sh" ]||__fr=$({ printf '%s\n' plugins/flow;ls -d "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/plugins/cache/synapti-marketplace/flow/*/ 2>/dev/null|sort -Vr;printf '%s\n' "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/plugins/marketplaces/synapti-marketplace/plugins/flow"; }|while read -r __p;do [ -x "${__p%/}/bin/cascade-resolve.sh" ]&&{ printf '%s\n' "${__p%/}";break;};done);printf '%s\n' "$__fr")/bin/journal-append.sh" "$JOURNAL_SCOPE" ${ISSUE_NUM:+"$ISSUE_NUM"} -
## Design Decision: {title}
**Date**: {YYYY-MM-DD} | **Category**: architecture
**Decision**: {what was decided}
**Options considered**: {each option, one line}
**Trade-offs**: {what the chosen option gives up}
**Rationale**: {why this approach}
**Non-goals**: {what this design does not do}
**Failure modes**: {how it fails and what happens then}
**Consequences**: {what changes, new constraints}
ENTRY
If the helper exits non-zero, report the failure and skip the manifest emit below — recording the artifact would leave the journal asserting a design decision its body does not contain, which is worse than a missing record.
Manifest emit — append the design-decision artifact to the journal manifest alongside the freeform ## Design Decision section. Each block runs in its own shell, so set DECISION_TITLE to the decision's title at the top of the block before running it. The block finds the journal from the branch name itself, as the block above does.
# DESIGN_MANIFEST_BLOCK_BEGIN
# Self-contained: re-derive the journal from the branch, as the block above
# does, so the artifact goes to the file that holds the section.
ISSUE_NUM=$(git branch --show-current 2>/dev/null | grep -oE 'issue-[0-9]+' | head -1 | grep -oE '[0-9]+')
JOURNAL_SCOPE=--session
[ -n "$ISSUE_NUM" ] && JOURNAL_SCOPE=--issue
"$(__fr="${CLAUDE_PLUGIN_ROOT:-}";[ -x "$__fr/bin/cascade-resolve.sh" ]||__fr=$({ printf '%s\n' plugins/flow;ls -d "${CLAUDE_CONFIG_DIR:-$HOME/.claude}"/plugins/cache/synapti-marketplace/flow/*/ 2>/dev/null|sort -Vr;printf '%s\n' "${CLAUDE_CONFIG_DIR:-$HOME/.claude}/plugins/marketplaces/synapti-marketplace/plugins/flow"; }|while read -r __p;do [ -x "${__p%/}/bin/cascade-resolve.sh" ]&&{ printf '%s\n' "${__p%/}";break;};done);printf '%s\n' "$__fr")/bin/journal-record.sh" \
"$JOURNAL_SCOPE" ${ISSUE_NUM:+"$ISSUE_NUM"} \
--type design-decision \
--metadata decision="$DECISION_TITLE" \
--metadata category=architecture
# DESIGN_MANIFEST_BLOCK_END
Present next steps:
/flow:start <issue> — begin implementation/flow:brainstorm — explore more options before deciding| Action | Tier | Behavior |
|---|---|---|
| Read codebase / architecture | 1 | Autonomous, read-only |
| Read existing specification from journal | 1 | Autonomous, read-only |
Invoke Skill(specification-capture) if missing elements | 1 | Autonomous (writes journal) |
AskUserQuestion (design decision) | n/a | User-driven decision point |
| Write to decision journal | 1 | Autonomous, file edit |
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
23 commands in this plugin
/addressAddress Review Feedback for PR #$ARGUMENTSAddress PR review feedback systematically. Categorizes feedback, implements surgical fixes, verifies changes, and re-requests review./brainstormBrainstorm: $ARGUMENTSExplore approaches before committing to implementation. Generates options, analyzes trade-offs, and helps select the best approach collaboratively./commitContext-Aware CommitClassify changes and create atomic commits with conventional messages. Flags out-of-context modifications and red-flag patterns before committing.npx claudepluginhub synaptiai/synapti-marketplace --plugin flowOther plugins' commands for the same job