Frontend

Claude Code Guide

By zebbern4,598 stars

Claude Code Guide - Setup, Commands, workflows, agents, skills & tips-n-tricks from beginner to power user!

aiai-agentai-agent-toolsanthropic-claudeclaudeclaude-ai
Install Command
npx skills add zebbern/claude-code-guide
Open on GitHub
Supported Clients
Claude CodeCursorVS Code CopilotWindsurf

Skill Details

<div align="center"> <h2 id="claude-code-community-guide">Claude Code Guide</h2>

For reference and contributions, visit the official Claude Code documentation

Commands and provider model mappings change quickly; the linked official references remain authoritative.

Claude Code Status License

</div> <div align="center"> <kbd>
SectionStatusOther Resources
Getting StartedClaude-Code Docs
Configuration & Environment VariablesClaude-Code via Discord
Commands & UsageSecurity Agents SKILL.md
Interface & InputLet Agent Create SKILL.md
Advanced Features954+ Agent Skills
Automation & IntegrationNo cost ai resources
Help & Troubleshooting250+ Mermaid templates
Third-Party IntegrationsDiscord Communication MCP
</kbd> </div>
<h3 id="content">Contents</h3>

Fast paths: Install · Commands · Config · MCP · Agents · Troubleshoot

AreaStart hereAlso useful
Getting StartedQuick StartInitial Setup, System Requirements
ConfigurationEnvironment VariablesConfiguration Files
CommandsSlash CommandsCLI Quick Reference
InterfaceKeyboard ShortcutsVim Mode
Advanced FeaturesPlan Mode, Auto Mode, MCPSub Agents, Skills, Hooks
SecuritySecurity & PermissionsDangerous Mode, Best Practices
AutomationAutomation & ScriptingPR Review, Issue Triage
HelpTroubleshootingBest Practices, Monitoring
Third-Party IntegrationsDeepSeek IntegrationProvider Setup Examples
<details> <summary>Full content map</summary> </details>
<h1 id="getting-started">Getting Started</h1>

Enable completion alerts: run /config inside Claude Code and choose a notification channel such as Terminal bell.

<h2 id="quick-start">Quick Start</h2>

[!TIP] Run <mark>claude</mark> in a project directory to start the interface.

Go to Help & Troubleshooting to fix issues...

Native installer (recommended; no Node.js required)

macOS, Linux, or WSL:

curl -fsSL https://claude.ai/install.sh | bash

Windows PowerShell:

irm https://claude.ai/install.ps1 | iex

Windows CMD:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd

Supported package managers (manual updates by default):

brew install --cask claude-code
winget install Anthropic.ClaudeCode

npm distribution (supported; Node.js 22+ is required to install):

npm install -g @anthropic-ai/claude-code

Verify the installation, then start Claude Code:

claude --version
claude doctor
claude

Native installs update themselves. Homebrew, WinGet, and the signed apt, dnf, and apk repositories follow their package manager's update flow. See the official setup guide for channels, version pinning, Linux repository setup, and signature verification. For an npm install, upgrade with npm install -g @anthropic-ai/claude-code@latest; do not use sudo npm install -g.


[!Tip] <ins>Open Project Via Terminal Into VS Code / Cursor</ins>

$ - <kbd>cd /path/to/project</kbd>

$ - <kbd>code .</kbd>

Make sure you have the <mark>(Claude Code extension)</mark> installed in your VS Code / Cursor


<h2 id="system-requirements">System Requirements</h2>
  • OS: macOS 13+, Windows 10 1809+/Windows Server 2019+, Ubuntu 20.04+, Debian 10+, or Alpine Linux 3.19+. Native Windows, WSL 1, and WSL 2 are supported.
  • Hardware: 4 GB+ RAM and an x64 or ARM64 processor
  • Software: Git is optional on native Windows; without Git for Windows, Claude uses the PowerShell tool instead of Bash. Node.js 22+ is required only to install through npm; the installed CLI is a native binary.
  • Internet: Connection for API calls

