Claude Code CLI _

The complete reference — from first launch to autonomous agents.

“The real skill isn't prompting — it's specification.”


Getting Started

Works on macOS, Linux, and WSL

Install

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

Launch Commands

claude
claude "task"
claude -c
claude -c <session-id>
cat file | claude

Version Check

bash
claude --version

Layer 1: CLI Essentials

The commands you'll use every day.

Slash Commands

Command Description
/help Show all available commands
/cost Display token usage and cost for the current session
/compact Compress conversation context to save tokens
/mcp View and manage MCP server connections
/agents List available subagent types
/hooks View configured automation hooks
/plugin NEW Manage installed plugins and marketplaces
/fast NEW Toggle fast mode on Opus — same model, faster output
/review Run a code review on pending changes
/clear Clear conversation history

Keyboard Shortcuts

Command Description
Shift+Tab Cycle permission modes: normal → auto-accept → auto → plan
Esc Cancel current generation / clear input
Up Arrow Cycle through input history
/fast

Same model, faster output.

Toggles fast mode on Opus — same intelligence, faster generation. Great for iterative work where you want quick turnarounds.


Layer 2: Permission Modes

Control how much autonomy Claude has.

Default

Asks permission for file writes and commands

Use when: Learning, exploring unfamiliar code

Auto-accept Edits

Auto-approves file edits, still asks for commands

Use when: Trusted file changes, want command oversight

Auto

Runs autonomously with safety classifier

Use when: Well-scoped tasks with clear CLAUDE.md

Plan

Read-only analysis, no file modifications

Use when: Architecture review, understanding code

Bypass Permissions

--dangerously-skip-permissions

No safety checks — full autonomous execution

Use when: CI/CD, sandboxed containers only

Interactive Demo — Shift+Tab Cycling

Default Auto-accept Edits Auto Plan

Auto Mode Deep Dive

"Seatbelts, not a force field."

How It Works

A Sonnet 4.6 classifier evaluates every action before execution. Two-stage safety check: first classifies the action, then applies escalation rules for anything potentially destructive.

Launch Commands

Interactive: claude --auto Headless: claude -p "task" --auto

Availability

Available on all plans. The classifier runs alongside your main model — no additional cost.


Layer 3: CLAUDE.md

A markdown file at your project root that tells Claude everything it needs to know about your codebase. Think of it as a README for your AI pair programmer.

Where It Goes

./CLAUDE.md — Project root — checked into the repo
~/.claude/CLAUDE.md — User-level — personal preferences across projects

Template

markdown
# CLAUDE.md

## Project Overview
Brief description of what this project does.

## Tech Stack
- Framework, language, key libraries

## Build & Run
```bash
npm run dev        # Development
npm run build      # Production build
npm test           # Run tests
```

## Architecture
Key patterns, file structure conventions, data flow.

## Coding Conventions
- Style rules, naming conventions
- Import ordering, file organization

## What NOT To Do
- Anti-patterns specific to this project
- Common mistakes to avoid

Tips

Be Specific

"Use snake_case for database columns" beats "follow our conventions."

Include Constraints

List what NOT to do. Constraints prevent common AI mistakes.

Update It

Treat CLAUDE.md like living documentation. Update it when patterns change.


Layer 4: Skills

Skills are reusable prompt modules that give Claude specialized knowledge. They live as markdown files with YAML frontmatter and are auto-invoked when relevant.

Where They Live

.claude/skills/ — Project-level skills
~/.claude/skills/ — Global skills (available everywhere)

Skill File Format

yaml
---
name: my-skill
description: When and how to use this skill
---

# Skill Content

Instructions, patterns, and expertise
that Claude will follow when this skill
is auto-invoked.

Key Concepts

Auto-Invocation

Skills are automatically triggered when their description matches the current task — no manual activation needed.

Cross-Tool Compatible

Skills work across Claude Code, Copilot CLI, and Gemini CLI via platform adapters.

disable-model-invocation

Add this flag to prevent a skill from being auto-invoked. Useful for skills that should only be explicitly called.

Where to Find Skills

Official Skills Repo https://github.com/anthropics/skills
Community Skills https://github.com/hesreallyhim/awesome-claude-code

Layer 5: Superpowers Plugin

By Jesse Vincent / Prime Radiant — a complete development methodology as a plugin.

Install

bash
/plugin marketplace add obra/superpowers
bash
/plugin install superpowers@superpowers

The Workflow

Brainstorm

Explore ideas and requirements

Design Doc

Write a technical specification

Git Worktree

Isolate work in a clean branch

Plan

Break spec into implementation steps

TDD

Write tests first, then implement

Subagent Execution

Delegate tasks to parallel agents

Review

Automated code review against plan

Finalize

Clean up, commit, and prepare PR

Key Skills

brainstorming — Structured ideation before coding

