
Claude Code folder structure: the file system is the prompt
Two layers. Most people build one.
You've been thinking about your folder structure wrong.
Most people organize their Claude Code setup the way they organize a hard drive: put skills in one folder, docs in another, projects in a third. Filing cabinet logic. Makes sense to a human brain. But Claude doesn't browse your files the way you do. It reads CLAUDE.md and your memory files before you type a single word. By the time you open a chat, Claude already has a picture of who you are and what you do. The folder structure isn't storage. It's a standing prompt.
That reframe changes everything.
If the file system is the prompt, then every folder decision is a context decision. You're not organizing files. You're pre-programming what Claude knows, believes, and assumes about you before the conversation starts. Most people spend hours picking the right framework or debugging the right command. Almost nobody thinks carefully about what Claude already "knows" when they show up each morning.
Why your Claude Code folder structure is really a prompt
There's a name for what we're actually talking about: context engineering.
The distinction matters. Prompt engineering tells AI what to do. Context engineering tells AI who it is.
Prompts are stateless. Every session, you start from zero. Same re-introductions, same context-setting, same repetition tax on every conversation. Context engineering solves this at the architecture level, not the prompt level. You build a system that loads the right information automatically, so every session starts from a higher baseline without you lifting a finger.
The full system has five layers: CLAUDE.md, Memory, MCP, Skills, Hooks. Each layer adds a different kind of context. CLAUDE.md orients Claude at startup. Memory persists who you are across sessions. MCP connects live data sources. Skills encode repeatable workflows. Hooks automate context updates without you thinking about it.
This post is about the two most foundational layers, Memory and Skills, because that's where most setups break down. The other three are covered in the free Context Engineering Guide (20 pages, no fluff, instant access). If you want the deeper research behind why layered context beats one big prompt, I broke it down in what the context engineering research actually shows.
The two folders that matter: Skills and Memory
There are two distinct layers in a well-structured Claude Code setup.
The first is Skills. These are execution instructions. A skill says: when you're writing a LinkedIn post, follow this formula. When you're building a feature, check these constraints. When you're reviewing a draft, apply this rubric. Skills are task-level. They tell Claude what to do in a given situation. Building a library of skills is exactly the right place to start. Most people who move to Claude Code do this naturally.
The second layer is Memory. This is context about who you are, how you think, and what you care about. Pure identity, no task instructions. Memory files answer questions like: What's the voice I write in? What does my brand actually stand for? What do I already know so Claude doesn't explain it to me every time? Memory is what makes Claude feel like a sharp collaborator rather than a capable stranger.
Most people build skills and skip memory. I've worked with 85 people setting up their Second Brains. The most common gap, every single time: skill folders in place, memory layer missing. Every session, they re-explain themselves. Every prompt, they add paragraphs of context that should already be baked in. That repetition is expensive. Expensive in tokens, expensive in time, expensive in output quality. Claude works from a shallow snapshot instead of a genuine model of who you are. If you want the full build, I wrote a step-by-step on how to build a second brain in Claude Code.
What happens without the memory folder
Picture a smart contractor who shows up each day with no memory of yesterday.
You brief them every morning. You explain your preferences. You correct the same misunderstandings. You watch them get close but miss something specific about your taste or your business logic that got lost overnight. Capable, but not efficient.
Working without a memory layer feels exactly like this. Claude starts from zero. You fill in the gaps every single time.
With a memory layer, Claude shows up knowing your voice before you describe it. It knows your brand's positioning before you paste it in. It knows the context of your work without you spending the first 200 tokens of every conversation catching it up. The session starts from a higher baseline, and the output quality difference shows up in the first paragraph.
In practice, the people I work with who add a memory layer stop editing AI output for tone. They start editing for content. That shift matters.
Why the folder structure breaks down
Context degradation happens at predictable points. Claude's attention doesn't work like human memory. It has specific failure modes you can plan around.
The lost-in-middle phenomenon means information buried in long contexts gets ignored. Claude reads the start and end of your context window carefully. Everything in the middle becomes fuzzy. If you stuff your project history in paragraph 12 of a 40-paragraph context file, Claude won't use it when it matters.
Attention curves drop off fast. The 500th token gets less weight than the 50th token. The 5,000th token barely registers. Your carefully written voice guide buried deep in a massive CLAUDE.md file? Claude skims it.
Context poisoning happens when irrelevant details crowd out what matters. Include your lunch preferences and your work methodology in the same context block, and Claude treats them with equal importance. It doesn't know what to ignore.
This explains why a lean CLAUDE.md matters technically. Not just "keep it short" for readability. Actually shorter because Claude's attention is finite and you want that attention focused on what drives output quality.
Do this: Put your most critical identity information in the first 200 tokens of CLAUDE.md. Voice, constraints, core beliefs. Everything else goes in referenced files loaded on demand.
How to compress context in a long session
Long sessions need compression or they break. Here's what to compress and when.
Compress conversation history first. After 20 exchanges, the early conversation becomes noise. Summarize the key decisions and findings. Replace the full transcript with a structured summary.
Compress completed work next. Once a document is finished, you don't need Claude to remember every draft iteration. Keep the final version and the key lessons learned. Archive the working notes.
Never compress identity context. Your voice guide, brand positioning, and core constraints should never get compressed. These shape every output. Compression here degrades everything downstream.
Compaction patterns for long projects: Every 5,000 tokens, pause and consolidate. Create a "project state" file that captures current status, key decisions, and what comes next. Reference this instead of the full conversation log.
Do this: Set a session token budget. When you hit 75% of Claude's context limit, spend 10 minutes creating a clean summary document. Start the next session by loading the summary, not the full history.
How to optimize context for Claude's architecture
Context optimization goes beyond compression. Smart context engineering pre-processes information for Claude's specific architecture.
Prefix matching works because Claude caches tokens that repeat across sessions. Structure your CLAUDE.md so the first 100 tokens are identical every time. Claude's KV-cache loads this instantly. Variable information comes after the stable prefix.
Masking irrelevant context means using conditional loading. Don't load your LinkedIn voice guide when you're debugging code. Don't load technical project specs when writing marketing copy. Context switching is expensive. Selective loading is free.
KV-cache awareness changes how you structure memory files. Information Claude needs frequently should be in stable, repeated formats. Project templates, voice guides, constraint lists. These benefit from consistent structure across all files.
Thariq's prompt caching insights apply here: static first, dynamic last. Put unchanging context (identity, voice, constraints) at the beginning. Put changing context (current project, today's goals) at the end. Claude caches the static portion and only processes the dynamic portion fresh each time.
Do this: Audit your current CLAUDE.md. Move everything that changes between sessions to the bottom half of the file. Keep the top half identical across all sessions.
How to measure whether your folder structure works
Most people build elaborate context systems and never know if they work. Context engineering needs measurement.
The two-session test shows immediate impact. Take a task you do regularly. Do it once with your current context setup. Do it again with an empty session and no context files. Compare the outputs. The context-loaded session should produce better first drafts with less editing needed.
AI Context Score concept: measure reduction in explanation overhead. Count how many tokens you spend per session explaining things Claude should already know. Track this weekly. Good context engineering drives this number down over time.
Output consistency reveals context gaps. If Claude writes in different voices across sessions, your voice guide isn't working. If it misses the same constraint repeatedly, that constraint isn't reaching Claude's attention.
Session startup speed matters too. How long from opening Claude to productive output? With good context engineering, you skip the warmup period. Claude knows your context immediately.
Do this: For the next five sessions, count explanation tokens. How much context-setting do you do before Claude produces useful output? Good systems require zero explanation tokens to reach productive state.
Skills versus tools in your Claude Code setup
Most people confuse skills and tools. The distinction shapes agent effectiveness.
Tools are capabilities Claude can call: web search, file operations, API endpoints. Tools expand what Claude can do but don't encode how to do it well.
Skills are contextual instructions that tell Claude how to use tools effectively for specific outcomes. A skill might say: when researching a company, first check their recent news, then their product pages, then their team pages, in that order. Use this template for the summary.
Tools without skills create capable chaos. Claude can search the web but doesn't know what to search for or how to synthesize findings. Skills without tools create constrained brilliance. Claude knows exactly what to do but can't execute.
Effective skill design patterns: Start with the outcome you want. Work backward to the process. Build the tool calls into the process flow. Test with real examples, not hypotheticals.
Do this: For each tool in your setup, write one skill that demonstrates effective use. Don't just give Claude access to web search. Give Claude a skill that shows how to research effectively using web search.
Where CLAUDE.md fits in the folder structure
Here's a mistake I see often: a 500-line CLAUDE.md trying to hold everything.
CLAUDE.md should be under 150 lines. Its job is to orient Claude and point to the right memory files. Think of it as a table of contents, not an encyclopedia. The actual depth lives in the files it references.
This matters because Claude reads the entire CLAUDE.md on every session. If you've crammed your brand voice, skill instructions, project history, and personal preferences all in one file, you're burning context on things Claude only needs some of the time. Progressive Disclosure, one of the seven core context engineering patterns, means: load what's always needed in CLAUDE.md, load everything else on demand from referenced files.
Lean CLAUDE.md at the top. Rich memory files underneath.
If you want a head start on the CLAUDE.md itself, the Context Engineering Directory has 20 free role-specific templates: consultants, PMs, coaches, marketers, developers. Pick the closest match, edit for your context, and you're set in under 30 minutes.
What most Claude Code setups are missing
You've built skill folders covering your projects, newsletter work, marketing, everything. Good structural instinct. But here's what I'd bet is missing: a file that tells Claude who you actually are.
Not a bio. Not a resume. A working model of your voice, your reasoning patterns, and your taste.
Something like memory/style-voice/[your-name]-voice.md. In that file: how you write when you're writing as yourself. What words you use. What you avoid. What tone your brand has versus your personal voice. Whether you go long and build context or short and punchy. Whether you cite sources or speak from experience. Whether you prefer frameworks or narrative.
Add that file. Reference it from CLAUDE.md. Then ask Claude to draft something you'd normally write yourself. The gap between "good enough to edit" and "this is actually my voice" closes fast.
A 30-minute investment. The output quality difference is permanent. If you want to compare this against how other people wire up their setups, I looked at the tradeoffs in the best Claude Code productivity systems.
The project memory example
The same principle applies at the project level.
When you work on any long-running project, you probably have a spec doc or a README somewhere. That file, if structured well, is the memory layer for that project. What's the product for? Who uses it? What edge cases have you already ruled out? What decisions did you make and why?
If that .md file is thorough, you can drop into any new session and Claude has full context. No re-explanation needed. One well-structured project context file means Claude never needs to ask what you're building or why certain constraints exist.
Most people write these docs for their own reference. The smarter move is to write them for Claude's context window. Same effort, permanently different output quality.
Go deeper: free resources
The concept here connects to a broader system. A few places to go next:
The Context Engineering Guide. The full 20-page breakdown of all five layers (CLAUDE.md, Memory, MCP, Skills, Hooks) plus the seven CE patterns. If this post clicked, start here.
Context Engineering Directory. 20 free CLAUDE.md templates by profession. Skip the blank-page problem and copy a starting point built for your role.
Claude Code Mini Tutorial. 27 pages covering the full setup from scratch: memory systems, automation, MCP integrations. If you're early in the process, this is the foundation.
Second Brain Demo Recording. 60-minute walkthrough of a real Second Brain in action. You can see the folder structure, memory files, and agents working together live.
FAQ
What folder structure should a Claude Code project use?
Two layers, not one. A skills/ layer for execution instructions and a memory/ layer for identity. Skills tell Claude what to do in a given task. Memory tells Claude who you are, your voice, your brand, your constraints. Most setups have the first and skip the second, which is why they feel shallow.
Where should CLAUDE.md live?
At the root of your project, where Claude reads it on every session. Keep it under 150 lines and treat it as a table of contents that points to your memory files, not a place to dump everything. The depth lives in the referenced files, loaded on demand.
Do subfolders need their own context files?
Yes, for any long-running project. A well-structured README or spec .md inside a project folder becomes the memory layer for that project. Write it for Claude's context window, not just your own reference, and Claude drops into any session with full context.
How is this different from a normal repo layout?
A normal repo layout organizes files for humans to find. A Claude Code folder structure organizes context for the model to read before you type. The folders are not storage. They are a standing prompt, so every folder decision is a context decision.
Does folder structure change Claude's output?
Yes, directly. Claude reads CLAUDE.md and memory files at startup, so what sits in those folders shapes voice, assumptions, and quality from the first paragraph. Add a memory layer and people stop editing for tone and start editing for content. For the setup mechanics behind this, see Claude Code CLI vs desktop and the question of whether AGENTS.md and context files actually help.
What to do this week
One step.
Create memory/style-voice/[your-name]-voice.md. Spend 30 minutes writing down: how you talk, what your brand sounds like, what clichés you never use, what you believe about your work that a stranger wouldn't know. Reference it in your CLAUDE.md with one line.
Then open a new session and ask Claude to write something you'd normally write yourself. Compare the output to what you got before. The difference will be obvious.
If you want the full two-layer structure built for your specific setup, that's exactly what I help people do at iwoszapar.com/second-brain-ai. We start from your current folders, identify what's missing, and build the memory layer from scratch. Takes one session.
What does your Claude setup currently know about you that you didn't have to explain?
PS: If you've already built a voice file and it's changed how Claude writes for you, I want to hear about it. Reply and tell me what you put in it. I'm collecting these for a follow-up piece.
Related guides
Claude Code 101
A complete guide for knowledge workers getting started.
Best Claude Code productivity systems
How to turn Claude Code into repeatable work infrastructure.
Claude Code Bootcamp
Learn Claude Code live, cohort-style, with a group working through it together.
AI Second Brain for Claude Code
The built-for-you system behind these Claude Code workflows.