<h2 id="initial-setup">Initial Setup</h2>

Claude Code requires a Pro, Max, Team, Enterprise, or Console account; the free Claude.ai plan does not include Claude Code. The normal first-party flow is browser sign-in:

claude auth login             # Claude subscription
claude auth login --console   # Anthropic Console/API billing
claude auth status            # Verify the active login

For API automation or a provider/gateway deployment, inject credentials from an OS key store or secret manager instead of committing them:

export ANTHROPIC_API_KEY="$SECRET_FROM_YOUR_STORE" # bash/zsh: current process only
$env:ANTHROPIC_API_KEY = $secretFromYourStore # PowerShell: current process only

[!Important] A persistent ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or credential helper selects API/provider authentication even if you are logged in. Subscription-only features such as Remote Control, cloud sessions, claude.ai MCP connectors, and notification preferences then remain unavailable. Do not commit credentials; use your platform's secret storage.


<h1 id="configuration--environment">Configuration & Environment</h1> <h2 id="environment-variables">Environment Variables</h2>

Environment values can also be stored as strings under the env key in a settings.json file. The official environment-variable reference is the exhaustive source.

[!Important] On PowerShell, use $env:NAME = "value" for the current process. Persist secrets through an OS key store or secret manager, not a checked-in settings file.

# Authentication and routing: set only when API/provider billing is intentional
export ANTHROPIC_API_KEY="$SECRET_FROM_YOUR_STORE"
export ANTHROPIC_AUTH_TOKEN="$TOKEN_FROM_YOUR_STORE"
export ANTHROPIC_BASE_URL="https://gateway.example.com"
export ANTHROPIC_CUSTOM_HEADERS="X-Trace-Id: 12345"

# Model selection and provider alias overrides
export ANTHROPIC_MODEL="sonnet"
export ANTHROPIC_DEFAULT_FABLE_MODEL="<provider-fable-model-id>"
export ANTHROPIC_DEFAULT_OPUS_MODEL="<provider-opus-model-id>"
export ANTHROPIC_DEFAULT_SONNET_MODEL="<provider-sonnet-model-id>"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="<provider-haiku-model-id>"

# Third-party provider selection (enable only one deployment path)
# export CLAUDE_CODE_USE_BEDROCK=1
# export ANTHROPIC_BEDROCK_REGION_PREFIX=eu # Prefer eu/us/apac/jp/au/global cross-region inference on Bedrock
# export CLAUDE_CODE_USE_VERTEX=1
# export CLAUDE_CODE_USE_FOUNDRY=1

# Timeouts and output budgets, in milliseconds/tokens
export API_TIMEOUT_MS=1200000
export BASH_DEFAULT_TIMEOUT_MS=120000
export BASH_MAX_TIMEOUT_MS=600000
export MCP_TIMEOUT=30000
export MCP_TOOL_TIMEOUT=60000
export MAX_MCP_OUTPUT_TOKENS=25000
export MAX_THINKING_TOKENS=0 # 0 disables fixed thinking where supported; positive values set a budget

# Session, context, agents, and accessibility
# export CLAUDE_CODE_SIMPLE=1
# export CLAUDE_CODE_SAFE_MODE=1
export CLAUDE_CODE_DISABLE_1M_CONTEXT=1 # Clamp native-1M models to 200K via autocompaction; warns if the clamp is not enforced
export CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1 # Opt out of enforcing the assumed context window for unknown model IDs
export CLAUDE_CODE_MAX_CONCURRENT_SUBAGENTS=20
export CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=3
export CLAUDE_CODE_FORWARD_SUBAGENT_TEXT=1
export CLAUDE_AX_SCREEN_READER=1

