A MethodFactory Framework for AI-Assisted Development

F3: Foundation-First Framework

A structured methodology for building high-quality applications with Claude Code. Not just fast—intentional, maintainable, and production-ready.

The Problem: AI-assisted development makes it tempting to skip planning and "just start building"—and also skips the boring stuff: proper logging, error handling, and security. The result? Code that works in demos but fails in production.
The Solution: Foundation-First development that enforces intentional design, keeps human judgment in the loop, and builds production-ready code with security, logging, and error handling from day one.
1

FOUNDATION

Spec It + Plan It
Define Before You Build

2

IMPLEMENTATION

Build It ↔ Guide It
Human Judgment in the Loop

3

DOCUMENTATION

Document It
Maintainable Knowledge

Executive Summary

F3 (Foundation-First Framework) is a structured methodology for building production-ready applications with Claude Code. It solves the core problems of AI-assisted development: skipped planning, autonomous coding that goes off track, and code that works in demos but fails in production.

Note: While optimized for Claude Code, the core methodology is tool-agnostic and validated for use with other AI coding assistants (Copilot, Cursor, etc.).

🎯 What It Is

An Existing Framework Translation + three-area methodology with ready-to-use templates, prompts, and protocols that guide every Claude Code project from concept to production. Works within any existing tech stack.

⚠️ The Problems It Solves

  • AI tempts developers to skip planning → scope creep, rework
  • Autonomous coding goes off track → wasted effort
  • Context lost between sessions → repeated explanations
  • Missing logging, error handling, security, accessibility → production failures

✅ Why Use It

  • Intentional Design: Spec and plan before building
  • Human Oversight: Build ↔ Guide cycle keeps you in control
  • Persistent Context: Documentation survives session resets
  • Production-Ready: Security, logging, error handling, accessibility built-in

📦 What You Get

  • Complete document templates (CLAUDE.md, SPEC.md, PLAN.md, etc.)
  • Copy-paste prompts for every development phase
  • Production standards for security, logging, errors, accessibility
  • Self-correcting protocols that keep Claude on track

The Bottom Line

Without F3, Claude Code produces code fast but fragile. With F3, you get production-ready applications built with intentional design, continuous human oversight, and professional documentation—every time.

Project Structure

F3 creates a consistent documentation structure in every project. Your application code can be organized however you prefer.

F3 Project Structure
your-project/
├── F3_FRAMEWORK.md      # F3 hub — start here (routes to modules)
├── F3_CORE.md           # Methodology, standards, guardrails
├── F3_PROMPTS.md        # All Claude Code prompts
├── F3_TEMPLATES.md      # Document templates (CLAUDE.md, SPEC, etc.)
├── F3_SETUP.md          # Setup guides (new & existing projects)
├── F3_CHANGELOG.md      # Version history & roadmap
├── SPEC.md              # Project requirements
├── PLAN.md              # Architecture & implementation plan
├── CLAUDE.md            # Session bootstrap (Claude reads first)
├── docs/
│   ├── architecture.md  # System design
│   ├── api.md           # API contracts
│   ├── stack.md         # Tech stack details
│   ├── decisions.md     # Architecture Decision Records
│   ├── devlog.md        # Session logs
│   ├── todo.md          # Task tracking
│   └── changelog.md     # Release history
└── [your code here]     # Organize however you want
Key Rule
As long as CLAUDE.md is in the root, the F3_*.md modules are in the root, and /docs/ has the F3 files, organize your application code however you prefer.

New Project

Start a new project with F3 in under 5 minutes.

1

Create your project folder

Create a new folder for your project and open it in VS Code (or your preferred editor).

2

Add F3 module files to your project root

Download or copy all six F3_*.md files into your project folder: F3_FRAMEWORK.md (hub), F3_CORE.md, F3_PROMPTS.md, F3_TEMPLATES.md, F3_SETUP.md, and F3_CHANGELOG.md.

3

Start Claude Code

Open a terminal in your project folder and run:

claude
4

Tell Claude what you want to build

Use this prompt to kick off the F3 workflow:

New Project Prompt
Read @F3_FRAMEWORK.md

I want to build [DESCRIBE YOUR PROJECT].

Let's use F3 to do this right. Start by helping me create 
SPEC.md - ask me questions one at a time to understand 
what I'm building.
5

Set up F3 documentation system

Once SPEC.md and PLAN.md are complete, set up the full F3 documentation structure:

Initial Setup Prompt
Read @F3_FRAMEWORK.md and @F3_TEMPLATES.md, then set up the F3 
documentation system.

Using the templates in @F3_TEMPLATES.md, create:

1. CLAUDE.md in the project root
   - Use the CLAUDE.md template
   - Fill in project name, tech stack, current phase
   - Keep all F3 standard sections (Session Protocol, etc.)

2. /docs directory with:
   - architecture.md (system design)
   - api.md (API contracts, if applicable)
   - stack.md (tech stack details)
   - decisions.md (Architecture Decision Records)
   - devlog.md (session logs)
   - todo.md (task tracking)
   - changelog.md (release history)

Pull information from SPEC.md and PLAN.md to populate these files.
Mark anything needing my input with [TODO: ...]

What Happens Next

Claude will guide you through the F3 workflow:

1 Foundation

Claude asks questions to understand your project, then creates SPEC.md (requirements) and PLAN.md (architecture).

2 Implementation

Claude builds components one at a time, stopping after each for your review. You guide, Claude corrects, you approve.

3 Documentation

Claude creates and updates documentation as you build—architecture, API, decisions, devlog—so context is never lost.

💡 The Key Insight
F3 keeps you in control. Claude proposes, you approve. Every component gets reviewed before Claude moves on. This prevents Claude from going off-track on your project.

Existing Projects

Adding F3 to a project that wasn't started with the framework? You'll need to document existing architecture and decisions retroactively.

1. Assess the Current State

Prompt
Analyze this codebase and give me an overview:
1. What is this application and what does it do?
2. What tech stack is being used?
3. What's the file/folder structure?
4. Are there any existing docs I should know about?
5. What state is the project in (MVP, production, etc.)?

