Skip to content
gentic.news — AI News Intelligence Platform
Connecting to the Living Graph…

Listen to today's AI briefing

Daily podcast — 5 min, AI-narrated summary of top stories

A developer typing code on a laptop with a CLAUDE.md file open in a text editor, surrounded by project folders and…

How to Set Up CLAUDE.md: The Five-Question Framework That Makes Claude

Set up CLAUDE.md with `claude init` and the five-question framework (Who/What/Where/Why/How) to give Claude Code persistent project context, under 200 lines.

·15h ago·3 min read··5 views·AI-Generated·Report error
Share:
Source: dev.tovia devto_claudecodeSingle Source
How do I set up a CLAUDE.md file to make Claude Code understand my project?

Run `claude init` in your project root to generate a draft, then refine it using the five-question framework (Who, What, Where, Why, How) to define your role, project, structure, decisions, and commands. Keep it under 200 lines.

TL;DR

Run `claude init`, then refine with Who/What/Where/Why/How to give Claude persistent project context that eliminates guesswork.

What Changed — CLAUDE.md is Now Essential for Every Claude Code Project

CLAUDE.md is a Markdown file placed in your project's root directory that acts as a persistent system prompt for Claude Code. Without it, Claude starts each session from scratch, relying on generic assumptions that miss your actual conventions, architecture, and preferences.

When Claude Code opens a project, it reads this file first. This upfront context prevents Claude from making reasonable but incorrect guesses about your codebase, saving you from repeatedly correcting the same mistakes across sessions.

The Technique — The Five-Question Framework

To build a CLAUDE.md that gives Claude the context it needs without guesswork, answer five specific questions. Start by generating a draft:

cd /path/to/your/project
claude init

This scans your codebase and produces a first draft with build commands, code style notes, and structure overview. But treat it as a scaffold—it often misses critical details like your preferred testing framework or architectural decisions.

Refine it with these five sections:

Who are you? Define your role and team. This sets the perspective Claude should adopt.

## Who
- I am a full-stack developer on a two-person team.
- We prioritize accessibility and mobile-first design.

What are you building? Describe the project and its goals.

## What
- A Next.js 14 e-commerce site for handmade goods.
- Goal: fast, SEO-optimized product pages with Stripe checkout.

Where does everything live? Outline the project structure and key directories.

## Where
- `app/`: Next.js App Router pages and API routes.
- `components/`: Shared UI components.
- `lib/`: Business logic, database helpers, and API clients.
- `supabase/`: Database migrations and edge functions.

Why did you make those choices? Explain architectural decisions and constraints.

## Why
- Chose Supabase for real-time features and row-level security.
- Server Components by default; `'use client'` only when necessary.
- No CSS framework—use Tailwind utility classes exclusively.

How do you work? Provide exact commands for building, testing, linting, and running the project.

## How
- Build: `npm run build`
- Dev server: `npm run dev`
- Lint: `npm run lint`
- Test: `npm run test` (Vitest)
- Type check: `npx tsc --noEmit`

Why It Works — Context Window Economics

Claude Code's context window is finite. A bloated CLAUDE.md wastes tokens on irrelevant details. Keeping it under 200 lines forces you to prioritize the most impactful context. If you have extensive guidelines, split them into a CLAUDE.md/ directory:

CLAUDE.md/
├── 01-project-overview.md
├── 02-project-structure.md
├── 03-purpose-and-decisions.md
└── 04-working-on-project.md

In the root CLAUDE.md, include a simple pointer:

# CLAUDE.md

This project uses a modular context. See the `CLAUDE.md/` directory for full details.

This approach keeps the initial context lean while giving Claude access to all necessary information on demand.

Try It Now — Apply to Your Project Today

  1. Run claude init in your project root.
  2. Edit the generated CLAUDE.md using the five-question framework.
  3. Keep the file under 200 lines. If it grows, split into CLAUDE.md/ directory.
  4. Test by asking Claude a project-specific question—observe if it follows your conventions without correction.

Source: dev.to

Source: gentic.news · · author= · citation.json

AI-assisted reporting. Generated by gentic.news from multiple verified sources, fact-checked against the Living Graph of 4,300+ entities. Edited by Ala SMITH.

Following this story?

Get a weekly digest with AI predictions, trends, and analysis — free.

AI Analysis

Claude Code users should immediately adopt the CLAUDE.md file for every project, not just large codebases. The five-question framework (Who, What, Where, Why, How) is a structured way to ensure Claude has the right context. Start with `claude init` to get a draft, then manually refine it—especially the 'Why' section, which explains architectural decisions that Claude cannot infer from code alone. Keep the file under 200 lines to avoid token waste. If you need more context, split into a `CLAUDE.md/` directory with individual files per section. This modular approach reduces initial context size while still giving Claude access to detailed information when needed. Test your CLAUDE.md by asking Claude to perform a task specific to your project. If it makes incorrect assumptions, add those details to the file. Over time, this becomes a living document that makes Claude Code a reliable collaborator from the first prompt.

Mentioned in this article

Enjoyed this article?
Share:

AI Toolslive

Five one-click lenses on this article. Cached for 24h.

Pick a tool above to generate an instant lens on this article.

Related Articles

From the lab

The framework underneath this story

Every article on this site sits on top of one engine and one framework — both built by the lab.

More in Products & Launches

View all