← Tech Guides
Tech Guide · No. 001 February 2026 Dark Folio · Reference Series

Claude Code

Anthropic's Agentic CLI for Software Development

The complete reference guide to commands, shortcuts, configuration, permissions, MCP integration, memory, subagents, hooks, skills, and best practices.

00 // Quick Reference

Cheat Sheet

Essential commands, shortcuts, and key files at a glance. Everything you need for day-to-day Claude Code usage in four compact tables.

Keyboard Shortcuts

TabToggle extended thinking mode
Shift+TabCycle permission modes (Normal / Auto-Accept / Plan)
Cmd/Ctrl+PModel picker
Ctrl+GOpen external editor
Escape / Ctrl+CCancel generation / interrupt
Ctrl+LClear screen
Shift+EnterSubmit message (after /terminal-setup)
@ + filenameReference files and MCP resources

Essential Slash Commands

/helpShow all available commands
/initInitialize project, create CLAUDE.md
/modelSwitch Claude model
/contextShow context window usage
/compactCompress conversation history
/clearClear conversation entirely
/costShow API token usage
/reviewCode review recent changes
/doctorDiagnose installation issues
/add-dirAdd directory to context
/allowed-toolsManage tool permissions
/fastToggle fast output mode

Permission Modes

NormalPrompts for every dangerous operation (default)
Auto-AcceptApproves all actions without prompting
Plan ModeRead-only, no modifications allowed
BypassSkips all checks (containers only!)

Cycle with Shift+Tab · Rules: deny → ask → allow

Key Files & Paths

CLAUDE.mdProject instructions (repo root)
~/.claude/settings.jsonGlobal user configuration
.claude/settings.jsonProject config (git-tracked)
.claude/settings.local.jsonPersonal overrides (gitignored)
.claude/skills/Custom skills directory
.claude/rules/Split CLAUDE.md into focused files
~/.claude/projects/<id>/memory/Auto-memory per project
~/.claude/keybindings.jsonCustom keyboard shortcuts

Common CLI Invocations

# Start with specific model
claude --model claude-opus-4-6

# Resume a previous session
claude --resume "session-id" "continue working on this"

# Agent mode with budget limit
claude --agent --max-budget-usd 100

# Restrict tools for safety
claude --allowedTools "Read,Write(src/**),Bash(git *)"

# Verbose logging with additional directories
claude --model opus --verbose --add-dir src/

01 // Interface

Keyboard Shortcuts & Modes

Claude Code's keybindings provide rapid access to model switching, thinking mode, permission cycling, and editor integration. Press ? in Claude Code to see shortcuts for your environment.

Complete Keyboard Shortcuts
Shortcut Action Notes
Tab Toggle extended thinking mode Sticky across sessions -- stays enabled until you toggle off
Shift+Tab Cycle permission modes Normal → Auto-Accept → Plan → Normal
Cmd/Ctrl+P Open model picker Switch between Opus, Sonnet, Haiku
Alt+P Model picker (alternate) Alias for Cmd/Ctrl+P
Ctrl+G Open external editor Compose longer prompts in your preferred editor
Escape / Ctrl+C Cancel / interrupt Stops current generation or exits
Ctrl+L Clear screen Visual clear only, does not clear context
Shift+Enter Submit message Requires /terminal-setup for iTerm2/VS Code
Alt+M Toggle permission modes Alternate for Shift+Tab
Alt+B / Alt+F Move backward / forward one word Requires Option as Meta in terminal

Customization

All keyboard shortcuts can be reconfigured in ~/.claude/keybindings.json. See the official keybindings documentation for the full configuration schema.

Interaction Modes

Claude Code operates in three primary modes, cycled via Shift+Tab:

Default

Normal Mode

Prompts for every potentially dangerous operation. Full read and write capabilities, but every file edit, command, and tool use requires explicit approval. Best for production work and unfamiliar codebases.

Speed

Auto-Accept Mode

Eliminates confirmation prompts entirely. Claude executes actions immediately without interrupting for approval. UI shows "auto-accept edit on" when active. Best for rapid prototyping and trusted environments.

Safety

Plan Mode

Read-only operations only. Prevents any modifications while allowing comprehensive analysis, code review, and architectural exploration. Perfect for exploring unfamiliar code and reviewing changes.

