Complete reference for extending, automating, and integrating Claude Code. Work through the learning path, then explore any section.
Recommended order — click any step to jump there. Green = marked as read.
Specialized AI assistants that handle specific tasks in their own context window, returning only a summary.
| Agent | Model | Tools | Purpose |
|---|---|---|---|
| Explore | Haiku | Read-only | Codebase search. Levels: quick / medium / very thorough |
| Plan | Inherit | Read-only | Research during plan mode (prevents infinite nesting) |
| General-purpose | Inherit | All | Complex multi-step tasks needing exploration + action |
| statusline-setup | Sonnet | Read, Edit | Auto-invoked by /statusline |
| Claude Code Guide | Haiku | Web, Glob… | Auto-invoked for feature questions |
.claude/agents/ or ~/.claude/agents/| # | Location | Scope |
|---|---|---|
| 1 | Managed settings | Org-wide |
| 2 | --agents CLI flag | Session only |
| 3 | .claude/agents/ | Project (check into git!) |
| 4 | ~/.claude/agents/ | All your projects |
| 5 | Plugin agents/ | Where plugin enabled |
| Field | Req? | Values |
|---|---|---|
name | ✅ | Unique lowercase-with-hyphens |
description | ✅ | When Claude should delegate — clarity = better delegation |
tools | — | Allowlist. Omit = inherit all. Agent(name) restricts spawning |
disallowedTools | — | Denylist. Applied before tools. Tool in both = removed |
model | — | sonnet / opus / haiku / inherit / full model ID |
permissionMode | — | default / acceptEdits / auto / dontAsk / bypassPermissions / plan |
maxTurns | — | Max agentic turns |
memory | — | user / project ✓ / local |
background | — | true = always async |
isolation | — | worktree = isolated git copy |
effort | — | low / medium / high / xhigh / max |
skills | — | List of skill names, preloaded into context |
mcpServers | — | Inline or reference MCP servers |
hooks | — | PreToolUse / PostToolUse / Stop |
color | — | red/blue/green/yellow/purple/orange/pink/cyan |
initialPrompt | — | Auto first turn when run as main session agent |
| Method | Example | Guarantee |
|---|---|---|
| Auto | — | Claude decides based on description |
| Natural language | "Use the code-reviewer agent…" | Claude decides |
| @-mention | @"code-reviewer (agent)" | Forces delegation |
--agent flag | claude --agent code-reviewer | Whole session |
| settings.json | { "agent": "code-reviewer" } | Project default |
.git, .claude, .vscode, .idea, .husky still prompt.user for cross-project knowledge.Coordinate multiple Claude Code instances working together — each with its own context window, communicating directly with each other via shared task list.
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in settings.json or environment. Requires Claude Code v2.1.32+| Sub-Agents | Agent Teams | |
|---|---|---|
| Context | Own window; results return to caller | Own window; fully independent |
| Communication | Report back to main agent only | Teammates message each other directly |
| Coordination | Main agent manages all work | Shared task list with self-coordination |
| Best for | Focused tasks where only result matters | Work requiring discussion and collaboration |
| Token cost | Lower — results summarized back | Higher — each teammate is a separate Claude |
| Mode | How | Notes |
|---|---|---|
| in-process (default) | All teammates in main terminal. Shift+Down to cycle. | Works in any terminal |
| split panes | Each teammate gets own pane. Click to interact. | Requires tmux or iTerm2 |
| Event | Can Block? | Use for |
|---|---|---|
TeammateIdle | Yes (exit 2) | Keep teammate working; send feedback |
TaskCreated | Yes (exit 2) | Validate task before it's created |
TaskCompleted | Yes (exit 2) | Quality gate before marking done |
/resume / /rewind don't restore them)Connect Claude Code to external tools and services — databases, APIs, GitHub, Slack, and more — through a standardized protocol.
~/.claude/settings.json) or project servers.mcp.json — available when plugin is enabled# .mcp.json at repository root { "mcpServers": { "my-server": { "type": "stdio", "command": "npx", "args": ["-y", "@my/mcp-server"], "env": { "API_KEY": "${MY_API_KEY}" } } } }
| Type | Use when |
|---|---|
stdio | Local process; Claude spawns and communicates via stdin/stdout |
http | Remote HTTP server with MCP endpoint |
sse | Server-Sent Events streaming from remote server |
ws | WebSocket connection to remote server |
| Location | Scope | Notes |
|---|---|---|
| Managed settings | Org-wide | Always loaded; admin controlled |
~/.claude/settings.json | User | All projects |
.mcp.json (repo root) | Project | Requires one-time approval per project |
Plugin .mcp.json | Plugin scope | Loaded when plugin enabled |
Subagent mcpServers | That subagent only | Disconnects when subagent finishes |
| Category | Plugins |
|---|---|
| Source control | github, gitlab |
| Project management | atlassian, asana, linear, notion |
| Infrastructure | vercel, firebase, supabase |
| Communication | slack |
| Design | figma |
| Monitoring | sentry |
/mcp — view all servers, connection status, approve project servers.mcp.json per-server, not in settings.json env (doesn't propagate)claude --debug mcp — see server stderr if tools not showing upSelf-contained directories that extend Claude Code with skills, agents, hooks, MCP servers, LSP servers, and monitors. Share across teams or distribute via marketplaces.
Standalone (.claude/) | Plugin | |
|---|---|---|
| Skill names | /hello | /plugin-name:hello |
| Best for | Personal, project-specific, experiments | Sharing, teams, multiple projects, distribution |
| Version control | Per project | Own repo + semantic versioning |
my-plugin/ ├── .claude-plugin/ │ └── plugin.json # manifest (name, description, version) ├── skills/ │ └── my-skill/SKILL.md ├── agents/ │ └── my-agent.md ├── hooks/ │ └── hooks.json ├── .mcp.json ├── .lsp.json # language server config ├── monitors/ │ └── monitors.json # background monitors ├── bin/ # executables added to PATH └── settings.json # default settings (agent, subagentStatusLine)
{
"name": "my-plugin", # namespace for skills: /my-plugin:hello
"description": "...",
"version": "1.0.0",
"author": { "name": "..." }
}
/plugin install github@claude-plugins-official/plugin → Discover tab, or claude.com/plugins/reload-pluginsclaude --plugin-dir ./my-plugin| Command | What it does |
|---|---|
/plugin marketplace add owner/repo | Add GitHub marketplace |
/plugin marketplace add https://url | Add from URL |
/plugin marketplace update name | Refresh plugin listings |
/plugin install name@marketplace | Install a plugin |
/plugin disable name@marketplace | Disable without uninstalling |
/plugin uninstall name@marketplace | Remove plugin |
/plugin:skill slash commands. Namespace prevents conflicts.hooks/hooks.json.mcp.json.lsp.jsonmonitors/monitors.json| Language | Plugin | Required binary |
|---|---|---|
| TypeScript/JS | typescript-lsp | typescript-language-server |
| Python | pyright-lsp | pyright-langserver |
| Go | gopls-lsp | gopls |
| Rust | rust-analyzer-lsp | rust-analyzer |
| Java | jdtls-lsp | jdtls |
| C/C++ | clangd-lsp | clangd |
LSP gives Claude: auto diagnostics after every edit + code navigation (jump to def, find refs, type info)
Create SKILL.md files to add reusable instructions, workflows, and domain knowledge. Invoke with /skill-name or let Claude trigger automatically.
.claude/commands/deploy.md) = skills. Same behavior, skills add features.| Location | Path | Scope |
|---|---|---|
| Enterprise | Managed settings | All org users |
| Personal | ~/.claude/skills/name/SKILL.md | All your projects |
| Project | .claude/skills/name/SKILL.md | This project |
| Plugin | plugin/skills/name/SKILL.md | Where plugin enabled |
my-skill/ ├── SKILL.md # required — frontmatter + instructions ├── reference.md # detailed docs loaded on demand ├── examples.md # example outputs └── scripts/ └── helper.py # scripts Claude can execute
| Field | Notes |
|---|---|
name | Becomes /name. Lowercase, hyphens, max 64 chars |
description | Recommended. Claude uses this to auto-invoke. Front-load key use case. |
when_to_use | Extra triggers. Combined with description, capped at 1,536 chars. |
disable-model-invocation | true = only you can invoke (not Claude). Use for /deploy, /commit |
user-invocable | false = only Claude can invoke. Hidden from / menu. |
allowed-tools | Tools auto-approved while skill is active (no per-use prompt) |
argument-hint | Shown in autocomplete, e.g. [issue-number] |
context | fork = run in isolated subagent context |
agent | Which subagent when context: fork. Default: general-purpose |
model | Override model for this skill's turn only |
effort | Override effort level for this skill |
paths | Glob patterns — Claude auto-loads only when working with matching files |
hooks | Lifecycle hooks scoped to this skill |
| Frontmatter | You can invoke | Claude can invoke |
|---|---|---|
| (default) | Yes | Yes |
disable-model-invocation: true | Yes | No |
user-invocable: false | No | Yes |
| Variable | Value |
|---|---|
$ARGUMENTS | All text after skill name |
$ARGUMENTS[N] or $N | Nth argument (0-based) |
$name | Named arg from arguments: frontmatter list |
${CLAUDE_SESSION_ID} | Current session ID |
${CLAUDE_SKILL_DIR} | Directory containing SKILL.md |
!`command` to run shell commands — output replaces the placeholder before Claude sees anything```!ultrathink anywhere in skill content to enable extended thinkingUser-defined shell commands, HTTP endpoints, or LLM prompts that execute automatically at specific points in Claude Code's lifecycle. Automate workflows, enforce policies, validate actions.
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash", # tool name, regex, or pipe-separated list
"hooks": [
{
"type": "command",
"command": "./scripts/validate.sh",
"timeout": 60
}
]
}
]
}
}
| Location | Scope |
|---|---|
~/.claude/settings.json | All projects |
.claude/settings.json | Project (shareable) |
.claude/settings.local.json | Project (not committed) |
| Managed policy settings | Org-wide |
Plugin hooks/hooks.json | When plugin enabled |
Skill/agent frontmatter hooks: | While skill/agent active |
✋ = can block with exit code 2
| Type | Use when |
|---|---|
"command" | Shell script. Receives JSON via stdin. Exit code controls behavior. |
"http" | HTTP endpoint. 2xx = success. JSON response for control. |
"prompt" | LLM evaluation with a prompt. Slower but more flexible. |
"agent" | Spawn a subagent to evaluate. |
| Code | Meaning | Effect |
|---|---|---|
0 | Success | Parses JSON output; proceeds normally |
2 | Block | Ignores stdout; blocks action + shows stderr to Claude |
| other | Non-blocking error | Shows stderr in transcript; continues anyway |
| Value | Meaning |
|---|---|
"*", "", omitted | Match all occurrences |
Letters/digits/underscore/| | Exact match or pipe-separated list: "Edit|Write" |
| Other chars | JavaScript regex: "^Bash", "mcp__.*" |
PreToolUse + matcher "Bash" + exit 2 if command has rm -rfPostToolUse + matcher "Edit|Write" + run linterPreToolUse + validate SQL for INSERT/UPDATE/DELETE/DROPStop + send desktop notification/hooks in Claude Codeclaude --debug hooks to watch evaluation live"Edit|Write" not ["Edit","Write"]"bash") — must be capitalized: "Bash", "Edit", "Write".claude/hooks.json — no such file; use "hooks" key in settings.jsonRun Claude Code programmatically, schedule recurring tasks, and push external events into sessions.
| Cloud Routines | Desktop Tasks | /loop (Session) | |
|---|---|---|---|
| Runs on | Anthropic cloud | Your machine | Your machine |
| Requires session open | No | No | Yes |
| Local file access | No (fresh clone) | Yes | Yes |
| Min interval | 1 hour | 1 minute | 1 minute |
| Persistent | Yes | Yes | On --resume if <7 days |
| Command | Behavior |
|---|---|
/loop 5m check the deploy | Fixed schedule every 5 minutes |
/loop check the deploy | Claude picks interval dynamically each iteration |
/loop | Built-in maintenance prompt (finish work, tend PR, cleanup) |
/loop 15m | Maintenance prompt on fixed 15-min schedule |
/loop 20m /review-pr 1234 | Re-run another skill every 20 min |
| Tool | Purpose |
|---|---|
CronCreate | Schedule new task. 5-field cron expr + prompt + recurring flag. |
CronList | List all tasks with IDs, schedules, prompts |
CronDelete | Cancel a task by ID |
| Example | Meaning |
|---|---|
*/5 * * * * | Every 5 minutes |
0 * * * * | Every hour on the hour |
0 9 * * * | Every day at 9am local |
0 9 * * 1-5 | Weekdays at 9am |
30 14 15 3 * | March 15 at 2:30pm |
Fields: minute hour day-of-month month day-of-week. All times = local timezone. Max 50 tasks per session. Recurring tasks expire after 7 days.
| Pattern | Command |
|---|---|
| Basic | claude -p "What does the auth module do?" |
| Bare mode (CI) | claude --bare -p "Summarize" --allowedTools "Read" |
| JSON output | claude -p "..." --output-format json |
| Stream JSON | claude -p "..." --output-format stream-json --verbose |
| Structured output | claude -p "..." --output-format json --json-schema '...' |
| Auto-approve tools | claude -p "..." --allowedTools "Bash,Read,Edit" |
| Continue conversation | claude -p "Follow up" --continue |
| Resume by ID | claude -p "..." --resume "$session_id" |
| Custom system prompt | claude -p "..." --append-system-prompt "You are..." |
--settings, --mcp-config, --agents, --plugin-dirANTHROPIC_API_KEY or apiKeyHelper in settings JSON-p in a future release| Mode | Use in automation |
|---|---|
dontAsk | Locked-down CI — denies anything not explicitly allowed |
acceptEdits | CI that needs to write files — auto-accepts file edits + common filesystem commands |
bypassPermissions | Full automation (use carefully) |
.claude/loop.md (project) or ~/.claude/loop.md (user)/loopCLAUDE_CODE_DISABLE_CRON=1 — disables scheduler entirely. CLAUDE_CODE_DISABLE_BACKGROUND_TASKS=1 — disables background tasks.
Diagnose installation issues, configuration problems, and unexpected behavior.
| Command | Shows |
|---|---|
/doctor | Installation health, invalid settings, schema errors, plugin errors |
/context | Everything in current context window (system prompt, memory, skills, MCP tools) |
/memory | Which CLAUDE.md files loaded + auto-memory entries |
/skills | Available skills from all sources |
/agents | Configured subagents and settings |
/hooks | Active hook configurations for current session |
/mcp | Connected MCP servers, status, approval state |
/permissions | Resolved allow/deny rules currently in effect |
/status | Active settings sources, managed settings state |
| Flag | Shows |
|---|---|
claude --debug hooks | Hook evaluation live: each event, matchers checked, exit codes |
claude --debug mcp | MCP server stderr output if tools not showing up |
claude --version | Installed version |
| Symptom | Cause | Fix |
|---|---|---|
| Hook never fires | Matcher is JSON array ["Edit","Write"] | Use string: "Edit|Write" |
| Hook never fires | Lowercase tool name "bash" | Capitalize: "Bash", "Edit" |
| Hook never fires | Hooks in standalone hooks.json | Put in "hooks" key in settings.json |
| Global config ignored | Added to ~/.claude.json | Use ~/.claude/settings.json (different file!) |
| settings.json value ignored | Same key in settings.local.json | local overrides project, project overrides user |
| Skill not appearing | File at .claude/skills/name.md | Needs folder: .claude/skills/name/SKILL.md |
| Subagent ignores CLAUDE.md | Subagents don't inherit project memory | Put rules in agent file body (system prompt) |
| MCP server not loading | File under .claude/ | Project MCP goes at repo root as .mcp.json |
| MCP server fails from some dirs | Relative path in command/args | Use absolute paths for local scripts |
| MCP env vars missing | Vars in settings.json env | Set env in .mcp.json per-server section |
| Subdirectory CLAUDE.md ignored | Loads on demand only | Loads when Claude reads a file there with Read tool |
| Error | Fix |
|---|---|
command not found: claude | Add ~/.local/bin to PATH |
| Syntax error / HTML from install | Region restriction or network issue. Try Homebrew/winget. |
| Killed during install (Linux) | Low RAM. Add swap: sudo fallocate -l 2G /swapfile |
| TLS/SSL errors | Update CA certs. Set NODE_EXTRA_CA_CERTS for corporate proxy. |
| Multiple installations | Keep native ~/.local/bin/claude. Remove npm/brew duplicates. |
| 403 after login | Check subscription active. Console: need Claude Code/Developer role. |
| Model not found | Stale model ID in settings. Run /model to pick from available list. |
| File | Purpose |
|---|---|
~/.claude/settings.json | User settings (permissions, hooks, model) |
.claude/settings.json | Project settings (committed) |
.claude/settings.local.json | Local project settings (not committed) |
~/.claude.json | Global state (theme, OAuth, MCP) — NOT for hooks/permissions |
.mcp.json | Project MCP servers (at repo root) |
| Managed settings dir | Org-wide config by admins |
/compact regularly to reduce context sizeripgrep for search/agent/skills to work properly/mnt/c/) = slow search. Move project to /home//heapdump — write JS heap snapshot to Desktop for memory debugging/compact with focus, or move large-file work to subagentPush external events into a running Claude Code session from an MCP server. Requires Claude Code v2.1.80+, claude.ai login.
channelsEnabled.~/.claude/channels/telegram/.env or TELEGRAM_BOT_TOKEN env var.~/.claude/channels/discord/.env./plugin install fakechat@claude-plugins-officialclaude --channels plugin:fakechat@claude-plugins-officialhttp://localhost:8787 and type a message — arrives in your session as a <channel source="fakechat"> event/plugin install telegram@claude-plugins-official → /reload-plugins/telegram:configure <token>claude --channels plugin:telegram@claude-plugins-official/telegram:access pair <code> → /telegram:access policy allowlist/imessage:access allow +15551234567| Setting | Purpose | Default |
|---|---|---|
channelsEnabled | Master switch — must be true for any channel to work | Blocked |
allowedChannelPlugins | Which plugins can register (replaces Anthropic default list) | Anthropic default list |
channelsEnabled: true in managed settingsallowedChannelPlugins example: [{"marketplace":"claude-plugins-official","plugin":"telegram"}]allowedChannelPlugins array blocks all allowlist plugins (dev flag can still bypass)channelsEnabled unset--channels| Feature | What it does | Best for |
|---|---|---|
| Claude Code on web | Fresh cloud sandbox cloned from GitHub | Async self-contained work |
| Claude in Slack | Spawns web session from @Claude mention | Starting tasks from team chat |
| Standard MCP server | Claude queries it on-demand — nothing pushed | Read/query on-demand |
| Remote Control | You drive local session from claude.ai or mobile | Steering in-progress session |
| Channels | External events pushed into running local session | Chat bridge, webhook receiver, CI alerts |
Runtime errors Claude Code displays, what each means, and how to recover. Install errors (command not found, TLS failures) are in Troubleshooting.
CLAUDE_CODE_MAX_RETRIES (default 10) · API_TIMEOUT_MS (default 600000ms)| Error | Cause | Fix |
|---|---|---|
API Error: 500 Internal server error | Unexpected API failure — not your prompt or account | Check status.claude.com · retry · type "try again" for long prompts · run /feedback |
API Error: Repeated 529 Overloaded | API at capacity — not your usage limit, not counted against quota | Check status.claude.com · wait a few minutes · /model to switch model (capacity per-model) |
Request timed out | High load or very large response (default 10 min timeout) | Retry · break work into smaller prompts · raise API_TIMEOUT_MS |
<model> is temporarily unavailable, auto mode cannot determine safety... | Auto mode classifier overloaded — blocked action as precaution | Retry after a few seconds · reads/edits/searches still work · transient only |
| Error | Cause | Fix |
|---|---|---|
You've hit your session/weekly limit | Rolling plan quota exhausted | Wait for reset time shown · /usage · /extra-usage to buy more · upgrade plan |
Server is temporarily limiting requests | Short-lived throttle unrelated to your quota | Wait briefly · retry |
Request rejected (429) | Rate limit on API key/Bedrock/Vertex project | Run /status (check credential) · check provider console · reduce concurrency (CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY) |
Credit balance is too low | Console org prepaid credits exhausted | Add credits at platform.claude.com/settings/billing · enable auto-reload · /login for subscription auth |
| Error | Fix |
|---|---|
Not logged in · Please run /login | /login to authenticate · confirm ANTHROPIC_API_KEY is set+exported · for CI use apiKeyHelper script |
Invalid API key | Check for typos · run "env | grep ANTHROPIC" (direnv/.env may load stale key) · unset key and /login · run apiKeyHelper script directly |
This organization has been disabled | Stale ANTHROPIC_API_KEY overrides subscription. Unset the env var from shell profile, relaunch. |
OAuth token revoked/expired | /login to re-auth · if persists: /logout then /login · system clock / macOS Keychain check |
does not meet scope requirement user:profile | /login to mint new token with current scopes (no logout needed) |
| Error | Fix |
|---|---|
Unable to connect to API (ECONNREFUSED/ECONNRESET/ETIMEDOUT) | curl -I https://api.anthropic.com to test · set HTTPS_PROXY for corporate proxy · set ANTHROPIC_BASE_URL for LLM gateway · check NODE_EXTRA_CA_CERTS |
SSL certificate verification failed / Self-signed certificate | Set NODE_EXTRA_CA_CERTS=/path/to/ca-bundle.pem. Do NOT use NODE_TLS_REJECT_UNAUTHORIZED=0 |
| Error | Fix |
|---|---|
Prompt is too long | /compact · /clear · /context (see what's consuming) · disable unused MCP servers · trim CLAUDE.md files |
Error during compaction: Conversation too long | Esc×2 to go back several turns, then /compact again · or /clear (conversation preserved, reopen with /resume) |
Request too large (max 30 MB) | Esc×2, step back past the oversized content · reference large files by path instead of pasting |
Image was too large | Esc×2, step back past the image · resize (max 8000px single, 2000px many in context) · crop screenshot |
PDF too large / PDF is password protected | Read by page range instead · extract text with pdftotext · remove password and re-export |
Extra inputs are not permitted (context_management...) | Gateway strips anthropic-beta header. Configure gateway to forward it, or set CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1 |
There's an issue with the selected model | /model to pick available model · use alias (sonnet/opus) not full versioned ID |
Claude Opus not available with Pro plan | /model to pick plan-compatible model · /logout then /login if recently upgraded |
thinking.type.enabled not supported | claude update to v2.1.111+ · or switch to Opus 4.6 / Sonnet |
max_tokens must be greater than thinking.budget_tokens | Lower MAX_THINKING_TOKENS or raise CLAUDE_CODE_MAX_OUTPUT_TOKENS |
API Error: 400 due to tool use concurrency issues | /rewind (Esc×2) to step back to checkpoint before corrupted turn |
Annotated real-world files for every Claude Code extension type. Each comment explains why, not just what.
~/.claude/agents/ (user-level, all projects) or .claude/agents/ (project-level, commit to git).--- name: code-reviewer # lowercase-with-hyphens, matches filename description: Review changed files for bugs, security issues, and style # Claude reads this to decide WHEN to delegate model: sonnet # sonnet | opus | haiku | inherit | full model id tools: Read, Grep, Glob, Bash # allowlist — omit to inherit all tools permissionMode: plan # plan = read-only, never edits files memory: project # project = .claude/agent-memory/, shareable via git maxTurns: 20 # cap to avoid runaway token usage --- You are a focused code reviewer. When invoked you receive changed file paths. Steps: 1. Read each changed file in full 2. Check for: bugs, security issues (injection, auth bypass, secrets), style violations 3. Return a concise review — one finding per line, with severity (critical/warn/info) and line number Do not suggest refactors unless asked. Focus on correctness and safety only.
--- name: debugger description: Diagnose and fix errors, stack traces, and failing tests model: inherit # use whatever model the parent is using tools: Read, Edit, Bash, Grep, Glob isolation: worktree # isolated git copy — auto-cleaned if no changes made maxTurns: 40 --- You are an expert debugger. You will: 1. Reproduce the error by reading logs and running the failing command 2. Trace the root cause through the call stack 3. Apply the minimal fix — do not refactor surrounding code 4. Confirm the fix works by running the test or command again Always explain what caused the bug before showing the fix.
.claude/skills/ (project) or ~/.claude/skills/ (user). Invoke with /skill-name or reference it in a prompt.--- name: deploy description: Run the full deployment pipeline for this project disable-model-invocation: true # only YOU can trigger this — not Claude autonomously context: fork # runs in isolated subagent, keeps main context clean --- # Deploy Procedure Run these steps in order. Stop and report if any step fails. 1. `npm run build` — build production assets, check for errors 2. `npm test` — run full test suite, report failures before continuing 3. `git tag v$(date +%Y%m%d-%H%M)` — create a timestamped release tag 4. `git push origin main --tags` — push code and tag 5. Confirm the GitHub Actions CI pipeline passes (check Actions tab) Report: build status, test count passed/failed, tag name, CI link.
--- name: pr-review description: Review open pull requests and post summary comments user-invocable: false # hidden from / menu — Claude uses internally context: fork --- Use the GitHub MCP tool to: 1. List open PRs on this repo 2. For each PR: read the diff, check CI status, read existing review comments 3. Post a short review comment summarising: what changed, any risks, suggested next step Be concise. One paragraph per PR. Flag blockers clearly.
"hooks" key in ~/.claude/settings.json (user-level) or .claude/settings.json (project). NOT in a standalone hooks.json file.{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash", // fire before every Bash call
"hooks": [{
"type": "command",
// exit 2 = BLOCK the tool + send stderr to Claude as error
// exit 0 = allow | exit 1 = log but allow
"command": "bash -c 'cmd=$(echo $CLAUDE_TOOL_INPUT | jq -r .command); echo \"$cmd\" >> ~/claude-audit.log; if echo \"$cmd\" | grep -qE \"rm -rf|DROP TABLE\"; then echo \"Blocked: destructive command\" >&2; exit 2; fi'"
}]
},
{
"matcher": "Write|Edit", // pipe-separate multiple tools
"hooks": [{
"type": "command",
"command": "bash -c 'path=$(echo $CLAUDE_TOOL_INPUT | jq -r .path // .file_path); if [[ $path == *.env* ]]; then echo \"Blocked: .env file\" >&2; exit 2; fi'"
}]
}
],
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [{
"type": "command",
// auto-format every file Claude writes or edits
"command": "bash -c 'path=$(echo $CLAUDE_TOOL_INPUT | jq -r .path // .file_path); npx prettier --write \"$path\" 2>/dev/null || true'"
}]
}
],
"Stop": [
{
"hooks": [{
"type": "command",
// notify when Claude finishes a long task
"command": "osascript -e 'display notification \"Claude finished\" with title \"Claude Code\"'"
}]
}
]
}
}.mcp.json at the repository root — NOT inside .claude/. Commit to git so teammates get the same tools.{
"mcpServers": {
"github": {
"type": "stdio", // local process via stdin/stdout
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
// put tokens in env here, NOT in args (args appear in process list)
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
}
},
"playwright": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@playwright/mcp@latest"]
// no env needed — launches browser headlessly
},
"postgres": {
"type": "stdio",
"command": "/usr/local/bin/mcp-server-postgres",
// use ABSOLUTE paths for local scripts
// relative paths break when launched from different dirs
"args": ["--connection-string", "postgresql://localhost/mydb"]
},
"remote-api": {
"type": "http", // remote HTTP endpoint (no local process needed)
"url": "https://mcp.example.com/tools",
"headers": {
"Authorization": "Bearer ${MY_API_TOKEN}"
}
}
}
}plugin.json lives inside .claude-plugin/. All other content (skills/, agents/, hooks/, .mcp.json) goes at the plugin root.my-plugin/ ├── .claude-plugin/ │ └── plugin.json ← manifest lives here ├── skills/ │ └── deploy.md ← skills at plugin root level ├── agents/ │ └── reviewer.md ├── hooks/ │ └── pre-commit.sh └── .mcp.json ← MCP config at plugin root
{
"name": "my-plugin", // used for namespacing: /my-plugin:skill-name
"version": "1.0.0",
"description": "Code review + deploy tools for this monorepo",
"author": "your-team",
"minClaudeCodeVersion": "2.0.0" // optional minimum version gate
}/plugin install path/to/my-plugin or /plugin install repo@marketplace. After install, run /reload-plugins. Skills are then available as /my-plugin:deploy.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 and Claude Code v2.1.32+.{
"env": {
"CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
}
}Spawn a team to build the login feature: - One teammate writes the backend API (Node/Express, JWT auth) - One teammate writes the frontend form (React, form validation) - One teammate writes the tests (Jest + React Testing Library) Coordinate via the shared task list. Don't duplicate work. // Each teammate gets its own context + terminal // They message each other directly via shared task list // Use Shift+Down to cycle between teammate terminals (in-process mode) // Or launch with --display split-panes for tmux/iTerm2 split view
// A teammate sends a message to another teammate by name: @frontend-agent The API endpoint is POST /api/auth/login Request body: { email: string, password: string } Response: { token: string, user: { id, email, role } } Ready for you to wire up the form.
claude -p for non-interactive automation. Add --bare for reproducible CI runs (skips hooks, skills, MCP, CLAUDE.md auto-discovery).#!/bin/bash # Run Claude Code headlessly in CI to review a PR diff # --bare: reproducible, skips local config discovery # --output-format json: machine-readable result # ANTHROPIC_API_KEY must be set as a CI secret DIFF=$(git diff origin/main...HEAD) RESULT=$(claude -p \ --bare \ --output-format json \ "Review this diff for bugs and security issues. Be concise. $DIFF") # Parse result field from JSON output echo "$RESULT" | jq -r '.result' # Exit non-zero if Claude found critical issues if echo "$RESULT" | jq -r '.result' | grep -qi "critical"; then exit 1 fi
# Get schema-conformant output (Claude Code v2+) claude -p "Analyse this file and return findings" \ --output-format json \ --json-schema '{ "type": "object", "properties": { "severity": {"type": "string", "enum": ["low","medium","high","critical"]}, "findings": {"type": "array", "items": {"type": "string"}}, "safe_to_merge": {"type": "boolean"} }, "required": ["severity","findings","safe_to_merge"] }' # Continue a previous session by ID SESSION_ID=$(cat .claude-session-id) claude -p "Continue where you left off" --resume "$SESSION_ID"