# Feature and administration controls
export CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
export CLAUDE_CODE_ADDITIONAL_DIRECTORIES_CLAUDE_MD=1
export CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY=1
export CLAUDE_CODE_PACKAGE_MANAGER_AUTO_UPDATE=1
export ENABLE_CLAUDEAI_MCP_SERVERS=false

# Network routing
export HTTP_PROXY="http://proxy.example.com:8080"
export HTTPS_PROXY="http://proxy.example.com:8080"
export NO_PROXY="localhost,127.0.0.1"

# Privacy/network reduction: these are presence-based; unset them to turn them off
export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
export DISABLE_TELEMETRY=1
export DISABLE_ERROR_REPORTING=1

The block is a catalog, not a recommended profile—do not enable mutually exclusive provider variables together. Boolean variables usually accept 1/true and 0/false, but the three presence-based variables shown at the end treat any non-empty value, including 0, as enabled. Environment values in settings.json override the shell value at startup and when the file changes.

<h2 id="global-config-options">Global Config Options</h2>

Use /config for interactive settings, or pass one or more key=value pairs. Run /config --help for the keys supported by your installed build.

/config                         # Open the settings UI
/config theme=dark model=sonnet # Update supported keys directly

For version-controlled or managed configuration, edit JSON settings files directly:

ScopeFile
User~/.claude/settings.json
Project (shared).claude/settings.json
Project (private).claude/settings.local.json
ManagedmacOS: /Library/Application Support/ClaudeCode/<br />Linux/WSL: /etc/claude-code/<br />Windows: C:\Program Files\ClaudeCode\
{
  "model": "sonnet",
  "theme": "dark",
  "autoUpdatesChannel": "stable",
  "permissions": {
    "defaultMode": "default"
  }
}

Settings precedence is managed policy → CLI arguments/--settings → local → project → user. Permission arrays have their own merge rules, so read the settings reference before relying on ordinary last-writer-wins behavior. ~/.claude.json stores global state, session/trust data, and local/user MCP configuration; it is not the user settings file.

<h2 id="configuration-files">Configuration Files</h2>

Claude Code combines human-authored instructions from several locations:

Memory TypeLocationPurposeUse Case ExamplesShared With
Enterprise policymacOS: /Library/Application Support/ClaudeCode/CLAUDE.md<br />Linux: /etc/claude-code/CLAUDE.md<br />Windows: C:\Program Files\ClaudeCode\CLAUDE.mdOrganization-wide instructions managed by IT/DevOpsCompany coding standards, security policies, compliance requirementsAll users in organization
Project memory./CLAUDE.md or ./.claude/CLAUDE.mdTeam-shared instructions for the projectProject architecture, coding standards, common workflowsTeam members via source control
User memory~/.claude/CLAUDE.mdPersonal preferences for all projectsCode styling preferences, personal tooling shortcutsJust you (all projects)
Project memory (local)./CLAUDE.local.mdPersonal project-specific preferences (git-ignored)Your sandbox URLs, preferred test data, personal overridesJust you (current project)
Project rules.claude/rules/**/*.mdModular project rules (loaded alongside CLAUDE.md)Linting rules, API conventions, path-scoped standardsTeam members via source control

Instruction files are concatenated rather than overriding one another. User and ancestor-project files load at startup; CLAUDE.md files in subdirectories load lazily when Claude works there. CLAUDE.md is context, not an enforcement boundary.

Use @path to import another file. Claude Code does not load AGENTS.md automatically; add @AGENTS.md to CLAUDE.md (or use a symlink where portable) when you want to share those instructions.

.claude/rules/ Directory

The .claude/rules/ directory lets you break project instructions into separate Markdown files instead of one large CLAUDE.md. Markdown files are discovered recursively. Add paths frontmatter with glob patterns when a rule should load only for matching files. This is useful for:

  • Modular organization: Separate concerns (e.g., api-conventions.md, testing-rules.md)
  • Per-directory overrides: Nested rules/ directories can apply scoped rules
  • Team collaboration: Different team members can own different rule files via PR review