02 // Commands

Slash Commands

Claude Code includes 30+ slash commands for session management, project setup, context control, code review, and tool configuration. Type /help to see all available commands.

Complete Slash Commands Reference
Command Category Description
/help Core Shows all available slash commands with descriptions
/init Setup Initializes project by analyzing codebase and creating CLAUDE.md with conventions, structure, and context
/model Core Switch between Claude models -- Sonnet 4.5, Opus 4.6, Haiku 4.5
/context Context Displays colored grid showing what consumes your context window -- files, conversation, system prompts
/compact Context Compresses conversation history into a summary, starts new session with summary as context; supports custom instructions for what to preserve
/clear Context Clears conversation history entirely to start fresh and save tokens
/cost Usage Shows API token usage and spending (for API users; not relevant for Max/Pro subscribers)
/review Dev Requests code review of recent changes
/bug Dev Helps troubleshoot and fix bugs in current context
/doctor Setup Runs diagnostic checks to troubleshoot installation and configuration
/terminal-setup Setup Installs Shift+Enter key binding for iTerm2 and VS Code terminals
/add-dir Context Adds additional directories to Claude's context for monorepo or multi-repo work
/allowed-tools Permissions Manages tool permission rules; e.g., /allowed-tools add Bash(git *)
/fast Core Toggles fast mode -- same Opus 4.6 model with faster output
/resume Session Resume a previous conversation session by ID

Custom Commands

Create your own slash commands by adding markdown files to .claude/commands/ or .claude/skills/. Skills are recommended over commands as they support additional features like supporting files, subagent execution, and invocation control.

03 // Configuration

CLAUDE.md & Settings

CLAUDE.md is the single highest-impact configuration for Claude Code. Ten minutes of setup saves hours of repeated explanations every session. Combined with settings.json, it provides complete control over Claude's behavior.

Writing a CLAUDE.md file is the single highest-impact thing you can do -- just 10 minutes of setup saves hours of repeated explanations every session. -- Claude Code Best Practices

CLAUDE.md File Placement

Location Scope Use Case
~/CLAUDE.md All projects Universal preferences, personal coding style
/repo/CLAUDE.md Single repository Project-specific instructions -- check into source control for team sharing
/parent/CLAUDE.md Monorepo parent Shared context for all packages within a monorepo
.claude/rules/*.md Repository Split CLAUDE.md into focused rule files -- all auto-loaded with same priority

Important

The filename is case-sensitive -- it must be exactly CLAUDE.md (uppercase CLAUDE, lowercase .md). Claude Code looks for this specific filename when loading memory files.

CLAUDE.md Best Practices

# Project Name

## Tech Stack
- Framework: Next.js 14, React 18
- Language: TypeScript
- Styling: Tailwind CSS

## Code Conventions
- Use functional components with hooks
- Prefer named exports over default exports
- All files use 2-space indentation

## Project Structure
- /src/components -- React components
- /src/lib -- Utility functions
- /src/app -- Next.js app router pages

## Testing
- Run `npm test` before committing
- Maintain >80% coverage

## Git Workflow
- Branch naming: feature/, fix/, chore/
- Commit format: Conventional Commits

.claude Directory Structure

~/.claude/ # User-wide settings settings.json # Global configuration keybindings.json # Custom keyboard shortcuts skills/ # Personal reusable skills my-skill/ SKILL.md # Skill definition helpers/ # Supporting files projects/ <project-hash>/ memory/ MEMORY.md # Auto-generated project memory /repo/.claude/ # Project-specific settings settings.json # Shared project config (git-tracked) settings.local.json # Personal overrides (gitignored) commands/ # Custom slash commands (use skills/ instead) skills/ # Project-specific skills rules/ # Split CLAUDE.md into focused files

settings.json Examples

User Settings (~/.claude/settings.json)

{
  "model": "claude-opus-4-6",
  "maxBudgetUsd": 50,
  "permissions": {
    "allowedTools": [
      "Read",
      "Write(src/**)",
      "Bash(git *)",
      "Bash(npm *)"
    ],
    "disallowedTools": [
      "Read(.env*)",
      "Write(production.config.*)",
      "Bash(rm *)",
      "Bash(sudo *)"
    ]
  }
}

Project Settings (.claude/settings.json)

{
  "addFiles": ["src/**/*.ts", "README.md"],
  "hooks": {
    "PostToolUse": {
      "type": "command",
      "command": "prettier --write {filePath}",
      "match": { "tool": "Write" }
    }
  }
}