writing-plans — Architecture-first design documents

test-driven-development — Red-green-refactor with Claude

subagent-driven-development — Parallel agent orchestration

requesting-code-review — Automated review against plan

finishing-a-development-branch — Clean merge preparation

The Power Combo

Auto Mode + Superpowers = safety guardrails + methodology guardrails

Auto mode keeps Claude safe. Superpowers keeps Claude disciplined. Together, they enable truly autonomous development workflows.


Layer 6: MCP Servers

Model Context Protocol lets Claude connect to external tools and data sources. Add servers via HTTP, stdio, or JSON config.

Adding a Server

HTTP Server

bash
claude mcp add --transport http my-server https://api.example.com/mcp

Stdio Server

bash
claude mcp add --transport stdio my-server -- npx my-mcp-server

JSON Config

bash
claude mcp add-json my-server '{
  "type": "stdio",
  "command": "npx",
  "args": ["my-mcp-server"],
  "env": { "API_KEY": "..." }
}'

Scopes

Scope Location Description
Local .claude/mcp.json This project only (gitignored)
Project .claude/mcp-servers.json Shared with team (committed)
User ~/.claude/mcp.json All your projects

Common Servers

GitHub

Issues, PRs, repos, code search

claude mcp add --transport stdio github -- npx @modelcontextprotocol/server-github

Filesystem

Read/write files outside project

claude mcp add --transport stdio filesystem -- npx @modelcontextprotocol/server-filesystem /path

Sequential Thinking

Structured reasoning for complex problems

claude mcp add --transport stdio thinking -- npx @modelcontextprotocol/server-sequential-thinking

Brave Search

Web search via Brave API

claude mcp add --transport stdio brave -- npx @modelcontextprotocol/server-brave-search

Context7

Up-to-date library documentation

claude mcp add --transport stdio context7 -- npx @context7/mcp-server

Playwright

Browser automation and testing

claude mcp add --transport stdio playwright -- npx @playwright/mcp-server

Managing Servers

Command Description
claude mcp list List all configured servers
claude mcp remove <name> Remove a server
/mcp View server status in REPL

Build Your Own — FastMCP

python
from fastmcp import FastMCP

mcp = FastMCP("my-tools")

@mcp.tool()
def search_docs(query: str) -> str:
    """Search project documentation."""
    # Your implementation here
    return results

mcp.run()
modelcontextprotocol.io

Hooks & Subagents

Automated guardrails and parallel specialists.

Hooks — Automated Guardrails

Shell commands that execute in response to Claude Code lifecycle events. Configure in .claude/settings.json.

Lifecycle Events

Command Description
PreToolUse Before a tool is executed
PostToolUse After a tool completes
Notification When Claude sends a notification
Stop When Claude finishes a response

Auto-format on Save

Run Prettier after every file write (file path read from stdin JSON)

json
{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Write|Edit",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write"
          }
        ]
      }
    ]
  }
}

Desktop Notification

Get notified when a long task finishes

json
{
  "hooks": {
    "Stop": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "osascript -e 'display notification \"Claude is done\" with title \"Claude Code\"'"
          }
        ]
      }
    ]
  }
}

Subagents — Specialists on Call

Claude can spawn specialized sub-agents to handle specific tasks in parallel, each with their own context and tools.

Explore

Fast read-only codebase search and file lookups

Plan

Architecture and implementation planning

general-purpose

Multi-step research and tasks across the codebase

Define custom subagent types via skills or the Agent tool with specific prompts and tool restrictions.


The Big Picture

How all the pieces fit together.

CLAUDE.md

Here's what this project is

Skills

Here's domain expertise on demand

Hooks

Here's what always happens

Superpowers

Here's the methodology to follow

Auto Mode

Here's the safety net

MCP Servers

Here's external systems to reach

Subagents

Here's specialists to delegate to


Resources

Keep learning — the essential links.

Demo Projects

Taco Tuesday App

DEMO

A live demo app built with Claude Code CLI — find tacos near you on an interactive map.

Claude Code Documentation

Official docs — commands, configuration, and guides

https://docs.anthropic.com/en/docs/claude-code
Permissions & Auto Mode

How permission modes and the safety classifier work

https://docs.anthropic.com/en/docs/claude-code/permissions
Superpowers Plugin

The open-source development methodology plugin by Jesse Vincent

https://github.com/obra/superpowers
Awesome Claude Code

Community-curated skills, hooks, plugins, and resources

https://github.com/hesreallyhim/awesome-claude-code
Official Skills Repository

Agent Skills maintained by Anthropic

https://github.com/anthropics/skills
Model Context Protocol

The open standard for AI ↔ tool communication

https://modelcontextprotocol.io
MCP Server Directory

Browse and discover available MCP servers

https://github.com/modelcontextprotocol/servers