# Claude Code — Command Reference

> **Summary — what this page covers**
> A quick-reference of how to install and operate Claude Code across all three surfaces (terminal,
> VS Code, JetBrains) plus the CLI and in-session slash commands used across Day 1. Keep it
> scannable — attendees will pin this. Fill in one-line descriptions and group as below.

## Install & operate across surfaces

| Surface | Install | Operate |
|---|---|---|
| **Terminal** | `npm install -g @anthropic-ai/claude-code` (Windows: in WSL2) | `claude` (REPL) · `claude "prompt"` (one-shot) |
| **VS Code** | `code --install-extension anthropic.claude-code` | Inline diff review · "Add to Claude Code context" · clickable permission UI |
| **JetBrains (Rider/IntelliJ)** | Marketplace → "Claude Code" → install → restart | Uses the JetBrains merge tool for diff review |

> Same agent, same `.claude/` config (CLAUDE.md, rules, skills, hooks) on every surface — only the
> diff/permission UI differs. Authenticate once: `claude` (OAuth) or `ANTHROPIC_API_KEY`.

## Starting & running

| Command | Does |
|---|---|
| `claude` | Start the interactive REPL |
| `claude "prompt"` | One-shot mode |
| `claude --help` | Full command reference |
| `claude --continue` | Resume the previous session |
| `claude --resume <id>` | Resume a specific session |
| `claude --plan` | Start in plan mode |

## In-session (slash commands)

| Command | Does |
|---|---|
| `/help` | In-session help |
| `/init` | Generate a starter CLAUDE.md from the project |
| `/memory` | Show which CLAUDE.md / rules are currently loaded |
| `/add-file <path>` | Add a file to context |
| `/compact` | Summarize the conversation and continue |
| `/clear` | Clear context between tasks |
| `/undo` | Undo the last change |
| `/plan` | Switch to plan mode mid-session |
| `/desktop`, `/teleport` | Hand off the session to desktop / web |
| `#` (key) | Append an instruction to CLAUDE.md on the fly |

## MCP servers (Section 3)

| Command | Does |
|---|---|
| `claude mcp add <name> ...` | Register an MCP server |
| `claude mcp add --transport http <name> <url> --header "Authorization: Bearer ..."` | Register a remote (HTTP) server with auth |
| `claude mcp list` | List configured servers and connection status |
| `claude mcp get <name>` | Show a server's configuration |
| `claude mcp remove <name>` | Remove a server |

> **GitHub (Lab 3):**
> `claude mcp add --transport http github https://api.githubcopilot.com/mcp/ --header "Authorization: Bearer ghp_..."`
> then verify with `claude mcp list`.

## The `.claude/` directory at a glance

```text
.claude/
├── rules/        # path-scoped conventions (paths: globs)
├── skills/       # skill FOLDERS, each with a SKILL.md
├── agents/       # subagents — markdown + YAML frontmatter
├── commands/     # custom slash commands (saved prompts)
├── hooks/        # hook scripts
├── settings.json # hook registration, permissions
└── plugins/      # bundled, shareable setups
```