04 // Security

Permission System

Claude Code's permission system provides fine-grained control over what actions the agent can perform. Rules follow a deny-first evaluation order, ensuring safety while allowing flexible workflows.

Permission Modes
Mode Behavior Best For Activation
Normal Prompts for every potentially dangerous operation Production work, unfamiliar codebases Default mode
Auto-Accept All actions approved without prompting Rapid prototyping, trusted projects Shift+Tab (1x)
Plan Mode Read-only -- no file modifications allowed Code review, exploration, analysis Shift+Tab (2x)
Bypass Skips ALL permission checks CI/CD, containers, VMs only --dangerously-skip-permissions
Custom Rules Fine-grained allow/ask/deny per tool Team workflows, enterprise settings.json

Warning

Only use Bypass mode in fully isolated environments -- containers, VMs, or ephemeral CI runners where Claude cannot cause lasting damage. Never use --dangerously-skip-permissions on your development machine.

Permission Rules Syntax

Rules are evaluated in order: denyaskallow. The first matching rule wins, so deny rules always take precedence.

{
  "permissions": {
    "deny": [
      "Read(.env*)",              // Block reading .env files
      "Bash(rm *)",               // Block rm commands
      "Bash(sudo *)"              // Block sudo commands
    ],
    "ask": [
      "Write(database/**)",       // Prompt before database changes
      "Bash(npm install *)"       // Prompt before installing packages
    ],
    "allowedTools": [
      "Read",                     // Allow all reads (except denied)
      "Write(src/**)",            // Allow writes in src/ only
      "Bash(git *)",              // Allow all git commands
      "Edit"                      // Allow all edits
    ]
  }
}

Tool Name Patterns

