← Back to cipheryogi portfolio

Claude Code Capabilities

What Claude Code can do and how to steer it: built-in tools, subagents, agent teams, dynamic workflows, skills, plugins, hooks, permission modes, models, and headless and CI automation.

Built-in tools Subagents · teams · workflows Skills · plugins · hooks Permission modes Headless + CI

Companion guide: Claude Code File Structure & Configuration (where CLAUDE.md, settings, memory, MCP configuration and credentials live).

1. The Mental Model

Four layers: what Claude can do, who does the work, how you extend it, and what keeps it safe.

ToolsBuilt-in actions such as reading and editing files, running shell commands, fetching web pages and asking you questions. MCP servers add more.
AgentsThe main session can delegate to subagents, coordinate an agent team, or run a dynamic workflow that orchestrates many agents.
ExtensionsSkills add reusable instructions, hooks add deterministic automation, and plugins package skills, agents, hooks and MCP servers together.
ControlsPermission modes and rules decide what runs without asking. The sandbox adds OS-level isolation, and checkpoints let you rewind edits.

2. Capability Map

How the pieces relate inside one Claude Code session.

flowchart LR
  YOU["YOU
prompt · /commands"] --> MAIN["MAIN SESSION
model + context window"] MAIN --> TOOLS["Built-in tools
Read · Edit · Bash · WebFetch · ..."] MAIN --> MCP["MCP servers
external tools and data"] MAIN --> SK["Skills
loaded when relevant or via /name"] MAIN --> SUB["Subagents
own context · background by default"] MAIN --> TEAM["Agent team (experimental)
teammates + shared task list"] MAIN --> WF["Dynamic workflow
script orchestrates many agents"] PLUG["Plugins
packaged extensions"] -.-> SK PLUG -.-> MCP PLUG -.-> SUB PLUG -.-> HOOK HOOK["Hooks
scripts on lifecycle events"] -.-> MAIN CTRL["Permission modes · rules · sandbox"] -.-> TOOLS CTRL -.-> MCP classDef core fill:#e8f1ff,stroke:#3975c6,color:#132238; classDef agents fill:#e8f7f1,stroke:#157a5a,color:#103e31; classDef ext fill:#fff5dd,stroke:#9a6500,color:#5a3d00; classDef ctrl fill:#fff0f0,stroke:#a93636,color:#5a1d1d; class YOU,MAIN,TOOLS,MCP core; class SUB,TEAM,WF agents; class SK,PLUG,HOOK ext; class CTRL ctrl;
Session and tools Delegation Extensions Controls

3. Built-in Tools

Tool names below are the exact strings used in permission rules, subagent tool lists and hook matchers.

ToolWhat it doesNotes
Files
ReadReads files, images, PDFs and notebooksNo permission needed
EditExact string replacement in a filePermission. old_string must match exactly and be unique, or use replace_all.
WriteCreates or overwrites a filePermission. New files need no read. Overwriting follows the same read rule as Edit, and notebooks and partially read files always need the read.
NotebookEditReplaces, inserts or deletes Jupyter cellsPermission
Search
Glob · GrepFile-pattern matching and ripgrep content searchOff by default on macOS, Linux and WSL. There Claude uses find and grep through Bash. On by default on Windows. Name them in --tools or --allowedTools to bring them back.
Shell
BashRuns shell commands, including in the backgroundPermission, except a built-in read-only set. Default timeout 2 minutes, max 10. Environment variables don't persist between commands.
PowerShellNative PowerShellAutomatic on Windows without Git Bash. Opt-in on macOS, Linux and WSL (PowerShell 7+).
MonitorRuns a command in the background and feeds each output line back to ClaudePermission (uses Bash rules). Watch deadline 5 minutes by default, 30 maximum.
Web
WebFetchFetches a URL, converts it to Markdown and answers a prompt about itLossy by design (a separate model reads the page). Up to 100,000 characters per call, 15-minute cache, refuses localhost.
WebSearchReturns titles and URLsDoesn't fetch pages. 200 calls per interactive session. Not available on Amazon Bedrock.
Planning and interaction
EnterPlanMode · ExitPlanModeSwitch to plan mode, then present the plan for approvalExiting needs your approval
AskUserQuestionMultiple-choice clarifying questionsWaits until answered unless askUserQuestionTimeout is set. Not available to subagents.
TaskCreate · TaskGet · TaskList · TaskUpdateTask-tracking checklist (replaced TodoWrite)Default only on Opus 4.7, Sonnet 4.6, Haiku 4.5 and earlier models. On newer models, opt in with CLAUDE_CODE_ENABLE_TODO_TOOLS=1. Background and cloud sessions always have them.
Delegation
AgentSpawns a subagent, or a teammate when agent teams are onRenamed from Task in v2.1.63. Task(...) still works as an alias.
SendMessage · ListAgentsMessage a subagent, teammate or another local Claude Code session, and list reachable agentsAlso how a finished subagent is resumed
TaskStopStops a background task, teammate or named agentTaskOutput was removed in v2.1.277. Output files are read with Read.
WorkflowRuns a dynamic workflow scriptPermission. See section 6.
Scheduling, environment and extensions
CronCreate · CronList · CronDeleteSession-scoped recurring or one-shot prompts (behind /loop)RemoteTrigger manages cloud scheduled tasks (behind /schedule)
EnterWorktree · ExitWorktreeCreate or enter an isolated git worktree, then returnPaths outside .claude/worktrees/ prompt for approval
LSPDefinitions, references, types and diagnostics from a language serverInactive until you install a code intelligence plugin and the server binary
Skill · ToolSearchRun a skill, and load deferred (MCP) tool definitions on demandSkills don't add tool entries. They run through Skill.
Read before edit is enforced by the tool. Edit requires the file to have been read in the conversation (Opus 4.6, Haiku 4.5 and older models always). Newer models can edit an unread file when reading it wouldn't need a permission prompt. You don't need to police this yourself.

4. Subagents

A subagent runs in its own context window and returns only its result, keeping the main conversation lean.

Built-in typePurposeNotes
ExploreFast read-only codebase searchWrite and Edit denied. Thoroughness quick, medium or very thorough. Starts without CLAUDE.md or git status. One-shot (can't be resumed).
PlanRead-only research while in plan modeInherits the main model. One-shot.
general-purposeMulti-step tasks needing both exploration and actionEvery tool available to subagents
claudeCatch-all when no specialized agent fitsNo model of its own
claude-code-guideAnswers questions about Claude Code featuresRuns on Haiku
statusline-setupConfigures the status line (/statusline)Runs on Sonnet

How subagents run

Background by default

Subagents start in the background and their result is delivered when they finish. Ctrl+B backgrounds a running task. /tasks shows status and transcripts.

Fork mode

On by default (v2.1.302). In interactive sessions Claude can't wait on a subagent. Set CLAUDE_CODE_FORK_SUBAGENT=0 and restart to let it wait.

Resume

Claude continues an earlier subagent with SendMessage, using its ID or name, and keeps its full history. Explore and Plan can't be resumed.

Forks

A fork inherits the whole conversation and shares its prompt cache, so it is cheaper than a fresh subagent with the same context. Start one with /subtask <task>.

Limits

Nesting up to three layers below the main conversation (CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH). At most 20 running at once (CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS).

Never available to subagents

AskUserQuestion, EnterPlanMode, ScheduleWakeup, Workflow and a few others. ExitPlanMode only when permissionMode is plan.

Custom subagents

A subagent is a Markdown file with YAML frontmatter, and its body is the system prompt. If several definitions share a name, the higher location wins: managed settings, then the --agents CLI flag, then .claude/agents/ (project), then ~/.claude/agents/ (user), then plugins. For subagents, the project copy beats the user copy, which is the opposite of skills.

Frontmatter fieldMeaning
name · descriptionRequired. Claude delegates based on description.
tools · disallowedToolsAllowlist and denylist. If both are set, disallowedTools wins. Omit both to inherit every subagent tool.
modelsonnet, opus, haiku, fable, a full model ID, or inherit
permissionModedefault, acceptEdits, auto, dontAsk, bypassPermissions, plan
maxTurns · effortCap agentic turns, and set reasoning effort (low to max)
skills · mcpServers · hooksPreloaded skills, subagent-only MCP servers and hooks scoped to this subagent
memoryuser (~/.claude/agent-memory/<name>/), project (.claude/agent-memory/<name>/) or local (.claude/agent-memory-local/<name>/), for persistent cross-session memory
isolation · backgroundworktree gives each run a temporary git worktree. background: true keeps it in the background.
---
name: code-reviewer
description: Expert code review specialist. Use immediately after writing or modifying code.
tools: Read, Grep, Glob, Bash
model: inherit
---

You are a senior code reviewer ensuring high standards of code quality and security.

Save it as .claude/agents/code-reviewer.md, or pass a JSON definition for one session with claude --agents '{...}'. Keep descriptions short: past 15,000 tokens of combined custom descriptions, Claude Code shows a startup warning.

5. Agent Teams (Experimental)

Several full Claude Code instances that share a task list and message each other directly.

Off by default. Enable with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 in your shell or a settings env block. Teams need an interactive session: claude -p and Agent SDK runs don't spawn teammates.
1

How a team forms

  • Ask in plain language, for example "spawn three teammates to review this PR from security, performance and test angles"
  • Claude launches a teammate when it calls Agent with a name
  • There is one team per session, named session- plus 8 characters of the session ID
  • A teammate can be spawned from a custom subagent definition
2

How it coordinates

  • A shared task list (pending, in progress, completed) with dependencies. Teammates claim unblocked tasks.
  • Direct messages by name. No broadcast: one message per recipient.
  • Teammates load CLAUDE.md, MCP and skills, but not the lead's conversation
  • Teammate permission prompts appear in the lead session
3

Limits and cost

  • /resume and /rewind don't restore in-process teammates. No nested teams.
  • Shut a teammate down by asking the lead. The team config directory is removed when the session ends. The task list stays until the cleanupPeriodDays sweep.
  • Roughly 7x the tokens of a standard session when teammates plan. The docs suggest 3 to 5 teammates.
  • Display: in-process (default) or split panes with tmux or iTerm2 (teammateMode)

Quality-gate hooks: TeammateIdle, TaskCreated and TaskCompleted. Exit code 2 keeps a teammate working, or blocks creating or completing the task.

6. Dynamic Workflows

A JavaScript script that Claude writes and a runtime executes in the background, orchestrating dozens to hundreds of agents.

Subagents

A few focused tasks whose results come back to the main conversation.

Agent teams

A handful of long-running peers that need to talk to each other.

Dynamic workflows

More agents than one conversation can coordinate, or orchestration you want codified and rerunnable: codebase-wide audits, large migrations, cross-checked research, fix-until-green loops.

  • Start one by typing ultracode in a prompt or asking Claude to "use a workflow". /effort ultracode lets Claude plan workflows for every substantive task. /workflows shows runs, and s saves a run's script.
  • Saved workflows live in .claude/workflows/ or ~/.claude/workflows/ and run as /<name>. /deep-research is bundled.
  • Script API: agent(), pipeline(), parallel(), phase(), log() and args. Intermediate results stay in script variables, so Claude's context holds only the final answer.
  • Limits: 16 concurrent agents by default, 1,000 agents per run, no user input mid-run, no direct filesystem access from the script. Disable with "disableWorkflows": true.
export const meta = { name: 'audit-routes', description: 'Audit every route handler for missing auth checks' }

const found = await agent('List every .ts file under src/routes/.', {
  schema: { type: 'object', required: ['files'], properties: { files: { type: 'array', items: { type: 'string' } } } },
})
const audits = await pipeline(found.files, file =>
  agent(`Audit ${file} for missing authentication checks.`, { label: file }))
return audits.filter(Boolean)

7. Skills and Slash Commands

A skill is a SKILL.md file of instructions. Only its description sits in context until it is used.

Invocation

You run it with /skill-name, and Claude also loads it automatically when the description matches the task. disable-model-invocation: true makes it manual-only. user-invocable: false hides it from the / menu.

Locations

Personal ~/.claude/skills/<name>/SKILL.md, project .claude/skills/<name>/SKILL.md, managed directory, and plugins (/plugin:skill). On a name clash: enterprise, then personal, then project.

Commands merged into skills

.claude/commands/deploy.md and .claude/skills/deploy/SKILL.md both create /deploy. A skill beats a command file with the same name.

Useful frontmatterEffect
description · when_to_useHow Claude decides to apply it. The listing truncates at 1,536 characters, so put the key use case first.
allowed-tools · disallowed-toolsTools usable without prompts during the invoking turn, and tools removed while the skill is active
context: fork · agentRun the skill in a forked subagent (default general-purpose)
model · effort · paths · hooksPer-turn model and effort, file globs that limit auto-activation, and hooks registered on invoke

Inside the body: $ARGUMENTS, $0, $1 and so on for arguments, and !`command` to inject shell output. Keep SKILL.md under 500 lines and move detail into supporting files.

---
description: Summarizes uncommitted changes and flags anything risky. Use when the user asks what changed or wants a commit message.
---

## Current changes
!`git diff HEAD`

## Instructions
Summarize the changes above in two or three bullet points, then list any risks.

Bundled skills and key built-in commands

AreaCommands
Bundled skills/batch, /code-review (alias /review), /debug, /doctor, /loop, /run, /simplify, /verify, /claude-api. Turn them off with disableBundledSkills.
Review/code-review [level] [--fix] [--comment] for correctness bugs, /security-review for the branch diff, /ultrareview for a deep multi-agent cloud review, /simplify for cleanup (not bugs)
Project setup/init generates a CLAUDE.md. /memory edits memory files and toggles auto memory.
Context and cost/context, /compact [focus], /clear, /usage (aliases /cost, /stats), /rewind
Configuration/config, /status, /permissions, /mcp, /hooks, /skills, /plugin, /keybindings, /output-style
Scheduling/loop [interval] [prompt] and /schedule [description] (see section 13)
No built-in /commit. Commit helpers come from plugins, for example commit-commands@claude-plugins-official, or from a skill you write. Claude can also simply run git through Bash when you ask it to commit.

8. Plugins and MCP Servers

Plugins package extensions for one-command install. MCP servers connect Claude to external tools and data.

1

Plugins

  • A directory of skills, agents, hooks, MCP and LSP servers, output styles, workflows or monitors. The .claude-plugin/plugin.json manifest is optional.
  • Installed from a marketplace. Anthropic's claude-plugins-official is added on first interactive start.
  • An enabled plugin is part of every session and runs with your privileges
2

Install scopes

  • User (~/.claude/settings.json, the CLI default), project (.claude/settings.json, committed) or local (.claude/settings.local.json)
  • Local beats project, and project beats user
  • /reload-plugins applies changes to a running session
3

MCP servers

  • Add with claude mcp add and manage connections and OAuth in /mcp
  • Tool definitions are deferred by default and loaded on demand through ToolSearch
  • Verify you trust each server: servers that fetch external content can expose you to prompt injection
# In a session
/plugin marketplace add your-org/plugins#v1.2.0
/plugin install commit-commands@claude-plugins-official

# From your shell
claude plugin install formatter@your-org --scope project
claude --plugin-dir ./my-plugin      # load a local plugin for one session

# Remote MCP server (GitHub's hosted server, authenticated with a personal access token)
claude mcp add --transport http github https://api.githubcopilot.com/mcp/ \
  --header "Authorization: Bearer ${GITHUB_PAT}"

MCP scopes, .mcp.json and how to pass server credentials safely are covered in the File Structure & Configuration guide.

9. Hooks

Deterministic automation: Claude Code runs the hook itself, so it happens every time whatever the model decides.

Event groupEvents
SessionSessionStart, Setup, SessionEnd
Per turnUserPromptSubmit, UserPromptExpansion, Stop, StopFailure
Tool loopPreToolUse, PermissionRequest, PermissionDenied, PostToolUse, PostToolUseFailure, PostToolBatch
Subagents and tasksSubagentStart, SubagentStop, TaskCreated, TaskCompleted, TeammateIdle
Context and configInstructionsLoaded, ConfigChange, CwdChanged, DirectoryAdded, FileChanged
Worktrees, compaction, modelsWorktreeCreate, WorktreeRemove, PreCompact, PostCompact, PreModelSwitch, PostModelSwitch
OtherNotification, MessageDisplay, Elicitation, ElicitationResult
Five handler types

command (shell, JSON on stdin), http (POST to a URL), mcp_tool, prompt (single-turn model check) and agent (experimental subagent).

Exit codes

0 means success. 2 blocks the action on events that can block, and stderr is fed back. Any other code is a non-blocking error, so exit 1 does not block.

Matchers

Edit|Write is an exact list. Other characters make it a regex, so Edit.* also matches NotebookEdit. The if field takes a rule such as Bash(git commit *).

Block edits to protected files (PreToolUse with exit 2). .claude/hooks/protect-files.sh:

#!/bin/bash
FILE_PATH=$(jq -r '.tool_input.file_path // empty')
for pattern in ".env" "package-lock.json" ".git/"; do
  if [[ "$FILE_PATH" == *"$pattern"* ]]; then
    echo "Blocked: $FILE_PATH matches protected pattern '$pattern'" >&2
    exit 2
  fi
done
exit 0
{
  "hooks": {
    "PreToolUse": [
      { "matcher": "Edit|Write",
        "hooks": [ { "type": "command", "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/protect-files.sh" } ] }
    ]
  }
}
No "pre-commit" hook event exists. To format files Claude edits, use PostToolUse with an Edit|Write matcher. To gate commits Claude makes, use PreToolUse on Bash with "if": "Bash(git commit *)". Where hooks are stored is covered in the File Structure guide.

10. Permission Modes and Rules

The mode sets the default behaviour. Rules carve out exceptions, and deny always wins.

ModeBehaviourUse it for
autoEverything runs, with a separate classifier model reviewing actions. Read-only actions and in-directory edits skip the classifier. Broad allow rules such as Bash(*) are dropped while it is on.Built-in starting mode for interactive terminal and VS Code sessions since v2.1.283
default (Manual)Only reads run without asking. Alias manual.Careful, supervised work. Also the start mode for claude -p (v2.1.302+).
acceptEditsFile edits plus mkdir, touch, rm, rmdir, mv, cp and sed inside the working directoriesFast iteration you review afterwards
planRead-only exploration. Edits stay blocked until you approve the plan.Aligning on an approach first
dontAskDenies everything that would prompt. Actions needing no approval (reads, the read-only command set) and allow-rule matches still run. AskUserQuestion is denied even if allowed. Never in the Shift+Tab cycle.Locked-down CI
bypassPermissionsSkips prompts, but deny rules, explicit ask rules and critical-path rm checks still apply. Refused as root outside a recognized sandbox.Isolated containers and VMs only

Switching: Shift+Tab cycles modes in the CLI. Use --permission-mode <mode> at launch or permissions.defaultMode in settings. auto and bypassPermissions don't take effect from project or local settings, so set them in ~/.claude/settings.json. Admins can turn modes off with permissions.disableAutoMode and permissions.disableBypassPermissionsMode.

Permission rules

RuleMatches
Bash(git log *) vs Bash(git *)Only git log versus all git. The space matters: Bash(ls *) doesn't match lsof, but Bash(ls*) does.
Read(./.env) · Edit(src/**)Gitignore-style paths. //path is absolute, ~/path is home, /path anchors at the settings source (the project's working directory for project settings, ~/.claude/ for user settings). A Read deny also blocks Edit and Write.
WebFetch(domain:example.com)That host only. domain:*.example.com covers subdomains but not the apex.
mcp__github · mcp__github__create_issueAll of a server's tools, or one tool
Agent(Explore)A subagent type
  • Order: deny, then ask, then allow. The first match decides, and specificity doesn't change the order. A bare tool name in deny removes the tool from Claude's context.
  • Compound commands are split on &&, ||, ;, | and newlines, and every part must be allowed.
  • Bash rules are not a security boundary: Bash(rm *) doesn't stop /bin/rm or bash -c. Use the sandbox or a PreToolUse hook for real enforcement.
  • Writes to protected paths such as .git, .claude, .vscode, .mcp.json and shell rc files are never auto-approved outside bypassPermissions. Manual and acceptEdits prompt, auto sends them to the classifier, and dontAsk denies them.
{
  "permissions": {
    "allow": ["Bash(npm run *)", "Bash(git commit *)"],
    "deny":  ["Bash(git push *)", "Read(./.env)", "Read(./secrets/**)"]
  }
}

11. Sandboxing and Checkpoints

An OS-level boundary for shell commands, and an undo history for Claude's file edits.

1

Sandbox

  • Wraps Bash, PowerShell and Monitor commands and their child processes. Off by default. Enable with /sandbox or "sandbox": {"enabled": true}.
  • macOS uses Seatbelt. Linux and WSL2 need bubblewrap and socat. Native Windows is unsandboxed.
  • Writes are limited to the working directory and temp. Network goes through a proxy whose allowlist starts empty.
2

Sandbox caveats

  • Reads cover most of the machine, including ~/.ssh and ~/.aws/credentials, so protect those explicitly
  • Read, Edit, web tools, MCP servers and hooks run outside the sandbox and are governed by permission rules
  • allowUnsandboxedCommands: false removes the escape hatch
3

Checkpoints

  • Every prompt creates a checkpoint of Claude's file-tool edits. /rewind or Esc twice restores code, conversation or both.
  • Files changed only by Bash aren't tracked, and subagent edits usually aren't restored
  • Kept about 30 days. Not a replacement for Git.
{
  "sandbox": {
    "enabled": true,
    "filesystem": { "allowWrite": ["~/.kube", "/tmp/build"] },
    "network": { "allowedDomains": ["github.com", "*.npmjs.org"] }
  }
}

12. Models, Effort and Context

Pick the model by task difficulty, tune effort, and manage the context window deliberately.

AliasResolves to (Anthropic API)Use for
fable · bestFable 5.1 (claude-fable-5-1). best means Fable where available, otherwise Opus.The hardest and longest-running tasks
opusOpus 5.5 (claude-opus-5-5). Default model for Pro, Max, Team, Enterprise and the API.Complex reasoning, architecture, multi-file refactors
sonnetSonnet 5.5 (claude-sonnet-5-5)Daily coding
haikuHaiku 5.5 (claude-haiku-5-5)Simple, fast tasks and cheap subagents
opusplanOpus in plan mode, then Sonnet for executionPlanning quality at execution cost
  • Switch with /model, --model or the model setting. Admins restrict choices with availableModels. Current models run a 1M-token window natively, so the [1m] suffix matters only for Opus 4.6 and Sonnet 4.6.
  • Effort is low, medium, high, xhigh or max, set with /effort. The 5.5 models default to medium.
  • Subagent cost: set model: haiku in a simple subagent's frontmatter, or CLAUDE_CODE_SUBAGENT_MODEL as the default for subagents that don't set their own (add CLAUDE_CODE_SUBAGENT_MODEL_FORCE=1 to force it on all).
  • Context: auto-compaction runs near the window limit. Use /context to see what fills it, /compact Focus on ... to summarize with intent, and /clear between unrelated tasks, which costs nothing.
  • Cost reference: the docs report an enterprise average of about $13 per developer per active day ($150 to $250 per month). /usage shows session cost.

13. Headless, CI/CD and Automation

Run Claude Code without a person at the keyboard: scripts, pipelines, GitHub, schedules and parallel worktrees.

FlagPurpose
claude -p "..."Non-interactive run. Reads stdin and exits non-zero on failure. Starts in Manual mode, so calls that need approval are denied unless something approves them.
--bareRecommended for scripts. Skips auto-discovery of hooks, skills, plugins, MCP, memory and CLAUDE.md. Never reads OAuth or the Keychain, so set ANTHROPIC_API_KEY or pass apiKeyHelper in --settings.
--allowedTools · --tools · --permission-mode dontAskExactly what the run may do
--output-format json | stream-json · --json-schemaMachine-readable output. With a schema, the result is in structured_output, so check that it exists before use.
--max-turns · --max-budget-usdHard stops for turns and spend
claude --bare -p "Extract the main function names from auth.py" \
  --allowedTools "Read" --max-turns 3 \
  --output-format json \
  --json-schema '{"type":"object","properties":{"functions":{"type":"array","items":{"type":"string"}}},"required":["functions"]}' \
  | jq '.structured_output'
Untrusted repos in -p mode: without --bare, a -p run executes the project's settings hooks and connects its .mcp.json servers with no trust dialog or approval prompt.

GitHub Actions and GitLab

  • /install-github-app installs the Claude GitHub App, stores ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN as a repo secret, pushes a branch with the workflow file, and opens a ready-to-create pull request in your browser. It works only with github.com repositories and needs admin access.
  • anthropics/claude-code-action@v1 answers @claude mentions when there is no prompt input, and runs in automation mode on any event (including schedule) when prompt is set. Pass CLI flags through claude_args.
  • GitLab CI/CD support is in beta and maintained by GitLab. A job runs claude -p with ANTHROPIC_API_KEY as a masked variable.
name: Claude Code
on:
  issue_comment: { types: [created] }
  pull_request_review_comment: { types: [created] }
jobs:
  claude:
    if: contains(github.event.comment.body, '@claude')
    runs-on: ubuntu-latest
    permissions: { contents: write, pull-requests: write, issues: write, id-token: write, actions: read }
    steps:
      - uses: actions/checkout@v6
        with: { fetch-depth: 1 }
      - uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          claude_args: "--max-turns 5"

Scheduling and parallel work

OptionRuns whereKey facts
/loop 5m <prompt>Your open session1-minute minimum. Fires only while the session is open and idle. Recurring tasks expire after 7 days. Without an interval, Claude picks its own pace.
/schedule daily PR review at 9amAnthropic cloudResearch preview. No machine needed, fresh clone per run, 1-hour minimum, triggers by schedule, API or GitHub events.
claude --worktree <name>Your machineCreates .claude/worktrees/<name>/ on a new branch, for parallel sessions. .worktreeinclude copies gitignored files such as .env. Subagents use isolation: worktree.

14. Security and Monitoring

Safeguards built into Claude Code, plus the practices that close the remaining gaps.

PracticeHow
Never commit secretsReference variables instead of literals, and deny reads of secret files with Read(./.env) rules. The File Structure guide shows the full pattern.
Choose the permission mode deliberatelyInteractive sessions start in auto. For Manual, set permissions.defaultMode: "default". Reserve bypassPermissions for isolated containers.
Use real boundaries for real riskEnable the sandbox and use PreToolUse hooks. Bash permission rules and CLAUDE.md text are not security controls.
Trust MCP servers explicitlyApprove .mcp.json servers deliberately. For production data, use least-privilege, read-only credentials (a recommended practice, not a platform rule).
Review before you pushAsk Claude to show the diff before any push, and keep git push behind an ask or deny rule if you want a hard stop.
Audit beyond GitGit doesn't capture what Bash changed outside the repo. Use OpenTelemetry and ConfigChange hooks for audit trails.
Built-in safeguards

Workspace trust dialog, separate .mcp.json approval, curl and wget not auto-approved, command-injection detection, fail-closed matching, and credentials in the Keychain or a 0600 file.

OpenTelemetry

Enable with CLAUDE_CODE_ENABLE_TELEMETRY=1 plus OTEL_METRICS_EXPORTER and OTEL_LOGS_EXPORTER. Metrics include session count, cost, tokens and lines of code.

Privacy defaults

Prompts, responses and tool details are not logged unless enabled. OTel variables in a repo's settings are ignored, so admins deploy telemetry through managed settings.

15. Working Practices

Prompt patterns and session habits that keep results accurate on large codebases.

Prompt patternExampleWhy it works
Constraint-first"Using our AuthMiddleware and the repository pattern, add a DELETE endpoint for users."Stops Claude inventing its own patterns
Reference-driven"Follow the pattern in src/routes/orders.ts to create a route for invoices."Claude reads the reference and mirrors its style
Plan-then-executeStart in plan mode, or prefix the prompt with /planAlignment before any code is written
Scope-bounded"Only modify files in src/auth/."Prevents side effects. Back it with Edit allow and deny rules if it must hold.
Test-anchored"Write the tests first, then implement until they pass."Gives Claude a verifiable target
SituationWhat to do
New task in a different area/clear for a clean context. Use /rename first if you'll want to come back with /resume.
Continue yesterday's workclaude --continue, claude --resume, or /resume inside a session. To branch instead, use claude --continue --fork-session or /branch.
Very large fileAsk Claude to read it in slices. The Read tool takes an offset and a line limit.
Open a pull requestAsk Claude to create it. It runs gh pr create through Bash and drafts the title, description and test plan.
Review a pull request/code-review <pr#>, add --comment to post inline comments, or give Claude the PR URL to fetch and analyze
CI is failingPoint Claude at the failure log and let it fix and re-run iteratively, or ask for a /loop that watches CI and addresses failures
Went down the wrong path/rewind to restore code, conversation or both
Context filling up/context, then /compact Focus on .... Delegate verbose work, such as log reading or broad search, to subagents.
MonorepoNested CLAUDE.md files load on demand. Use path-scoped rules and claudeMdExcludes to skip other teams' files.
Slow builds or testsRun them in the background (run_in_background) or watch them with Monitor while work continues
Parallel featuresclaude --worktree per feature, or subagents with isolation: worktree
Standards across many reposA managed CLAUDE.md, rules shared through symlinks, or a plugin from an internal marketplace. CLAUDE.md files concatenate, they don't override.

16. Anti-Patterns to Avoid

Common mistakes and what to do instead.

Anti-patternWhy it hurtsDo this instead
Vague prompts ("fix the bug")Claude spends context exploring blindly"The login API returns 401 with a valid token. Check src/auth/verify.ts."
Relying on CLAUDE.md for must-hold rulesIt is guidance, not enforcementPermission deny rules or a PreToolUse hook
A bloated CLAUDE.mdIt loads in full every sessionKeep it under 200 lines. Move workflow-specific content into skills.
Using bypassPermissions on your laptopNo prompts, no classifierauto or Manual. Bypass only in isolated containers.
Assuming dontAsk means "approve everything"It denies anything not pre-approvedUse it only for CI, with explicit --allowedTools
Treating Bash deny rules as a security boundary/bin/rm or bash -c bypasses themEnable the sandbox and add hooks
Treating checkpoints as version controlBash changes aren't tracked, and snapshots expireCommit to Git
One giant session for everythingStale context costs tokens on every message/clear between unrelated tasks
Skipping plan mode on big changesMisaligned implementation means wasted effortPlan first, implement after approval
Doing broad research in the main threadThe main context fills with file dumpsParallel Explore subagents, or a workflow for very large sweeps
Hard-coding tokens in a shared .mcp.jsonSecrets end up in Git${VAR} expansion, OAuth or headersHelper

17. Quick Decision Guide

When you want something done, start here.

Understand code

"How does the auth flow work?"

Just ask. Claude reads and searches directly. For a broad sweep, ask it to use Explore subagents in parallel.

Delegate

"Refactor all API routes to the new middleware."

A general-purpose or custom subagent through the Agent tool. For hundreds of files, a dynamic workflow.

Collaborate

"I want several agents to debate competing hypotheses."

An agent team. Enable CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, then ask Claude to spawn teammates.

Repeat a procedure

"We run the same release checklist every week."

Write a skill in .claude/skills/release/SKILL.md and run it with /release.

Always happen

"Every edited file must be formatted."

A PostToolUse hook on Edit|Write.

Never happen

"Claude must never push or read .env."

Deny rules: Bash(git push *) and Read(./.env). Add the sandbox for OS-level protection.

Track progress

"Show me a checklist as you work."

The Task tools (TaskCreate and the rest). On newer models, enable them with CLAUDE_CODE_ENABLE_TODO_TOOLS=1.

Automate

"Review every PR automatically."

anthropics/claude-code-action@v1 via /install-github-app, or a /schedule cloud task.

Script it

"Call Claude from a pipeline and parse the result."

claude --bare -p with --output-format json and --json-schema.