01 — The Problem

Vague Prompts, Generic Code

A bare "build this screen" prompt returns code plus explanations plus a closing summary paragraph. Flags let you express output constraints in three characters.

Without flags, every build session requires re-stating the same constraints: "don't add comments," "just give me the file," "use strict types." With flags defined once in PROJECT_REF.md and referenced in every session context, those constraints become implicit. The AI knows what clean output looks like for this project before you write a single line of the actual request.

✗
Before flags
"Build the earnings screen" — Claude returns JSX + a paragraph explaining what it did + inline comments on every hook.
✓
After flags
"Build the earnings screen [NC][FO][TS]" — Claude returns one clean TypeScript file, no prose, no comments.
02 — The Six Flags

Prompt Flags Reference

Six shorthand tokens defined in PROJECT_REF.md. Append any combination to a prompt.

text
[NC]   No comments in output code        — all production code, clean output
[FO]   File only — skip all prose         — when you want just the file
[TS]   Strict TypeScript, no any          — auth flows, API responses
[PWA]  Consider SW / offline / cache      — routes the service worker caches
[DIFF] Return only changed lines          — minor edits to existing files
[FIX]  Bug fix only — minimal diff        — do not refactor surrounding code

Flags combine freely. [NC][FO][TS] is the standard combination for clean production builds. [DIFF][NC] is ideal for small additions to existing screens. [FIX] alone is enough for bug reports — it tells Claude not to touch anything beyond the specific defect.

Using [FIX] for a refactor or [DIFF] for a new screen produces wrong output. Match the flag to the task size.

03 — SESSION_CONTEXT Template

Starting Every Session with Full Context

Paste PROJECT_REF.md then the session template. Claude enters the session already knowing the full project state.

markdown
## Session Context
REF: PROJECT_REF.md (attached above)
Feature: consumer checkout — review order screen
Last completed: src/app/(consumer)/checkout/address/page.tsx
Next task: build /checkout/review using the flow doc entry
Relevant files: CONSUMER_FLOW.md#checkout-review, screens-checkout.jsx
Flags: [NC][FO][TS]

The template has six fields: REF, Feature, Last completed, Next task, Relevant files, and Flags. The "Relevant files" field is critical — list only what is needed for this task. Listing the entire docs folder burns tokens on context Claude will not use.

End every session by asking Claude to update PROJECT_REF.md: CHANGELOG, FOLDER STRUCTURE, REDUX STORE, and COMPONENTS. This keeps the ref file accurate so the next session starts from reality, not a stale snapshot.

04 — PROJECT_REF.md Structure

The AI's Re-entry Point

A single file that is the authoritative, always-current reference for what exists in the codebase.

markdown
## STACK (actual, not aspirational)
Next.js 14.2 | Tailwind CSS v4 | Redux Toolkit 2.x | Serwist 9.x

## DESIGN TOKENS
--color-primary: #ff9f1c  (orange)
--color-surface: #3b413c  (dark green)
--color-accent:  #70e000  (lime)
--color-danger:  #ff3c38  (red)

## REDUX STORE
authSlice      — { user, token, isNewUser, status }
checkoutSlice  — { items, address, deliverySlot, status, orderId }
vendorSlice    — { platesCooked, kitchenOpen, earnings }

## COMPONENTS (src/components/ui/)
Button — CVA, 6 variants x 4 sizes
Input, PhoneInput, OtpInput, PaginationDots, TagChip
StepperBar, DonutRing, CalendarCard, BottomNav, CookCard

## CHANGELOG
2024-06-10 | built consumer/checkout/address/page.tsx
2024-06-11 | built consumer/checkout/review/page.tsx

Keep STACK showing only actually-installed packages. Mark it "actual" not "aspirational." A planned library listed here will cause Claude to import it even before it is installed, producing module-not-found errors.

05 — References

Further Reading

Primary sources for this module.

  • docs/PROJECT_REF.md — Prompt flags defined under "PROMPT FLAGS" section
  • docs/prompt-questions.md — Claude's cheat sheet for handling vague instructions
  • Claude Code — CLAUDE.md docs — Anthropic's guide to project instructions
  • Anthropic's guide to project instructions — structuring session context for AI sessions
Check your understanding
1. Which flag combination is described as "the standard combination for clean production code builds"?
Correct.Not quite — the correct answer is highlighted above.
2. What is the purpose of the "Relevant files" field in the SESSION_CONTEXT template?
Correct.Not quite — the correct answer is highlighted above.
3. Why should planned (not yet installed) libraries NOT appear in PROJECT_REF.md STACK?
Correct.Not quite — the correct answer is highlighted above.