No terms match that filter. Try clearing the search or selecting All.
Core concepts
The seven primitives that everything else in Claude Code is built from. Internalise these and the rest reads as application of pattern.
Each pass through the loop appends to the conversation history. Claude either calls more tools or emits a terminal response — the harness has no other states.
Context window
/compact, /clear, or a fresh subagent before quality degrades.Tool use
tool_use block; the harness executes it (Read, Edit, Bash, MCP servers, custom tools); a tool_result is appended to context for the next turn.
--print mode so Claude can't surprise you with a side effect.System prompt
CLAUDE.md content.
CLAUDE.md (project-specific) or ~/.claude/CLAUDE.md (personal). Keep it concrete: file paths, commands, conventions, gotchas.Slash commands
/name [args]. Built-ins handle session control (/clear, /compact, /help); custom commands live in .claude/commands/*.md (project) or ~/.claude/commands/*.md (user) and inject a prompt template into the conversation.
/review, /security-review, project-specific scaffolds, repeated prompt templates.# .claude/commands/spike.md --- description: Quick exploratory spike on a topic argument-hint: <topic> --- Spike a 30-minute exploration of: $ARGUMENTS Capture findings in scratch/SPIKE.md. Do not modify src/.
Subagents
Agent tool. Each subagent has its own context window, its own tool restrictions, and returns a single message back to the parent — nothing else leaks across the boundary. Defined in .claude/agents/*.md.
Hooks
PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, Stop, SubagentStop, and others. Hooks are executed by the harness, not by Claude — that's their power and their danger.
// .claude/settings.json { "hooks": { "PostToolUse": [{ "matcher": "Edit|Write", "hooks": [{ "type": "command", "command": "npx prettier --write \"$CLAUDE_FILE_PATHS\"" }] }] } }
Configuration & setup
Where Claude Code reads its standing instructions from, who can override whom, and how secrets stay out of the wrong files.
A higher layer fully overrides a lower one for the same key. Permissions are merged additively; an enterprise policy with defaultMode: "deny" cannot be reopened from below.
CLAUDE.md
~/.claude/CLAUDE.md. Sub-directory CLAUDE.md files are also loaded when files in that directory are read.
.env), per-task notes (just say them), or runtime state. Long CLAUDE.md files dilute the signal..claude/ directory
settings.json, commands/, agents/, hooks/, skills/, and the local-only settings.local.json. Mirror exists at ~/.claude/ for user-level equivalents.
~/.claude/..claude/ ├── settings.json # committed, team-wide ├── settings.local.json # gitignored, your overrides ├── commands/ # /custom slash commands ├── agents/ # subagent definitions ├── hooks/ # shell scripts referenced from settings └── skills/ # bundled, invokable skills
settings.json
{
"permissions": {
"allow": ["Bash(git status)", "Bash(git diff:*)", "Read"],
"deny": ["Bash(rm -rf:*)", "Bash(git push --force:*)"],
"defaultMode": "acceptEdits"
},
"env": { "NODE_ENV": "development" },
"model": "claude-opus-4-7"
}
.env file placement
.env file automatically. Conventionally .env sits at the repo root for the application itself; pass values into Claude Code's process environment via your shell, or surface specific keys via the env map in settings.json.
.env belongs in .gitignore; pair with a committed .env.example that documents the keys..claude/ or CLAUDE.md — those flow into prompts..env support — check each server's loader behaviour separately.
Permissions model
settings.json refine the defaults.
Allowed / denied tools
permissions.allow, permissions.deny, and permissions.ask that match tool calls by name and arguments. Patterns include Read, Edit, Bash(git status), Bash(npm test:*), and mcp__<server>__<tool>.
Bash(rm:*) is almost always wrong. Prefer specific commands or none.Model Context Protocol
An open standard for plugging tools, data sources, and prompts into any LLM client. The same MCP server works in Claude Code, Claude Desktop, Cursor, and beyond.
The transport layer is the only thing that meaningfully differs between local and remote MCP servers. Authentication (OAuth + DCR) is layered onto the transport for remote, network-reachable servers.
| Where it runs | Authentication | Best for | Trade-offs | |
|---|---|---|---|---|
| stdio | Local subprocess of the client | none Inherits user's machine context | Filesystem, git, sqlite, anything per-user and local | fastestsimple single-user only; client must launch the binary |
| SSE | Remote HTTP server, server → client streaming | OAuth per-user, optional | Existing SSE deployments, legacy remote servers | legacy being superseded by Streamable HTTP; long-lived connections |
| HTTP | Remote, "Streamable HTTP" — bidirectional over HTTP/POST | OAuth + DCR recommended for any non-trivial server | New remote MCP deployments, multi-user SaaS integrations | modernscales needs proper auth and TLS; more moving parts than stdio |
For new servers: pick stdio if it's a personal local tool, Streamable HTTP if it's remote and shared. Reach for SSE only when integrating with an existing deployment.
MCP server
MCP client
mcp__<server>__<tool> naming convention, and routes calls back to the server.
settings.json for Claude Code).stdio transport
# add a stdio server
claude mcp add filesystem -- npx -y @modelcontextprotocol/server-filesystem ~/work
SSE transport
text/event-stream connection; the client posts requests separately.
HTTP transport
POST and can stream responses back when needed. Replaces SSE for new deployments and pairs naturally with OAuth.
OAuth Dynamic Client Registration
Local vs remote MCP servers
Tool discovery
tools/list (and similarly resources/list, prompts/list) and receives back the catalog of capabilities, complete with JSON schemas. Claude Code uses these schemas to expose tools to the model.
Workflows & patterns
How to actually use the loop — from a single targeted edit to a refactor that touches a hundred files to a scheduled run in CI.
The pattern is fractal: a single feature rerun the same five steps, a multi-day project just nests the loop. The "approve" step is what keeps a fast loop accountable.
Three different mechanisms for three different shapes of problem. They compose — a slash command can dispatch a subagent; a hook can run before either.
Plan mode
ExitPlanMode for your approval before any write happens. Toggle into it with Shift+Tab at the prompt or --permission-mode=plan on launch.
Edit mode
acceptEdits permission mode is the common variant in which Edit / Write are auto-accepted.
Agentic coding loop
TDD with Claude
Multi-file refactors
Headless / CI usage
claude -p "…" (or --print) to get a single completion to stdout, ideal for scripts, scheduled jobs, and CI tasks like PR review.
# headless one-shot summary in CI claude -p "summarise the diff against main and flag risky changes" \ --permission-mode=plan \ --output-format=json > review.json
Integrations & surfaces
The same harness shows up in different surfaces. The reasoning model is the same; the I/O is what changes.
Claude Code in VS Code
Claude Code in JetBrains
Terminal (CLI)
claude in a project directory, get an interactive prompt; pipe input in, get headless output back. Everything else in this section is built on the same engine.
GitHub Actions
Mobile remote control
Slack integration
Context management
Steering what Claude knows, remembers, and forgets — the highest-leverage skill once you've been using Claude Code for more than a week.
Context priming
Memory files
CLAUDE.md, user ~/.claude/CLAUDE.md, and any sub-directory CLAUDE.md files when their directory is touched. Some setups also auto-load a memory directory of additional notes.
/compact
/clear
/compact is reversibly-lossy; /clear is final.Reference files
Project-level vs user-level config
.claude/, is checked into the repo, and applies to anyone working on it. User lives in ~/.claude/, is private to you, and applies across every project. The same file names, the same shape, different scope.
Plugins & marketplaces
The unit of distribution for everything else on this page. Bundle skills, slash commands, subagents, hooks, and MCP servers into one installable artifact — share it, version it, govern it.
A plugin packages any subset of {skills, commands, subagents, hooks, MCP servers} behind a single manifest. The marketplace publishes a catalog; /plugin install resolves it; /plugin enable makes it active in your sessions.
Plugin
.claude/ contents around..claude/. The plugin overhead pays off only when something is reused.Plugin marketplace
marketplace.json at .claude-plugin/marketplace.json) listing the plugins it offers and where their bundles live.
# add a marketplace, then install from it /plugin marketplace add anthropics/claude-code-plugins /plugin install code-reviewer@anthropics # or install ad-hoc from a git repo /plugin install github.com/jamesbuckett/my-plugin
.claude-plugin / plugin.json
.claude-plugin/ directory at the bundle root holds the plugin.json manifest — name, version, description, author — and the rest of the bundle (commands/, agents/, skills/, hooks.json, mcp.json) sits alongside.
plugin.json small and accurate; bump the version on every meaningful change..claude/ in your repo is simpler and doesn't need a manifest.my-plugin/ ├── .claude-plugin/ │ └── plugin.json # { "name", "version", "description" } ├── commands/ # /slash command markdown files ├── agents/ # subagent definitions ├── skills/ # SKILL.md bundles ├── hooks.json # lifecycle hook config └── mcp.json # MCP servers shipped with the plugin
.claude-plugin/ and the schema of plugin.json are still settling — check the current authoring guide.
/plugin command
claude CLI for headless contexts.
/plugin # open the interactive picker /plugin marketplace list # registered sources /plugin install <name> # install a plugin /plugin enable <name> # activate it for this scope /plugin disable <name> # keep installed but inactive
Plugin scope
~/.claude/); enablement can be scoped per project via .claude/settings.json, so a plugin you have installed only activates for repos that explicitly request it.