Explore the .claude directory
> ## Documentation Index > Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt > Use this file to discover all available pages before exploring further.
Overview
Documentation Index
Fetch the complete documentation index at: https://code.claude.com/docs/llms.txt Use this file to discover all available pages before exploring further.
Explore the .claude directory
Where Claude Code reads CLAUDE.md, settings.json, hooks, skills, commands, subagents, rules, and auto memory. Explore the .claude directory in your project and ~/.claude in your home directory.
const A = useMemo(() => ({href, children}) => <a href={href} style={{ color: 'var(--ce-accent)', textDecoration: 'none', borderBottom: '1px dotted var(--ce-accent)' }}>{children}</a>, []); const C = useMemo(() => ({children}) => <code style={{ fontFamily: 'var(--ce-mono)', fontSize: '0.92em', padding: '1px 4px', borderRadius: '3px', background: 'var(--ce-surface)', border: '0.5px solid var(--ce-border-subtle)' }}>{children}</code>, []); const commandsNote = useMemo(() => <>Commands and skills are now the same mechanism. For new workflows, use skills/ instead: same /name invocation, plus you can bundle supporting files.</>, []); const FILE_TREE = useMemo(() => ({ project: { label: 'your-project/', children: [{ id: 'claude-md', label: 'CLAUDE.md', type: 'file', icon: 'md', color: '#6A9BCC', badge: 'committed', oneLiner: 'Project instructions Claude reads every session', when: 'Loaded into context at the start of every session', description: 'Project-specific instructions that shape how Claude works in this repository. Put your conventions, common commands, and architectural context here so Claude operates with the same assumptions your team does.', tips: ['Target under 200 lines. Longer files still load in full but may reduce adherence', <>CLAUDE.md loads into every session. If something only matters for specific tasks, move it to a skill or a path-scoped rule so it loads only when needed</>, 'List the commands you run most, like build, test, and format, so Claude knows them without you spelling them out each time', <>Run /memory to open and edit CLAUDE.md from within a session</>, <>Also works at .claude/CLAUDE.md if you prefer to keep the project root clean</>], exampleIntro: 'This example is for a TypeScript and React project. It lists the build and test commands, the framework conventions Claude should follow, and project-specific rules like export style and file layout.', example: `# Project conventions
Commands
- Build: \
npm run build\\ - Test: \
npm test\\ - Lint: \
npm run lint\\
Stack
- TypeScript with strict mode
- React 19, functional components only
Rules
- Named exports, never default exports
- Tests live next to source: \
foo.ts\\-> \foo.test.ts\\ - All API routes return \
{ data, error }\\shape, docsLink: '/en/memory' }, { id: 'mcp-json', label: '.mcp.json', type: 'file', icon: 'json', color: '#9B7BC4', badge: 'committed', oneLiner: 'Project-scoped MCP servers, shared with your team', when: <>Servers connect when the session begins. Tool schemas are deferred by default and load on demand via tool search</>, description: <>Configures Model Context Protocol (MCP) servers that give Claude access to external tools: databases, APIs, browsers, and more. This file holds the project-scoped servers your whole team uses. Personal servers you want to keep to yourself go in ~/.claude.json instead.</>, tips: [<>Use environment variable references for secrets: {'${GITHUB_TOKEN}'}</>, <>Lives at the project root, not inside .claude/</>, <>For servers only you need, run claude mcp add --scope user. This writes to ~/.claude.json instead of .mcp.json</>], exampleIntro: <>This example configures the GitHub MCP server so Claude can read issues and open pull requests. The {'${GITHUB_TOKEN}'} reference is read from your shell environment when Claude Code starts the server, so the token never lands in the file.</>, example:{ "mcpServers": { "github": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-github"], "env": { "GITHUB_TOKEN": "\${GITHUB_TOKEN}" } } } }, docsLink: '/en/mcp' }, { id: 'worktreeinclude', label: '.worktreeinclude', type: 'file', icon: 'md', color: '#8FA876', badge: 'committed', oneLiner: 'Gitignored files to copy into new worktrees', when: <>Read when Claude creates a git worktree via --worktree, the EnterWorktree tool, or subagent isolation: worktree</>, description: <>Lists gitignored files to copy from your main repository into each new worktree. Worktrees are fresh checkouts, so untracked files like .env are missing by default. Patterns here use .gitignore syntax. Only files that match a pattern and are also gitignored get copied, so tracked files are never duplicated.</>, tips: [<>Lives at the project root, not inside .claude/</>, <>Git-only: if you configure a WorktreeCreate hook for a different VCS, this file is not read. Copy files inside your hook script instead</>, <>Also applies to parallel sessions in the desktop app</>], exampleIntro: 'This example copies your local environment files and a secrets config into every worktree Claude creates. Comments start with # and blank lines are ignored, same as .gitignore.', example:# Local environment .env .env.local
API credentials
config/secrets.json, docsLink: '/en/common-workflows#copy-gitignored-files-to-worktrees' }, { id: 'dot-claude', label: '.claude/', type: 'folder', icon: 'folder', color: 'var(--ce-accent)', oneLiner: 'Project-level configuration, rules, and extensions', description: 'Everything Claude Code reads that is specific to this project. If you use git, commit most files here so your team shares them; a few, like settings.local.json, are automatically gitignored. Each file badge shows which.', children: [{ id: 'settings-json', label: 'settings.json', type: 'file', icon: 'json', color: 'var(--ce-text-3)', badge: 'committed', oneLiner: 'Permissions, hooks, and configuration', when: <>Overrides global ~/.claude/settings.json. Local settings, CLI flags, and managed settings override this</>, description: 'Settings that Claude Code applies directly. Permissions control which commands and tools Claude can use; hooks run your scripts at specific points in a session. Unlike CLAUDE.md, which Claude reads as guidance, these are enforced whether Claude follows them or not.', contains: [<>permissions: allow, deny, or prompt before Claude uses specific tools or commands</>, <>hooks: run your own scripts on events like before a tool call or after a file edit</>, <>statusLine: customize the line shown at the bottom while Claude works</>, <>model: pick a default model for this project</>, <>env: environment variables set in every session</>, <>outputStyle: select a custom system-prompt style from output-styles/</>], tips: [<>Bash permission patterns support wildcards: Bash(npm test *) matches any command starting with npm test</>, <>Array settings like permissions.allow combine across all scopes; scalar settings like model use the most specific value</>], exampleIntro: <>This example allows npm test and npm run commands without prompting, blocks rm -rf, and runs Prettier on files after Claude edits or writes them.</>, example: {
"permissions": {
"allow": [
"Bash(npm test *)",
"Bash(npm run *)"
],
"deny": [
"Bash(rm -rf *)"
]
},
"hooks": {
"PostToolUse": [{
"matcher": "Edit|Write",
"hooks": [{
"type": "command",
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
}]
}]
}
}, docsLink: '/en/settings' }, { id: 'settings-local-json', label: 'settings.local.json', type: 'file', icon: 'json', color: 'var(--ce-text-3)', badge: 'gitignored', oneLiner: 'Your personal settings overrides for this project', when: 'Highest of the user-editable settings files; CLI flags and managed settings still take precedence', description: 'Personal settings that take precedence over the project defaults. Same JSON format as settings.json, but not committed. Use this when you need different permissions or defaults than the team config.', tips: [<>Same schema as settings.json. Array settings like permissions.allow combine across scopes; scalar settings like model use the local value</>, <>Claude Code adds this file to ~/.config/git/ignore the first time it writes one. If you use a custom core.excludesFile, add the pattern there too. To share the ignore rule with your team, also add it to the project .gitignore</>], exampleIntro: 'This example adds Docker permissions on top of whatever the team settings.json allows.', example: {
"permissions": {
"allow": [
"Bash(docker *)"
]
}
}, docsLink: '/en/settings' }, { id: 'rules', label: 'rules/', type: 'folder', icon: 'folder', color: '#9B7BC4', oneLiner: 'Topic-scoped instructions, optionally gated by file paths', when: <>Rules without paths: load at session start. Rules with paths: load when a matching file enters context</>, description: [<>Project instructions split into topic files that can load conditionally based on file paths. A rule without paths: frontmatter loads at session start like CLAUDE.md; a rule with paths: loads only when Claude reads a matching file.</>, <>Like CLAUDE.md, rules are guidance Claude reads, not configuration Claude Code enforces. For guaranteed behavior use hooks or permissions.</>], tips: [<>Use paths: frontmatter with globs to scope rules to directories or file types</>, <>Subdirectories work: .claude/rules/frontend/react.md is discovered automatically</>, 'When CLAUDE.md approaches 200 lines, start splitting into rules'], docsLink: '/en/memory#organize-rules-with-claude/rules/', children: [{ id: 'rule-testing', label: 'testing.md', type: 'file', icon: 'md', color: '#9B7BC4', badge: 'committed', oneLiner: 'Test conventions scoped to test files', when: <>Loaded when Claude reads a file matching the paths: globs below</>, description: <>An example rule that only loads when Claude is working on test files. The paths: globs in the frontmatter define which files trigger it; here, anything ending in .test.ts or .test.tsx. For other files, this rule is not loaded into context.</>, example: ---
paths:
- "**/*.test.ts"
- "**/*.test.tsx"
Testing Rules
- Use descriptive test names: "should [expected] when [condition]"
- Mock external dependencies, not internal modules
- Clean up side effects in afterEach
}, { id: 'rule-api', label: 'api-design.md', type: 'file', icon: 'md', color: '#9B7BC4', badge: 'committed', oneLiner: 'API conventions scoped to backend code', when: <>Loaded when Claude reads a file matching the paths: glob below</>, description: <>A second example showing a rule scoped to backend code. The paths: glob matches files under src/api/, so these conventions load only when Claude is editing API routes.</>, example:--- paths:- "src/api/**/*.ts"
API Design Rules
- All endpoints must validate input with Zod schemas
- Return shape: { data: T } | { error: string }
- Rate limit all public endpoints
}] }, { id: 'skills', label: 'skills/', type: 'folder', icon: 'folder', color: '#D4A843', oneLiner: 'Reusable prompts you or Claude invoke by name', when: <>Invoked with /skill-name or when Claude matches the task to a skill</>, description: <>Each skill is a folder with a SKILL.md file plus any supporting files it needs. By default, both you and Claude can invoke a skill. Use frontmatter to control that: disable-model-invocation: true for user-only workflows like /deploy, or user-invocable: false to hide from the / menu while Claude can still invoke it.</>, tips: [<>Skills accept arguments: /deploy staging passes "staging" as $ARGUMENTS. Use $0, $1, and so on for positional access</>, <>The description frontmatter determines when Claude auto-invokes the skill</>, 'Bundle reference docs alongside SKILL.md. Claude knows the skill directory path and can read supporting files when you mention them'], docsLink: '/en/skills', children: [{ id: 'skill-review', label: 'security-review/', type: 'folder', icon: 'folder', color: '#D4A843', oneLiner: 'A skill bundling SKILL.md with supporting files', children: [{ id: 'skill-review-md', label: 'SKILL.md', type: 'file', icon: 'md', color: '#D4A843', badge: 'committed', oneLiner: 'Entrypoint: trigger, invocability, instructions', when: <>User types /security-review <target>; Claude cannot auto-invoke this skill</>, description: [<>This skill uses disable-model-invocation: true so only you can trigger it; Claude never invokes it on its own.</>, <>The !...` line runs a shell command and injects its output into the prompt. $ARGUMENTS substitutes whatever you typed after the skill name. Claude sees the skill