Pattern Meaning Example
ToolName Permits every action for this tool Read -- allow all reads
ToolName(*) Permits any argument Bash(*) -- any bash command
ToolName(filter) Permits matching calls only Write(src/**) -- only src/ writes

05 // Protocol

MCP Integration

The Model Context Protocol is an open-source standard enabling Claude Code to connect to external tools, databases, and APIs. 2026 updates include MCP Tool Search (85% context reduction), OAuth 2.0 authentication, and MCP Apps.

Configuring MCP Servers

MCP servers are configured in ~/.claude/settings.json under the mcpServers key:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/dir"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "${GITHUB_TOKEN}" }
    },
    "postgres": {
      "command": "docker",
      "args": ["run", "--rm", "-i", "mcp-server-postgres"],
      "env": { "DATABASE_URL": "${DATABASE_URL}" }
    }
  }
}

Using MCP Resources

Type @ in your prompt to see available resources from all connected MCP servers. Resources appear alongside files in the autocomplete menu:

# Reference MCP resources in prompts using @
@database/users          # Query users table
@github/PR-123           # Reference GitHub PR
@notion/ProjectDocs      # Access Notion docs
2026 Feature

MCP Tool Search

Automatically activates when MCP tool descriptions exceed 10% of the context window. Dynamically loads tools on-demand instead of preloading all of them, reducing context consumption by up to 85%.

Output Management

Token Limits

Output warning threshold at 10,000 tokens, configurable default limit of 25,000 tokens. Claude Code helps manage token usage to prevent overwhelming your conversation context.

06 // Persistence

Memory & Context

Claude Code uses multiple memory layers to maintain context across sessions. Auto-memory saves patterns and preferences automatically, while CLAUDE.md provides user-defined persistent instructions.

Memory Layers
Memory Type Location Scope Purpose
Auto Memory ~/.claude/projects/<id>/memory/ Per-project Automatically saves patterns, commands, and preferences
CLAUDE.md Project root or ~/ Project or global User-defined instructions and conventions
Conversation Session only Current session Active conversation history

Auto Memory System

Context Management Commands

Command Action When to Use
/context Colored grid showing context consumption Monitor what is consuming your context window
/compact Summarize and compress conversation history Before hitting context limits (proactive is better than reactive)
/clear Clear conversation history entirely Starting a completely fresh task
/add-dir Add directory to context Working across multiple repos or packages

Pro Tip

Run /compact proactively before your context fills up -- compaction works better with headroom. You can add custom instructions to specify what to preserve during summarization.

07 // Power Features

Advanced Features

Subagents, the Task tool, hooks, background tasks, and custom skills represent Claude Code's most powerful capabilities for complex multi-step workflows and automation.

Subagents & Task Tool

Subagents enable parallel execution of up to 7 agents simultaneously, dramatically speeding up complex workflows. The Task tool coordinates work across sessions using directed acyclic graphs (DAGs).

Built-in

Explore Agent

Codebase research and understanding. Delegated to automatically when Claude needs to understand project structure.

Built-in

Plan Agent

Strategic planning and architectural decisions. Active in Plan Mode for analysis without modifications.

Built-in

General Purpose

Standard coding tasks. Spawned for independent work units with scoped directory access.

Task Tool Key Capabilities

Creating Custom Subagents

Store custom subagent definitions in .claude/skills/<agent-name>/SKILL.md:

---
name: code-reviewer
description: Specialized code review agent for security and performance
agent: true
---

# Code Review Instructions

When reviewing code:
1. Check for security vulnerabilities
2. Analyze performance implications
3. Verify test coverage
4. Ensure style guide compliance

Hooks

Hooks are user-defined shell commands that execute at specific points in Claude Code's lifecycle. They provide deterministic control -- ensuring actions always happen rather than relying on the LLM to choose them.

Hook Types
Type Description Use Case
command Runs a shell command Auto-format, lint, notifications, git operations
prompt Single-turn LLM evaluation Validation, quality checks, code review gates
agent Multi-turn agent with tool access Complex verification workflows

Common Hook Events

Example: Auto-Format on File Write

{
  "hooks": {
    "PostToolUse": {
      "type": "command",
      "command": "prettier --write {filePath}",
      "match": { "tool": "Write" }
    }
  }
}

Example: Run Tests After Code Changes

{
  "hooks": {
    "PostToolUse": {
      "type": "command",
      "command": "npm test -- {filePath}",
      "match": {
        "tool": "Write",
        "path": "src/**/*.ts"
      }
    }
  }
}

Background Tasks

Run long-running commands without blocking your workflow. Claude Code maintains process continuity across sessions.

# Start a background task
Bash(command: "npm run dev", run_in_background: true)

# Start a background subagent
Task(prompt: "Run full test suite", run_in_background: true)

# Check results later
TaskOutput(task_id)

Custom Skills

Skills are the recommended approach for reusable workflows, commands, and knowledge. They're stored in .claude/skills/ and support features that commands do not.

Skills vs Commands
Feature Skills (.claude/skills/) Commands (.claude/commands/)
YAML frontmatter Yes Yes
Supporting files Yes No
Subagent execution Yes No
Invocation control Yes No
Recommended Yes Deprecated

SKILL.md Format

---
name: api-endpoint
description: Scaffolds a new REST API endpoint with tests
invocation: manual       # or auto-load
agent: false
---

# Create API Endpoint

When invoked, follow these steps:
1. Create endpoint in src/api/endpoints/{name}.ts
2. Use template from template.ts in this skill folder
3. Add route to src/api/router.ts
4. Create tests in tests/api/{name}.test.ts
5. Update OpenAPI schema
6. Run tests to verify

Skill Discovery

08 // Command Line

CLI Flags & Options

Start Claude Code with advanced options using command-line flags. Flags can be combined for precise control over model selection, tool access, cost limits, and session management.

Complete CLI Flags Reference
Flag Category Description Example
--model Model Select Claude model claude --model claude-opus-4-6
--resume / -r Session Resume specific session by ID claude -r "abc123" "continue"
--allowedTools Permissions Allow tools without prompting claude --allowedTools "Read,Write(src/**)"
--disallowedTools Permissions Deny specific tools claude --disallowedTools "Bash(rm *)"
--tools Permissions Limit base tool set claude --tools "Read,Write,Edit"
--add-dir Context Add directory to context claude --add-dir /path/to/dir
--max-budget-usd Cost Set spending limit claude --max-budget-usd 50
--verbose Debug Enable verbose logging claude --verbose
--remote Session Start web-based session claude --remote
--agent Advanced Run as agent (enables Task tool) claude --agent
--dangerously-skip-permissions Permissions Bypass ALL permission checks Isolated environments only