Auto-Memory

Claude can save useful working context under ~/.claude/projects/<project>/memory/. It loads the first 200 lines or 25 KB of MEMORY.md; use /memory to inspect, edit, disable, or remove saved memories. Auto-memory is machine-local and shared across worktrees for the same repository.

Auto-memory is most useful for context you would otherwise repeat across sessions:

  • Preferred build, test, and lint commands
  • Local conventions that are not obvious from code alone
  • Architecture decisions that influence future edits
  • Team preferences that should shape how Claude proposes changes

Keep durable team rules in CLAUDE.md or .claude/rules/. Treat auto-memory as helpful working context, not as the only source of truth.


<h1 id="commands--usage">Commands & Usage</h1> <h2 id="claude-commands">Slash Command Reference</h2>

Type / to see what your installed build, plan, platform, plugins, MCP servers, and skills actually provide. The table below is a high-value snapshot; use the official command reference for the live list.

CommandPurpose
/add-dir <path>Grant this session access to another working directory
/advisor [model|off]Configure the experimental second-model advisor, save the selection, or turn it off
/agentsExplain how to create or edit subagents; the old interactive agent wizard was removed in v2.1.198
/background [prompt]Detach the current conversation as a background session (/bg alias)
/batch <instruction>Decompose a large change into worktree-isolated background units (bundled skill)
/branch [name]Switch into a new branch of the current conversation while preserving the original
/btw [question]Ask an ephemeral side question without adding it to conversation history
/cd <path>Move the current session to another working directory
/clear [name]Start a new conversation with empty context while preserving project memory
/code-review [level] [--fix] [--comment] [target]Run a local background review, or use level ultra for cloud review; levels run from low through max
/compact [instructions]Summarize the conversation to free context
/config [key=value ...]Open settings or update supported keys directly (/settings alias)
/context [all]Visualize what is using the context window
/diffOpen the interactive current/per-turn diff viewer
/doctorDiagnose setup, configuration, hooks, memory, plugins, and MCP; can offer fixes (/checkup alias)
`/effort [levelauto]`
`/fast [onoff]`
/fork [prompt]Copy this conversation into a worktree-isolated background session and keep working here
`/goal [conditionclear]`
/hooksInspect configured hooks in the read-only hook browser
`/import [codexgemini]`
/initGenerate a starter CLAUDE.md for the project
/loop [interval] [prompt]Run a prompt repeatedly while the session remains open
/mcpInspect, authenticate, enable, disable, or reconnect MCP servers
/memoryManage CLAUDE.md, rules, and auto-memory
/model [model]Switch model and normally save it as the default; press s in the picker for session-only selection
/permissionsManage allow, ask, and deny rules (/allowed-tools alias)
/plan [description]Enter plan mode, optionally with a task
/plugin [subcommand]Discover, install, enable, disable, and manage plugins
/reload-plugins [--force]Apply plugin changes without restarting when safe
/remote-control [name]Expose this local session to claude.ai/code or the Claude mobile app
/resume [session]Resume by ID/name or open the session picker
/review ...Alias for /code-review as of v2.1.223
/rewindRestore or summarize code and conversation from a checkpoint
/sandboxView and configure Bash filesystem/network sandboxing on supported platforms
/security-reviewReview the current branch diff for security vulnerabilities
/simplifyReview changed code for reuse, quality, and efficiency improvements
/subtask [prompt]Run the former in-session fork behavior as a subagent that reports back here
/tasksList the current session's background shells, subagents, and tool calls
/teleport [session]Copy a Claude Code web session into the local terminal
/usageShow subscription usage and rate-limit status
/workflowsInspect dynamic workflow runs and background orchestration
<h2 id="command-line-flags">Command Line Flags</h2>
Flag / CommandDescriptionExample
-d, --debugEnable debug mode (shows detailed debug output).claude -d -p "query"
`--include-partial-m