2. Create Retroactive SPEC.md

Prompt
Based on your analysis of this codebase, create a SPEC.md that 
documents:

1. What this application does (reverse-engineer the vision)
2. The problems it solves and who it's for
3. Core features that exist today
4. Any features that appear partially implemented
5. Technical constraints you can observe

This is retroactive documentation - we're capturing what IS, 
not what we planned to build.

3. Create Retroactive PLAN.md

Prompt
Create a PLAN.md that documents the current implementation:

1. The architecture as it exists today
2. Database schema (from migrations or schema files)
3. API endpoints that exist
4. Component hierarchy
5. Dependencies in use

Mark any areas that seem incomplete or inconsistent.

4. Set up F3 Documentation System

Once the retroactive SPEC.md and PLAN.md are complete, set up the full F3 documentation structure:

Initial Setup Prompt
Read @F3_FRAMEWORK.md and @F3_TEMPLATES.md, then set up the F3 
documentation system.

Using the templates in @F3_TEMPLATES.md, create:

1. CLAUDE.md in the project root
   - Use the CLAUDE.md template
   - Fill in project name, tech stack, current phase
   - Keep all F3 standard sections (Session Protocol, etc.)

2. /docs directory with:
   - architecture.md (system design)
   - api.md (API contracts, if applicable)
   - stack.md (tech stack details)
   - decisions.md (Architecture Decision Records)
   - devlog.md (session logs)
   - todo.md (task tracking)
   - changelog.md (release history)

Pull information from SPEC.md and PLAN.md to populate these files.
Mark anything needing my input with [TODO: ...]

Claude Code Implementation Prompts

Copy and paste these prompts into Claude Code. These assume the F3_*.md module files are in your project root.

Upgrade Existing Project to F3 Prompt

Setup

Use when: You have an existing project that has never used F3 and you want to convert it to the F3 methodology. This creates the full F3 documentation system around your existing codebase.

Prompt
Read @F3_FRAMEWORK.md and convert this existing project to the F3 
methodology.

**Phase 1: Assess Current State**
Analyze this codebase and give me an overview:
1. What is this application and what does it do?
2. What tech stack is being used?
3. What's the file/folder structure?
4. Are there any existing docs I should know about?
5. What state is the project in (MVP, production, etc.)?

**Phase 2: Create Retroactive Foundation**
Based on your analysis:
1. Create SPEC.md by reverse-engineering what was built — document 
   the vision, problems solved, core features, and any partially 
   implemented features
2. Create PLAN.md by documenting the architecture as it exists — 
   schema, API endpoints, component hierarchy, dependencies

Mark any areas that seem incomplete or inconsistent.