Combined Examples

# Start with Opus, verbose logging, and load src/ directory
claude --model opus --verbose --add-dir src/

# Resume session with specific tools allowed
claude --resume abc123 --allowedTools "Read,Write(src/**),Bash(git *)"

# Agent mode with budget limit in a container
claude --agent --max-budget-usd 100 --dangerously-skip-permissions

09 // Mastery

Pro Tips & Best Practices

Effective prompting, workflow optimization, multi-session strategies, and security practices that separate power users from beginners. Compiled from Anthropic's official documentation and the Claude Code community.

Planning before implementation is non-negotiable. Vibe coding works for throwaway MVPs, but production code requires structured thinking, validation, and documentation. -- Claude Code Best Practices

Effective Prompting

Avoid

Make a UI for the app

Too vague -- Claude will make assumptions about everything.

Prefer

Create a Linear-style dashboard with:
- Dark mode using our existing theme tokens
- Table view with sortable columns
- Sidebar nav matching our design system

Specific context, reference designs, and clear requirements.

Use Structured Prompting

Claude excels with XML structure -- it provides more context than unstructured prompts:

<task>
  <goal>Add user authentication to API</goal>
  <requirements>
    - Use JWT tokens
    - Hash passwords with bcrypt
    - Rate limit login attempts
    - Add refresh token rotation
  </requirements>
  <constraints>
    - Follow existing auth patterns
    - Maintain backwards compatibility
  </constraints>
</task>

Workflow Optimization

Run Multiple Sessions in Parallel

Claude Code's creator (Boris Cherny) runs 5 local + 5-10 web sessions simultaneously, each with its own context and task. Use separate git worktrees to avoid conflicts:

# Terminal 1: Frontend work
cd ~/project && claude --add-dir src/components

# Terminal 2: Backend (separate worktree)
cd ~/project && git worktree add ../project-api main
cd ../project-api && claude --add-dir src/api

# Terminal 3: Testing
cd ~/project && claude --add-dir tests

Custom Commands = Time Savers

Custom commands are the #2 time saver after CLAUDE.md. Experienced developers maintain around 15 custom commands across projects.


Permission Mode Strategy

Scenario Recommended Mode
Exploring a new codebase Plan Mode (read-only)
Rapid prototyping Auto-Accept
Production changes Normal (prompt for everything)
Code review Plan Mode
CI/CD pipeline Bypass (containers only)

Cost Management

  1. Set budget limits -- use --max-budget-usd or configure in settings.json
  2. Track with /cost -- monitor spending during each session
  3. Choose the right model -- Haiku for simple tasks, Sonnet for most work, Opus for complex reasoning
  4. Compact regularly -- reduced context means reduced costs
  5. MCP Tool Search -- 2026 feature automatically reduces MCP tool context by 85%

Security Best Practices

  1. Never commit secrets -- use disallowedTools: ["Read(.env*)"] to block access to environment files
  2. Restrict dangerous commands -- block rm, sudo, and destructive git operations in your permission rules
  3. Use Plan Mode for sensitive areas -- review before modifying production configs, database schemas, or infrastructure
  4. Audit hooks -- review custom hooks for security implications before deploying
  5. Bypass mode only in isolation -- never use --dangerously-skip-permissions on a development machine

Context Window Management

  1. Monitor with /context -- check consumption regularly throughout your session
  2. Compact proactively -- run /compact before hitting limits (works better with headroom)
  3. Use targeted reads -- specify line ranges when reading large files to conserve context
  4. Reference with @ -- using @filename is more efficient than pasting content
  5. Use /add-dir carefully -- only add directories you actually need

Fastest Path to Productivity

Quick Start Workflow

1. Run /init in any new project (creates CLAUDE.md)
2. Switch to Auto-Accept mode (Shift+Tab) for rapid iteration
3. Create custom commands for repetitive tasks
4. Monitor context with /context, compact with /compact
5. Run multiple parallel sessions for complex projects