Anatomy of the .claude/ folder
TL;DR Highlight
Knowing the .claude folder layout lets you configure Claude Code to your team's rules.
Who Should Read
A developer using Claude Code who treats the .claude folder as a black box and wants to configure it for the team
Core Mechanics
- There are two folders
- The project .claude/ is committed to git so the team shares the same rules, commands, and permissions.
- The home ~/.claude/ holds personal settings, session history, and auto-memory.
- CLAUDE.md matters most
- Claude reads it first at session start and loads it into the system prompt.
- The article says to keep it under 200 lines, since longer files eat context and instruction adherence drops.
- Write build/test commands, architecture decisions, and gotchas, not linter rules or theory.
- Split instructions into rules/
- Every markdown file in .claude/rules/ loads automatically alongside CLAUDE.md.
- YAML frontmatter paths makes a rule apply only when working on matching files.
- Rules without paths load unconditionally every session.
- Commands inject shell output into prompts
- Each markdown file in .claude/commands/ becomes a slash command named after the file.
- The !`git diff ...` syntax runs the shell and embeds the output in the prompt.
- $ARGUMENTS passes text after the command name.
- Skills are invoked by Claude itself
- Claude calls a skill on its own when the description matches the task, while commands wait for you.
- A skill is a subfolder with SKILL.md plus supporting files.
- Agents are isolated subagents
- Each markdown file in .claude/agents/ sets its own system prompt, tools, and model.
- It works in a separate context window and reports back a summary.
- The article suggests cheaper models like Haiku for read-only exploration.
- settings.json controls permissions
- allow runs without confirmation and deny blocks outright.
- Anything in neither list makes Claude ask first.
- rm -rf, curl, and reading .env are the example denies.
Community Reactions
- Opinion that the structure is outdated
- A commenter noted Commands have been merged into Skills.
- They quoted the official docs saying .claude/commands/deploy.md and skills/deploy/SKILL.md both create /deploy.
- So the article's command/skill split is dated.
- Many reported that shorter config works better
- Several commenters got the best results with the fewest skills and minimal config.
- One observed quality dropping as instructions grew.
- Another advised separating planning from implementation and clearing context in between.
- Pushback that CLAUDE.md is a suggestion, not a contract
- One commenter said complex tasks and compaction dilute CLAUDE.md's influence.
- Another said that if Claude edits CLAUDE.md itself, you must tell it to re-read the file.
- Extra tip about ~/.claude/plans
- A commenter said plan-mode markdown files are stored there.
- They find it useful to open or back up plans.
How to Apply
- Trim CLAUDE.md to 50 lines or fewer
- Delete linter-enforced rules and long explanations from your CLAUDE.md.
- Keep only build/test commands and gotchas.
- If you have none, run /init in Claude Code to generate a draft.
- Add deny rules to settings.json
- In .claude/settings.json, put run commands like npm run * in allow.
- Put Read(./.env), Bash(rm -rf *), and Bash(curl *) in deny.
- Split a growing CLAUDE.md into rules/
- Break it up by concern into files like code-style.md and testing.md.
- Add a paths frontmatter to rules that only apply to some files, like API rules.
- Wrap a repeated task in one command
- Turn frequent work like code review or issue fixing into a markdown file in .claude/commands/.
- Embed shell output like !`git diff` so you stop pasting it by hand.
Try It
# Save as .claude/commands/review.md to use it as a command in Claude Code (example from the article)
---
description: Review the current branch diff for issues before merging
---
## Changes to Review
!`git diff --name-only main...HEAD`
## Detailed Diff
!`git diff main...HEAD`
Review the above changes for:
1. Code quality issues
2. Security vulnerabilities
3. Missing test coverage
4. Performance concerns
Give specific, actionable feedback per file.Terminology
Related Papers
Frostbite: A new CPU architecture discovered, designed and verified by AI
AI agents designed a CPU from scratch, claiming 4.59x perf/W over a traditional core
Restricting AI agents in mobile operating systems platforms from capturing data
Signal now blocks OS-level AI agents from reading its screen on iOS 27 and Android
Actions Speak Louder than Words: Stateful Privacy Sniffing of LLM Agents via Behavioral Covert Channels in Web Interactions
Agents' link choices alone let attackers rebuild user queries at F1 0.89; SOR cuts it to 0.39.
Tracking and Limiting Unsupported Claim Propagation in Multi-Agent LLM Systems: A Provenance-Aware Framework
Passing claims with source, evidence and history kept equivalence at 5 agent stages at 96% versus 31%.
LLM assisted reverse engineering
Pointing an agent at binaries with skills and MD notes made years-long hacks feasible
Metrics-in-the-Loop: Complexity Feedback Reshapes Agent-Written Code
Injecting per-turn complexity reports into coding agents cut code erosion without changing correctness
Why is Gemini 4 Carbon taking so long?
Carbon took nearly an hour on bug fixes that Astra and Opus finished in minutes, mostly from extra unrequested work.
Weight-Space Programming builds neural networks like a 1990s researcher
LLM hand-wrote MNIST weights to 91.3%, using 1990s-style techniques