**Phase 3: Set Up F3 Documentation System**
Using the templates in @F3_TEMPLATES.md, create the full F3 
documentation structure:
1. CLAUDE.md in project root (customize with this project's specifics)
2. /docs/ directory with all 7 template files
3. Populate docs from your codebase analysis — don't leave them 
   as empty templates

When creating documentation:
- Architecture.md should reflect the ACTUAL current architecture
- API.md should document EXISTING endpoints
- Stack.md should list CURRENT dependencies and versions
- Decisions.md can start with a single entry: "Adopted F3 Framework"

**Phase 4: Present Summary**
Show me:
1. What files were created
2. Key findings from codebase analysis
3. Any concerns, gaps, or inconsistencies discovered
4. Recommended priorities for first F3 session

Wait for my approval before proceeding with any changes.

F3 Version Update Prompt

Setup

Use when: Your project already uses F3 and you've updated the F3_*.md module files to a newer version. Claude re-reads the framework, identifies what changed, and updates your project's F3 docs accordingly.

Prompt
Read @F3_FRAMEWORK.md and its linked modules — I've updated to a 
newer version of the F3 Framework. Compare it against this project's 
current F3 setup and bring everything up to date.

**Check for changes in:**
1. F3 Framework Reference - update version number
2. F3 Methodology Reminder - replace with latest version
3. Pre-Implementation Checkpoint - add if missing, update if exists
4. Build ↔ Guide Cycle Protocol - update if changed
5. Any new sections added since this project was created
6. Any new documentation templates or files introduced
7. Any changes to folder structure or file conventions

**Process:**
1. Show me the current F3 version in this project's CLAUDE.md
2. Show me what sections need updating
3. Identify any NEW files or folders the updated F3 version requires 
   that don't exist in this project yet
4. Show me the proposed changes (diff-style)
5. Wait for my approval before making changes

Do NOT change project-specific content (Quick Context, Tech Stack, 
Current Development Phase, Critical Conventions, etc.) - only update 
F3 framework sections. Create new F3 files/folders only if the 
updated version introduces them.

Session Start Prompt

Session

Use when: Beginning a new work session.

Prompt
Let's start a new session. Please:

1. Read CLAUDE.md for project context
2. Check /docs/devlog.md for the last session summary
3. Review /docs/todo.md for current priorities
4. Check for any unresolved BLOCKERs in devlog.md
5. Give me a brief status: what we were working on, what's next, 
   and any blockers

Then let's continue with [describe what you want to work on].

Session End Prompt

Session

Use when: Closing your terminal or ending a work session.

Prompt
Let's wrap up this session. Please:

1. Summarize what we accomplished today with timestamps
2. Note any decisions we made
3. List any blockers or issues encountered (Hard Stops vs Soft Issues)
4. Identify priorities for next session

Then:
- Append a new entry to /docs/devlog.md with this summary
- Update the "Current Development Phase" section in CLAUDE.md
- Update /docs/todo.md to reflect completed and new tasks
- If we made any architectural decisions, add them to /docs/decisions.md

Blocker Documentation Prompt

Blocker

Use when: You hit a technical issue that stops progress.

Prompt
STOP - we hit a blocker that's halting progress.

Document this NOW in /docs/devlog.md:

## BLOCKER - [TIMESTAMP]

**Issue:** [Exactly what broke or what's missing]
**Impact:** [Why this stops progress completely]
**Context:** [What we were doing when this happened]
**Resolution Plan:** [Steps needed to fix this]
**Estimated Downtime:** [Your time estimate]

Then pause work until the blocker is resolved.

Feature Complete Documentation Prompt

Documentation

Use when: A feature, component, or task has been approved and verified — BEFORE starting the next one. Don't batch documentation for session end.

Why this matters: In long sessions, context compaction can lose implementation details from earlier work. Documenting immediately captures decisions, patterns, and rationale while they're still in full context.

Prompt
We just completed [FEATURE/COMPONENT NAME]. Before moving on, 
document this work NOW:

1. **devlog.md** — Add a timestamped entry:
   - What was built and why
   - Key decisions made during implementation
   - Any deviations from the original plan and rationale
   - Any gotchas or lessons learned

2. **Run the Documentation Update Triggers:**
   Check every trigger in the F3 Documentation Update Triggers table 
   and update all applicable docs:
   - API endpoints added/changed → api.md
   - Modules/services/data flow changed → architecture.md  
   - Non-trivial tech choices made → decisions.md (add ADR)
   - Dependencies changed → stack.md
   - Schema changes → architecture.md + api.md
   - Auth changes → architecture.md + api.md + decisions.md

3. **todo.md** — Mark completed items done, add any new items 
   that surfaced during implementation

4. **CLAUDE.md** — Update "Current Development Phase" if the 
   completed feature changes project status

5. **Confirm** — List which docs were updated and summarize 
   changes in 2-3 sentences.

Do NOT skip this step. Do NOT defer to session end.

Documentation Checkpoint Prompt

Documentation

Use when: A session has been running for an extended period (hours or days) and you need to ensure all work is fully documented up to this point — without ending the session.

Why this matters: Long-running sessions accumulate work across multiple features. Even with per-feature documentation, details drift, docs fall behind, and context compaction erases nuance. This prompt forces a comprehensive documentation sweep so nothing is lost if the session continues, compacts, or crashes.

Prompt
DOCUMENTATION CHECKPOINT — This session has been running for a while. 
Before we continue, do a full documentation sweep NOW.

**1. Audit devlog.md**
   - Review everything we've done since the last checkpoint or 
     session start
   - Add timestamped entries for ANY work not yet documented
   - Include decisions made, problems solved, and workarounds applied
   - Flag anything that feels incomplete or uncertain

**2. Verify all docs against current code**
   Run through every Documentation Update Trigger:
   - architecture.md — Does it reflect all current components and 
     data flow?
   - api.md — Are all endpoints documented with current signatures?
   - decisions.md — Are all non-trivial tech choices captured as ADRs?
   - stack.md — Do dependencies match what's actually installed?
   - todo.md — Is the completed/pending status accurate right now?

**3. Check for doc drift**
   Compare docs against actual code. For each file:
   - If docs match code: Confirm ✓
   - If docs are behind: Update now
   - If unclear whether docs or code are correct: Log a DOC-DRIFT 
     item in todo.md and flag for my review

**4. Update CLAUDE.md**
   - "Current Development Phase" should reflect where we actually are
   - Active work items should match reality
   - Any new conventions or warnings discovered during this session

**5. Checkpoint marker**
   Add this to devlog.md:
   
   ## CHECKPOINT - [TIMESTAMP]
   Docs verified against code. All entries current through this point.
   Next priorities: [list what's next]

**6. Report**
   Give me a summary:
   - What was documented or updated
   - Any DOC-DRIFT items found
   - Any gaps or concerns
   - Confirmation that all F3 docs are current

Do NOT skip any file. We are continuing after this — this is not 
session end.

Resume After Blocker Prompt

Blocker

Use when: Restarting work after resolving a technical blocker.

Prompt
Resuming after [BLOCKER_TYPE] was resolved:

1. Read the last BLOCKER entry in /docs/devlog.md
2. Confirm what was fixed and how
3. Tell me exactly where we left off before the blocker
4. Verify the fix is working (run any relevant tests)
5. Continue from the precise point before interruption

We were working on [FEATURE] when [BLOCKER] stopped us.

Context Recovery Prompt

Session

Use when: Returning after a long break or when Claude seems lost.

Prompt
I need you to rebuild your understanding of this project. Please:

1. Read CLAUDE.md for the project overview
2. Read /docs/architecture.md for system design
3. Read the last 3 entries in /docs/devlog.md for recent context
4. Check /docs/devlog.md for any unresolved BLOCKERs
5. Check /docs/todo.md for current priorities
6. Review /docs/decisions.md for key architectural choices

Then give me a summary of:
- What this project is and does
- The current development state
- Any unresolved blockers
- What we should work on next

Feature Discovery Prompt

Feature

Use when: A new feature idea emerges mid-project that isn't in SPEC.md or PLAN.md yet.

Prompt
I want to explore a new feature idea: [FEATURE_IDEA]

Before we build anything, let's run this through F3 Foundation:

**1. Explore the idea:**
- What problem does this feature solve?
- Who benefits from it?
- What's the user story? ("As a [user], I want [feature] so that [benefit]")

**2. Check fit with existing vision:**
- Read SPEC.md - how does this align with project goals?
- Does it enhance or distract from core functionality?
- Are there any conflicts with existing features?

**3. Assess implementation impact:**
- What existing components does this touch?
- What new components would be needed?
- Any database schema changes?
- Any API changes?
- Rough complexity estimate (small/medium/large)

**4. Recommend:**
- Should we add this to the spec? (Yes/No/Defer/Modify)
- If yes, draft the SPEC.md addition
- Flag any concerns or alternatives

Don't implement anything yet—just explore and recommend.

Feature Planning Prompt

Feature

Use when: A feature has been approved and needs to be added to SPEC.md and PLAN.md.

Prompt
Let's add [FEATURE_NAME] to our Foundation documents.

**1. Update SPEC.md:**
- Add feature to appropriate section (Core Features, Phase 2, etc.)
- Include user story and acceptance criteria
- Note any new constraints or requirements

**2. Create implementation plan in PLAN.md:**
- Break down into components (what needs to be built)
- Define the implementation order
- Identify dependencies on existing code
- Note any architectural decisions needed

**3. Update related docs:**
- If API changes: update api.md
- If architecture changes: update architecture.md  
- If new decisions: add ADR to decisions.md
- Add to todo.md with priority

**4. Summary:**
- Show me the additions to each file
- Confirm the implementation order
- Ask if I want to proceed to implementation

Wait for my approval before making any changes to the docs.

Feature Implementation Prompt

Feature

Use when: Starting implementation of a feature that's already in PLAN.md.

Prompt
Let's implement [FEATURE_NAME] from PLAN.md.

Following the Build ↔ Guide cycle with explicit checkpoints:

1. Build the [FIRST_COMPONENT] (backend/frontend/database)
2. When complete, STOP and announce:
   - "I've completed [COMPONENT_NAME]"
   - Show what you built (summary, files, key functionality)
   - Ask: "Would you like to review before I continue to [NEXT]?"
3. WAIT for my review and approval
4. After I approve, proceed to next component
5. Repeat: Build → Stop → Announce → Show → Ask → Wait → Approve

**Rules:**
- Complete ONE component at a time
- ALWAYS stop and announce when done
- NEVER proceed without my explicit approval
- Show me what you created before moving on
- If I give feedback, make corrections before continuing

Begin with [FIRST_COMPONENT]. Think through the implementation 
carefully, build it, then STOP and show me what you created.

**Production Standards (required for EVERY component):**
- ☐ Logging: Key actions and errors logged with context
- ☐ Error Handling: User-friendly messages, no raw errors exposed
- ☐ Security: Input validation, parameterized queries, output escaping
- ☐ Accessibility: Semantic HTML, ARIA attributes, keyboard navigation

Complex Feature Architecture Prompt

Feature

Use when: Planning a complex feature that needs deep thinking.

Prompt
ultrathink: Design the [COMPLEX_FEATURE] architecture.

Consider:
- How this scales to 100k+ users
- Security implications and attack vectors
- Performance bottlenecks and optimization strategies
- Error handling and recovery
- Data consistency requirements
- Integration points with existing components

Propose a complete architecture before we start coding.

Threat Check Prompt (5-Minute Security Review)

Security

Use when: Building features involving auth, payments, user data, or any sensitive operations.

Prompt
Before we implement [FEATURE], let's do a quick threat check (5 minutes):

1. **Assets:** What are we protecting? (user data, credentials, money, etc.)

2. **Actors:** Who might want to abuse this? (attackers, malicious users, bots)

3. **Attack Surface:** What inputs/endpoints are exposed? What could be manipulated?

4. **Abuse Cases:** How could this feature be misused? (spam, data scraping, 
   credential stuffing, privilege escalation, injection, etc.)

5. **Mitigations:** What protections do we need? (rate limiting, validation, 
   authorization checks, logging, monitoring, etc.)

Give me a brief assessment before we proceed to implementation.

Quick Reference Commands

Quick Commands
Starting work "Read CLAUDE.md and devlog, then tell me where we left off"
Ending work "Summarize this session and update devlog and todo"
Hit blocker "STOP - document blocker in devlog NOW: [issue, impact, context]"
After blocker fixed "Resume after blocker: read BLOCKER entry, tell me where we stopped"
Made a decision "Add an ADR for [decision] to decisions.md"
Lost context "Re-read all docs and summarize project state"
New feature "Before we start, update architecture.md with the planned changes"
Need deep thinking "ultrathink: Design [feature] considering scale, security, performance"

Existing Framework Translation

Before defining requirements or writing code, the F3-Framework needs to understand your existing framework. The Existing Framework Translation captures your framework's DNA so every subsequent session starts warm.

Framework-agnostic by design. The Existing Framework Translation doesn't prescribe a tech stack — it describes yours. Whether you build with Next.js, Laravel, .NET, Rails, WordPress, or anything else, it translates your choices into machine-readable context.

Two Paths — Same Outcome

The translation offers two paths. Both produce the same output (Foundation context files), and both include Claude asking follow-up questions regardless of which path you choose:

PATH A: SELF-GUIDED

Complete the Framework Translation Worksheet at your own pace before the session. Claude uses your answers as a starting point and asks targeted follow-ups.

PATH B: F3-FRAMEWORK-GUIDED

Skip the homework. Run the Framework Translation Prompt and Claude walks you through all 11 categories conversationally in real-time.

Download Translation Worksheet View Worksheet Online Fillable .docx — complete offline and bring to your F3-Framework session

The 11 Translation Categories

Each category produces both a description (what the F3-Framework should know) and a guardrail (what the F3-Framework should never do):

# Category What It Captures
01Tech Stack DeclarationFramework, language, CSS, state, DB, auth, tooling — with versions
02Folder Structure MapDirectory layout, purpose of each folder, where file types belong
03Naming ConventionsFile, component, function, CSS, variable, DB, API, and test naming
04Architectural PatternsArchitecture pattern, data flow, separation of concerns, API design
05Component & Module PatternsInternal structure, props/types, exports, state handling patterns
06Styling RulesTokens, breakpoints, styling pattern, animations, dark mode, UI library
07State ManagementGlobal state, local/global boundaries, server state, forms, caching
08Dependency BoundariesApproved packages, banned packages, addition policy, internal libs
09Testing StrategyFrameworks, coverage, test location, mocking, utilities
10Environment & DeploymentEnv vars, pipeline, hosting, configs, CI/CD
11"Never Do" ListType safety, security, imports, architecture, style hard rules

Framework Translation Prompt

Run this with or without a completed worksheet. Claude walks through all 11 categories and asks follow-up questions.

Framework Translation Prompt
Read @F3_FRAMEWORK.md and @F3_CORE.md, then begin the Existing 
Framework Translation for this project.

Your goal is to capture my framework's DNA across all 11 translation 
categories so you can generate accurate Foundation context files.

For EACH of the 11 categories:
1. Ask me specific questions about my conventions and patterns
2. Probe for details I might not think to mention
3. Confirm your understanding before moving to the next category
4. Note the guardrail that will be enforced for that category

The 11 categories are:
01. Tech Stack Declaration
02. Folder Structure Map
03. Naming Conventions
04. Architectural Patterns
05. Component & Module Patterns
06. Styling Rules
07. State Management Approach
08. Dependency Boundaries
09. Testing Strategy
10. Environment & Deployment Context
11. "Never Do" List

After completing all categories, generate:
1. A project-context.md file with the full framework translation
2. Recommendations for what should go into CLAUDE.md
3. A summary of all guardrails that will be enforced

Let's start with Category 01: Tech Stack Declaration.

What the Translation Produces

After completing the Existing Framework Translation, it generates:

  • project-context.md — Full framework translation with explicit guardrails
  • CLAUDE.md updates — Project-specific conventions added to the session bootstrap
  • Guardrail summary — Consolidated list of all enforced rules

These outputs feed directly into Area 1: Foundation.

Area 1: Foundation (Define & Architect)

Build the foundation before any code. This area has two activities:

Spec It: Define Requirements

Create SPEC.md to define the application vision.

Prompt to Start Specification
I want to build a [TYPE] application for [TARGET USERS].

The core problem: [DESCRIBE PROBLEM]

Let's create a comprehensive SPEC.md. Ask me one question at a 
time to develop a thorough specification. Each question should 
build on my previous answers.

Start by asking about the problem and users.

Plan It: Research & Architect

Once SPEC.md is complete, have Claude create the implementation plan:

Prompt
Read @SPEC.md thoroughly.

Before any coding, please:

1. RESEARCH:
   - Ask clarifying questions about any unclear requirements
   - Research current best practices for [TECH_STACK]
   - Identify potential technical challenges
   - Suggest optimal tech stack choices

2. CREATE PLAN.MD:
   - Development phases (MVP → Phase 2 → Phase 3)
   - Complete file structure to create
   - Component hierarchy and relationships
   - Database schema design
   - API endpoint list with methods
   - Dependencies needed
   - Estimated complexity per feature

3. WAIT FOR APPROVAL:
   Show me the plan and wait for my approval before coding.

Start with research and clarifying questions.

Area 2: Implementation (Integrated Build ↔ Guide Cycle)

This is where the actual development happens. Build and Guide are not sequential phases—they're a continuous integrated cycle.

The Implementation Cycle

1. Claude BUILDS 2. You GUIDE 3. Claude CORRECTS 4. You VERIFY 5. You APPROVE 6. Repeat

After completing each component, Claude MUST:

  1. STOP - Halt all forward progress
  2. ANNOUNCE - State what was completed
  3. SHOW - Provide summary of what was built
  4. ASK - Request review before continuing
  5. WAIT - Do not proceed without approval

Guide: You Steer in Real-Time

Active guidance prevents wasted work and maintains quality.

When Claude Goes Off Track

Redirect Prompt
Stop. That's not following our pattern in CLAUDE.md.

We use [CORRECT PATTERN] not [WHAT CLAUDE DID].

Please:
1. Read @CLAUDE.md section on [PATTERN]
2. Rewrite using the correct approach
3. Explain why this pattern is better

Before Complex Implementations

Prompt
Before you code this, explain:
1. Your approach to solving this
2. Why this is the right approach  
3. What tradeoffs you're making
4. What could go wrong

I want to validate the approach first.

Manage Scope Creep

Prompt
That feature isn't in SPEC.md.

Let's:
1. Add it to SPEC.md as Phase 2 if important
2. Document why in decisions.md
3. Stay focused on MVP for now

Get back to [CURRENT_FEATURE].

Warning Signs You Need to Guide More

  • Creating files not in the plan
  • Changing established patterns without asking
  • Adding features not in SPEC.md
  • Skipping error handling or validation
  • Not writing tests
  • Over-engineering simple features
  • Making assumptions about requirements

When you see these, stop and redirect immediately.

Area 3: Documentation (Persistent Knowledge)

Documentation happens continuously throughout development, not as a final step. This three-layer system solves Claude's context loss problem.

The Three-Layer Documentation System

Layer 1: Session Bootstrap (Auto-Read on Startup)

CLAUDE.md — Claude reads this automatically when you start

  • Project identity and tech stack (brief)
  • Current development phase and active work
  • Pointers to detailed docs
  • Critical conventions and warnings
  • Keep under 500 lines (it's an index, not a dump)

Layer 2: Stable Reference (Rarely Changes)

Deep context that doesn't change often:

  • docs/architecture.md — System design, components, data flow
  • docs/decisions.md — Architecture Decision Records (ADRs)
  • docs/stack.md — Tech choices and configuration
  • docs/api.md — API contracts and endpoints

Layer 3: Living State (Changes Frequently)

Active development tracking:

  • docs/devlog.md — Session-by-session progress summaries
  • docs/todo.md — Current tasks and priorities
  • docs/changelog.md — Release history

Handling Interruptions and Blockers

Technical issues that halt progress are inevitable. Proper documentation ensures you can resume efficiently.

Hard Stops (Session-Ending):

  • Missing dependencies (Docker, Node.js, Python)
  • Configuration errors that prevent running the app
  • API keys or credentials not configured
  • Database connection failures

Soft Issues (Worked Around):

  • API rate limits (switched endpoints)
  • Slow performance (continued anyway)
  • Warning messages (noted but not blocking)

F3 Operational Guardrails

These guardrails close operational gaps and ensure consistent execution across projects. They prevent "paper compliance" where docs exist but quality still drifts.

1. Instruction Precedence (Conflict Resolution)

When multiple sources conflict, follow this precedence order:

PrioritySourceGoverns
1System/platform constraintsSecurity policies, environment limits
2CLAUDE.mdWorkflow, conventions, quality gates
3SPEC.mdRequirements, acceptance criteria
4PLAN.mdImplementation steps, sequencing
5/docs/*Reference docs (architecture, API, etc.)

Examples of System/platform constraints: No secrets in logs, no writing outside repo, approved licenses only, no eval().

Conflict rules:

  • PLAN vs SPEC: Pause and propose plan correction
  • Docs vs Code: If safe + obvious, update docs; if unclear, log DOC-DRIFT and ask
  • Code vs SPEC: Treat as bug; fix code or update SPEC with approval + ADR

2. Component Definition (Size Control)

A component is one reviewable unit that can be validated quickly.

LimitDefaultNotes
Max files changed~5 filesExcluding tests/docs
Max new code~300 linesNet-new only
Risky changesSingle-layer onlyAuth, billing, migrations

If limits exceeded: Break down into smaller components and get approval before proceeding.

3. Definition of Done (DoD) Checklist

Before claiming "I've completed [COMPONENT]", all items must be satisfied:

DoD Checklist
## Scope
- [ ] Matches SPEC/PLAN requirements
- [ ] No scope creep (extra features)

## Quality
- [ ] Tests added/updated and passing
- [ ] Code follows project conventions

## Production Standards
- [ ] Logging: Key actions + errors logged
- [ ] Errors: User-safe messages only
- [ ] Security: Inputs validated, authz checked
- [ ] Accessibility: Semantic HTML, ARIA, keyboard nav

## Documentation
- [ ] Required docs updated (see triggers)

## Verification
- [ ] Commands run + outcomes captured

4. Documentation Update Triggers

When You Change...Update...
API endpoint/docs/api.md
Module/data flow/docs/architecture.md
Tech decision/docs/decisions.md (ADR)
Dependency/docs/stack.md
Component complete/docs/devlog.md + todo.md

5. Lightweight Security Gate

For any new endpoint, form, or job input:

Security Gate Checklist
1. Inputs identified: [List sources + types]
2. Validation: [Schema/approach]
3. Authorization: [Who can call? How enforced?]
4. Output handling: [Escaped if rendering]
5. Logging redaction: [No secrets/PII]
6. Abuse prevention: [Rate/size limits]

6. Lightweight Accessibility Gate

For any new UI component, page, or interactive element:

Accessibility Gate Checklist
1. Semantic HTML: [Correct elements — no div-buttons]
2. ARIA attributes: [Landmarks, roles, labels applied]
3. Keyboard navigation: [Tab, Enter, Escape reachable]
4. Focus management: [Visible indicators, logical order]
5. Color contrast: [4.5:1 minimum on all text]
6. Alt text: [Meaningful alt or alt="" for decorative]

Complete Documentation Templates

CLAUDE.md (Layer 1 - Session Bootstrap)

CLAUDE.md Template
# [PROJECT NAME]

> Brief one-line description

## Quick Context
[2-3 sentences: purpose, users, value proposition]

## F3 Framework Reference

This project uses F3 (Foundation-First Framework). The framework is split 
into modular files in the project root:

| Module | Contents |
|--------|----------|
| `F3_FRAMEWORK.md` | Hub — read this first, routes to all modules |
| `F3_CORE.md` | Methodology, production standards, guardrails |
| `F3_PROMPTS.md` | All Claude Code implementation prompts |
| `F3_TEMPLATES.md` | Document templates (CLAUDE.md, SPEC, docs/*) |
| `F3_SETUP.md` | Setup guides for new & existing projects |
| `F3_CHANGELOG.md` | Version history & roadmap |

**Claude: Read @F3_FRAMEWORK.md first — it routes you to the right module.**
- Need templates? → @F3_TEMPLATES.md
- Need methodology or guardrails? → @F3_CORE.md
- Need prompts? → @F3_PROMPTS.md

**Current F3 Version:** 3.0.0

## Tech Stack
- Frontend: [React, Next.js, etc.]
- Backend: [Node.js, Python, etc.]
- Database: [PostgreSQL, MongoDB, etc.]
- Infrastructure: [AWS, Vercel, etc.]

## Architecture Overview
See /docs/architecture.md for full system design.

Key Components:
- [Component 1]: [one-line description]
- [Component 2]: [one-line description]

## Current Development Phase
Phase: [MVP, Beta, Feature Development]

Active Work:
- [ ] [Current task]
- [ ] [Next priority]

Blocked By: [None or description]

Last Session: [Date] - [Brief summary]

## Critical Conventions
Code Patterns:
- [Pattern 1]: [explanation]
- [Pattern 2]: [explanation]

Git Workflow:
- Branch naming: [convention]
- Commit format: [convention]

## Operational Guardrails

### Instruction Precedence (when sources conflict)
1. System/platform constraints → 2. CLAUDE.md → 3. SPEC.md → 4. PLAN.md → 5. /docs/*

**If code conflicts with SPEC:** Treat as bug; fix code or update SPEC with approval + ADR.

### Component Sizing
- Max: ~5 files, ~300 lines per component (only tests/** and docs/** excluded)
- Risky changes (auth, billing, migrations): Single-layer only + rollback notes required

### Definition of Done (required)
- [ ] Scope matches SPEC/PLAN
- [ ] Tests passing
- [ ] Lint passes (if configured) or TODOs logged
- [ ] Logging, errors, security implemented
- [ ] Accessibility: semantic HTML, ARIA, keyboard nav
- [ ] Docs updated

### Doc Update Triggers
API change → api.md | Architecture → architecture.md | Decision → decisions.md | Schema affecting API → api.md

### Security Gate (new endpoints)
Inputs → Validate → Authorize → Escape output → Redact logs → Rate limit

### Accessibility Gate (new UI components/pages)
Semantic HTML → ARIA attributes → Keyboard nav → Focus management → Color contrast → Alt text

## Session Protocol

### F3 Methodology Reminder

This project follows F3 (Foundation-First Framework) v3.0.0:

**Area 1: Foundation** - Spec + Plan defined upfront  
**Area 2: Implementation** - Build ↔ Guide continuous cycle  
**Area 3: Documentation** - Continuous logging for persistent context
**Production Standards** - Security, logging, error handling, accessibility in every implementation

**Critical F3 Behaviors:**
- Show me each component before moving on (Build ↔ Guide cycle)
- **After completing each component: STOP, announce completion, wait for approval**
- Never proceed to next component without explicit permission
- Checkpoint progress to devlog.md after every component completion
- Document blockers immediately when they occur
- Never assume - always ask for approval before major changes
- **Include logging, error handling, security, and accessibility in EVERY component**

**⚠️ CRITICAL:** If a requested change is NOT in PLAN.md, do NOT implement it.
Stop and ask: "This isn't in our plan yet. Should we run Feature Discovery first?"

### Pre-Implementation Checkpoint

**Before starting ANY significant work, verify:**

1. ☐ Is this feature/change in SPEC.md?
2. ☐ Is there an implementation plan in PLAN.md?
3. ☐ If NO to either: **STOP** and use Feature Discovery Prompt first

**Before completing ANY component, verify Production Standards:**

4. ☐ Logging implemented for key actions and errors?
5. ☐ Error handling with user-friendly messages?
6. ☐ Security considerations addressed (input validation, auth, etc.)?
7. ☐ Accessibility: semantic HTML, ARIA attributes, keyboard navigation?

**Triggers for this checkpoint:**
- "Significant restructure" or "major refactor"
- Multi-file changes
- New components or features
- Architecture changes
- Anything described as "comprehensive" or "major"

**If you catch yourself about to implement without spec/plan:**
STOP → Acknowledge the gap → Ask: "Should we run this through F3 Foundation first?"

### Build ↔ Guide Cycle Protocol

**After completing EVERY component, you MUST:**

1. **STOP** - Do not continue to the next component
2. **ANNOUNCE:** "I've completed [COMPONENT_NAME]"
3. **SHOW:** Summary of what was built (files created/modified, key functionality)
4. **ASK:** "Would you like to review this before I continue to [NEXT_COMPONENT]?"
5. **WAIT:** Do not proceed until I give explicit approval

## Important Warnings
⚠️ Never edit files in /legacy or /vendor
⚠️ Always run tests before committing
⚠️ Checkpoint progress after completing each component

## Documentation Map
| Document | Purpose |
|----------|---------|
| /docs/architecture.md | System design |
| /docs/decisions.md | ADRs, rationale |
| /docs/stack.md | Tech choices |
| /docs/api.md | Endpoints |
| /docs/devlog.md | Session history |
| /docs/todo.md | Tasks |
| /docs/changelog.md | Releases |

## Session Start Checklist
1. Read this file (automatic)
2. Check /docs/todo.md for priorities
3. Review last /docs/devlog.md entry (including BLOCKERs)

## Session End Protocol
Before closing:
1. Summarize accomplishments and append to /docs/devlog.md
2. Update "Current Development Phase" above
3. Update /docs/todo.md with completed/new items
4. Document any decisions in /docs/decisions.md

SPEC.md Template

SPEC.md Template
# Project Specification

## Vision Statement
[One paragraph: What is this application and why does it exist?]

## Problem & Solution
- **Problem:** What pain point does this solve?
- **Target Users:** Who are they?
- **Solution:** How does this solve their problem?

## Core Features (MVP)
1. **[Feature Name]**
   - User Story: As a [user], I want to [action] so that [benefit]
   - Acceptance Criteria:
     * [Criterion 1]
     * [Criterion 2]
   - Priority: [High/Medium/Low]

2. **[Feature Name]**
   - User Story: ...
   - Acceptance Criteria: ...
   - Priority: ...

## User Flows
### Primary Flow: [Name]
1. User [action]
2. System [response]
3. User [action]
4. Result: [outcome]

## Success Metrics
- User engagement: [How measured]
- Performance: [LCP < 2.5s, etc.]
- Business: [Revenue, conversions, etc.]

## Technical Constraints
- Budget: [Limitations]
- Performance requirements: [Specific targets]
- Security requirements: [Authentication, compliance]
- Accessibility: [WCAG level]

## Out of Scope (v1)
- [Features explicitly NOT in MVP]
- [Features for later phases]

## Design Requirements
- Mobile-first responsive design
- Color scheme: [Colors]
- Accessibility: WCAG 2.1 AA compliance (see Accessibility Requirements below)

## Accessibility Requirements
- [ ] Semantic HTML for all UI components (no div-buttons)
- [ ] ARIA landmark roles on all page regions
- [ ] ARIA attributes on interactive widgets (menus, modals, tabs, accordions)
- [ ] Keyboard navigation: all features accessible without a mouse
- [ ] Visible focus indicators on all interactive elements
- [ ] Color contrast: 4.5:1 minimum (normal text), 3:1 (large text)
- [ ] Alt text on all informational images
- [ ] Form labels, error messages, and required field indicators
- [ ] Skip navigation link on pages with repeated nav
- [ ] Dynamic content announced via aria-live regions
- [ ] Target compliance level: [WCAG 2.1 AA / WCAG 2.2 AA / Section 508]
- [ ] Testing approach: [Manual screen reader testing / axe-core / Lighthouse / pa11y]

PLAN.md Template

PLAN.md Template
# Implementation Plan

## Phase 1: Foundation (Week 1-2)
- [ ] Project initialization and configuration
- [ ] Database schema setup
- [ ] Authentication system
- [ ] Basic UI framework

## Phase 2: Core Features (Week 3-4)
- [ ] Feature 1: [Name]
  - [ ] Backend API endpoints
  - [ ] Frontend components
  - [ ] Integration tests

## Phase 3: Polish (Week 5-6)
- [ ] Performance optimization
- [ ] Accessibility audit
- [ ] Security review

## Database Schema
[Schema definitions]

## API Endpoints
| Method | Endpoint | Purpose | Priority |
|--------|----------|---------|----------|
| POST | /api/auth/login | User login | High |

## Component Hierarchy
[Component tree structure]

## Dependencies
- Production: [list]
- Development: [list]

Layer 2: Stable Reference Templates

See F3_TEMPLATES.md for complete templates for:

  • docs/architecture.md - System design documentation
  • docs/decisions.md - Architecture Decision Records
  • docs/stack.md - Technology stack details
  • docs/api.md - API documentation

Layer 3: Living State Templates

See F3_TEMPLATES.md for complete templates for:

  • docs/devlog.md - Development session logs
  • docs/todo.md - Task tracking
  • docs/changelog.md - Release history

Why F3 Works

✅ Area 1: Foundation (Spec + Plan)

Clarity before code. Requirements and architecture documented upfront prevent scope creep and architectural mistakes. You know exactly WHAT you're building and HOW before writing code.

✅ Area 2: Implementation (Build ↔ Guide)

Continuous quality control. The integrated Build ↔ Guide cycle means Claude's work is reviewed immediately, not after hours of autonomous coding. You catch issues early, maintain standards, and prevent wasted work.

This is the critical differentiator: You're not just setting Claude loose and hoping for the best. You're actively pair programming, steering every decision.

✅ Area 3: Documentation (Persistent Context)

Never lose your place. The three-layer documentation system solves Claude's context loss problem. Every session starts with full project knowledge. Session logs mean you can resume after any break.

Blocker resilience: Immediate documentation of technical issues ensures you can restart exactly where you stopped, even after system crashes or forced restarts.

Pro Tips

Foundation Area

  • Use Claude to ask probing questions you might miss
  • Write user stories with real scenarios, not generic ones
  • Define success metrics before building
  • Review the plan thoroughly before approving

Implementation Area (Critical)

  • Review every component before allowing Claude to continue
  • Redirect immediately when Claude deviates from standards
  • Require explanations for complex features before implementation
  • Enforce step-by-step progress—never let Claude run ahead
  • Watch for warning signs (unplanned features, skipped tests, etc.)
  • Remember: This is pair programming, not autonomous coding
  • Use ultrathink for major architectural decisions

Documentation Area

  • Keep CLAUDE.md under 500 lines (it's an index)
  • Update docs during development, not after
  • Use /clear between unrelated tasks
  • Review docs weekly for accuracy
  • Version control everything

Troubleshooting

Claude ignoring standards:

  • Verify CLAUDE.md is in project root
  • Use /memory to check loaded files
  • Be more explicit in critical rules section
  • Guide more actively—don't let Claude run ahead

Context window filling:

  • Use /clear between unrelated tasks
  • Move completed notes out of chat
  • Use external files for checklists

Lost context after restart:

  • Check CLAUDE.md updated recently
  • Review last devlog entry (including BLOCKERs)
  • Use "Context Recovery" prompt
  • If resuming after blocker, use "Resume After Blocker" prompt

Implementation going off track:

  • Guide more frequently—review every component
  • Redirect immediately when deviating
  • Require explanations before implementations
  • Break tasks into smaller pieces

Version History

v3.0.0 - 2026-02-23

Modular Architecture (Breaking Change)

  • Monolithic → Modular — Framework split from a single file into 6 focused modules to stay within Claude Code's 25K-token per-file read limit
  • F3_FRAMEWORK.md is now a hub/index that routes to: F3_CORE.md, F3_PROMPTS.md, F3_TEMPLATES.md, F3_SETUP.md, F3_CHANGELOG.md
  • CLAUDE.md template updated — Documents modular routing table instead of single-file reference
  • Prompts updated — Setup and translation prompts now reference specific modules for targeted reads
  • Migration: Run the F3 Version Update Prompt after copying all 6 F3_*.md files to your project root

v2.5.1 - 2026-02-22

Mid-Session Documentation & Prompt Clarity

  • Feature Complete Documentation Prompt — Forces documentation immediately after each approved feature, preventing context compaction from losing implementation details
  • "After Each Feature (Mandatory)" — New category in documentation update triggers with checklist gate
  • Upgrade Existing Project to F3 Prompt — New 4-phase prompt for converting projects that have never used F3
  • F3 Version Update Prompt — For projects already using F3 that need to consume updated F3 module files (checks for new files/folders/templates)
  • Prompts Library nav reordered to match actual execution workflow
  • Former "Upgrade Project" prompt split into two distinct prompts for the two scenarios

v2.5.0 - 2026-02-21

Existing Framework Translation

  • Existing Framework Translation — New onramp capturing framework DNA before entering Area 1: Foundation
  • Two-path system: Self-Guided (Worksheet) and AI-Guided (Prompt)
  • 11 Translation Categories covering tech stack, folder structure, naming conventions, architectural patterns, and more
  • Framework Translation Prompt with full category walkthrough
  • Framework Translation Worksheet (downloadable Word document + HTML version)

v2.4.0 - 2026-02-21

Accessibility Standards — New Production Standard Pillar

  • Accessibility joins Security, Logging, and Error Handling as a core Production Standard
  • Accessibility Standards table with 10 requirements (semantic HTML, ARIA, keyboard nav, focus, contrast, alt text, forms, dynamic content, skip nav)
  • ARIA Patterns Quick Reference for 13 common interactive components
  • Accessibility Gate Checklist (parallel to Security Gate)
  • All enforcement touchpoints updated: SPEC.md, CLAUDE.md, DoD, Pre-Implementation, Feature Prompt, Completion Announcements

v2.1.4 - 2025-01-27

Introducing F3 to Existing Projects

  • Added "Introducing F3 to Existing Projects" section
  • Step-by-step guide for adopting F3 on existing codebases
  • Retroactive SPEC.md and PLAN.md creation workflows
  • Fixed Table of Contents alignment issues

v2.1.3 - 2025-12-13

Explicit Completion Announcements

  • Added Build ↔ Guide Cycle Protocol to CLAUDE.md template
  • Claude must STOP, ANNOUNCE, SHOW, ASK, WAIT after each component

v2.0.0 - 2025-12-13

Major Reorganization & Blocker Handling

  • Reorganized from 5 sequential phases to 3 core areas
  • Build It and Guide It now shown as integrated cycle
  • Added blocker handling protocol