01 — What & Why

Flow Docs: The Behavioral Source of Truth

Design JSX tells Claude what a screen looks like. Flow docs tell it how the screen behaves.

TiffinConnect uses two markdown files — docs/CONSUMER_FLOW.md and docs/VENDOR_FLOW.md — that spec every screen for each user role. They are the authoritative record of routes, Redux state, navigation triggers, CTA validation rules, and stub status.

Without flow docs the AI builds screens that look pixel-perfect but navigate to the wrong route, miss validation logic, or create duplicate Redux slices that already exist elsewhere. The design JSX is a static mock — it cannot tell Claude what router.push() a button fires or what condition disables the CTA.

Two sources of truth, never one: design JSX wins on visual layout, flow doc wins on routing and Redux behavior.

02 — Screen Entry Format

How Every Screen Is Documented

A consistent 9-field entry format ensures Claude always gets complete behavioral context.

markdown
### Checkout — Review Order

Route: /checkout/review
Component: src/app/(consumer)/checkout/review/page.tsx
What it shows: Order summary, cook details, delivery window, total price

Actions:
  - Tap "Change address" -> navigates to /checkout/address
  - Tap "Confirm & Pay" -> dispatches checkout/submitOrder(payload)

State (reads): checkout.items, checkout.address, checkout.deliverySlot
State (writes): checkout.status, checkout.orderId

Navigation out: -> /checkout/payment on submitOrder.fulfilled
Validation: CTA disabled until checkout.address is set AND checkout.items.length > 0

Status: not built
TODOs: deliverySlot is hardcoded to "12:00–13:00"; real slot API not integrated

Every field is mandatory. Skipping Validation means Claude guesses the CTA condition. Skipping TODOs means mocks silently ship to production. The Status field gets flipped to built by the /build-screen skill in Phase 4 — never manually.

03 — How Claude Reads Flow Docs

Conditional Loading Inside /build-screen

Claude reads only the relevant flow file — not both — so tokens are spent on the right context.

When you invoke /build-screen consumer checkout review, Phase 1a instructs Claude to load CONSUMER_FLOW.md. When you invoke /build-screen vendor today home, it loads VENDOR_FLOW.md instead. The role argument is locked in Step 0 and controls every subsequent file read.

This conditional loading is the reason flow docs must be role-specific rather than merged into one file. A combined file would force Claude to parse the entire behavioral spec — consumer and vendor — every time, burning tokens on context it will never use for that screen.

✓
Add before building
Create the flow doc entry before invoking /build-screen. Phase 1 needs it to determine route and slice.
✗
Build without an entry
Claude will invent route names and Redux patterns. The resulting screen needs heavy correction.
✓
Mark built in Phase 4
Let /build-screen update the Status field. Never flip it manually; the skill also updates CHANGELOG.
✗
Use design JSX for routing
Design JSX is a static mock. It does not reflect real Next.js route groups or App Router conventions.
04 — Docs Ecosystem

The Full Frontend Docs Folder

Flow docs live inside a broader documentation system. Each file has one job.

Beyond the two flow docs, TiffinConnect keeps a layered docs folder so Claude always has the right information at the right granularity:

text
docs/
  CONSUMER_FLOW.md      # behavioral spec — every consumer screen
  VENDOR_FLOW.md        # behavioral spec — every vendor screen
  PROJECT_REF.md        # authoritative state: stack, Redux, tokens, changelog
  SCREEN_MAP.md         # checklist: built vs missing, file paths
  conventions.md        # naming, formatting, code rules
  components.md         # prop signatures + usage for every UI primitive
  api-integration.md    # fetch patterns, real vs stubbed endpoints
  state-management.md   # slice shapes, typed hooks, StoreProvider wiring
  open-questions.md     # 32 tracked gaps — mocks, stubs, missing wiring
  routing-and-auth.md   # middleware, redirect logic, protected routes

The rule: every file has one job. Merging behavioral spec into PROJECT_REF bloats the reference file and causes Claude to read things irrelevant to the current task. Flow docs stay separate and role-split.

05 — References

Further Reading

Primary sources for this module.

  • docs/CONSUMER_FLOW.md — TiffinConnect consumer behavioral spec
  • docs/VENDOR_FLOW.md — TiffinConnect vendor behavioral spec
  • .claude/commands/build-screen.md — /build-screen skill that reads flow docs in Phase 1
  • docs/PROJECT_REF.md — CHANGELOG and FOLDER STRUCTURE updated in Phase 4
  • Claude Code — CLAUDE.md docs — Anthropic's guide to project instructions
Check your understanding
1. What does a flow doc provide that the design reference JSX cannot?
Correct.Not quite — the correct answer is highlighted above.
2. Why are CONSUMER_FLOW.md and VENDOR_FLOW.md kept as separate files rather than merged?
Correct.Not quite — the correct answer is highlighted above.
3. Which phase of /build-screen is responsible for marking a screen as "built" in the flow doc?
Correct.Not quite — the correct answer is highlighted above.