Claude Code

Claude Code is Anthropic’s official CLI for Claude. It runs in your terminal and acts as an AI coding agent — reading, editing, and running code in your project with your approval.

Installation

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

Starting a session

claude          # interactive session in current directory
claude "fix the failing tests"   # one-shot command

Key concepts

CLAUDE.md — project instructions file read at session start. Place one in the repo root to give Claude persistent context about the codebase, conventions, and commands.

Brain files — extended context documents (e.g. in brain/) referenced from CLAUDE.md with architecture, commands, and content guides.

MCP servers — Model Context Protocol servers extend Claude Code with external tools. Configure them in ~/.claude/mcp.json.

Skills — reusable prompt workflows stored in ~/.claude/skills/ and invoked with /skill-name. See Skills.

Memory — persistent notes stored in ~/.claude/projects/<path>/memory/ and loaded automatically across sessions.

Configuration

FilePurpose
~/.claude/settings.jsonGlobal settings, hooks, and permissions
~/.claude/mcp.jsonMCP server definitions
~/.claude/skills/Custom skill files
CLAUDE.md (project root)Per-project instructions

Useful slash commands

CommandDescription
/clearClear conversation context
/compactCompress conversation to save tokens
/costShow token usage for the session
/helpList all available commands
/memoryView or edit persistent memory

Hooks

Hooks are shell commands that run automatically on events (tool calls, session start/end). Configure them in settings.json under hooks. Useful for auto-formatting, linting, or logging.

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit",
        "hooks": [{ "type": "command", "command": "prettier --write $FILE" }]
      }
    ]
  }
}

Tips

  • Prefix a shell command with ! to run it directly in the session and include output in context
  • Use /compact before starting a large task to free up context
  • Put frequently needed commands (build, test, lint) in CLAUDE.md so Claude can run them without asking

1 item under this folder.