# ๐ŸŸฃ Claude Code CLI โ€” Cheat Sheet > **What it is:** Anthropic's **Claude Code** โ€” an agentic coding tool that runs in your > terminal, reads/edits files, runs commands, and pair-programs interactively. > **Best for:** Deep, multi-file changes where you want to stay in the loop โ€” reasoning > through a refactor, debugging across modules, or building a feature with review at each step. > **Per-repo rules:** reads `AGENTS.md` (canonical) and, if present, `CLAUDE.md`. > โš ๏ธ **Flags/commands drift between versions.** Confirm with `claude --help` and > `/help` inside a session. > > **Official docs:** --- ## Install & auth ```bash npm install -g @anthropic-ai/claude-code # or the documented installer claude --version claude # first run walks you through login ``` - Auth via Anthropic account (Pro/Max) or an `ANTHROPIC_API_KEY`. - Config & history live under `~/.claude/`. ## Launching ```bash claude # interactive REPL in the current dir claude "explain src/server.ts and propose a refactor" # seed a first prompt claude -p "list the failing tests" # print mode: one-shot, non-interactive cat error.log | claude -p "what's the root cause?" # pipe context in ``` ## Session management ```bash claude -c # continue the most recent conversation claude --resume # pick a past session to resume claude --resume "" # resume a specific session with a new instruction ``` Inside a session, history is preserved; use `/clear` to reset context when switching tasks. ## Permission modes | How | Effect | | -------------------------------- | ------------------------------------------------------- | | _(default)_ | Prompts before edits / commands | | `--permission-mode acceptEdits` | Auto-accepts file edits, still gates commands | | `--permission-mode plan` | **Plan mode** โ€” proposes a plan, makes no changes | | `--dangerously-skip-permissions` | Auto-approves **everything** (use only in a sandbox/VM) | ```bash claude --permission-mode plan # safe: get a plan first, no edits claude --dangerously-skip-permissions # full auto โ€” only in throwaway/sandboxed env ``` > ๐Ÿง  Prefer **plan mode** for anything non-trivial: review the plan, then let it execute. > Reserve `--dangerously-skip-permissions` for isolated environments (devcontainer/VM). ## Useful in-session slash commands | Command | Purpose | | --------------- | ------------------------------------------- | | `/help` | List commands | | `/clear` | Reset conversation context | | `/init` | Generate/refresh a `CLAUDE.md` for the repo | | `/review` | Review recent changes | | `/model` | Switch model | | `/agents` | Manage subagents | | `/mcp` | Inspect/connect MCP servers | | `#` (prefix) | Add a durable memory to `CLAUDE.md` | | `@path/to/file` | Pull a file into context | ## Config files & memory - **`AGENTS.md`** (repo root) โ€” canonical agent rules; Claude reads it. - **`CLAUDE.md`** โ€” optional Claude-specific memory; `/init` scaffolds it, `#` appends to it. - **`.claude/settings.json`** (repo or `~/.claude/`) โ€” permissions, hooks, tools, MCP. - **MCP servers** โ€” connect tools/data via `claude mcp add ...` or `.mcp.json`. ## ByteLyst workflow Open every delegation with the shared guardrails โ€” Claude honors `AGENTS.md`, but re-stating scope keeps it tight: ```text Follow AGENTS.md + AI.dev/SKILLS/agent-behavior-guidelines.md. Scope: . Tests are sacred; fix code, not tests. Verify: pnpm --filter typecheck && ... test && ... build (next build --webpack). pnpm workspace; @bytelyst/* link via workspace:*. Conventional commits, one per logical change. Use plan mode first for multi-file work; show the plan before editing. ``` - Use `/review` before committing a cluster of edits. - For repo onboarding context, run `/init` once and commit the resulting `CLAUDE.md` (keep it thin โ€” it should point at `AGENTS.md`, not duplicate it). ## Troubleshooting | Symptom | Fix | | ---------------------------- | ------------------------------------------------------------------------------------- | | Edits applied without asking | You're in `acceptEdits`/`--dangerously-skip-permissions`; switch to default or `plan` | | Context bloated / confused | `/clear` and re-seed with `@` file references | | Can't reach Gitea/registry | Corp proxy must be active (`NETWORK=corp`); workspace deps avoid the registry | | Build fails on Turbopack | Use `next build --webpack` | | Wants a tool it can't access | Wire it via MCP (`/mcp`, `claude mcp add`) | ## Quick-reference card ```text claude # interactive claude -p "..." # one-shot print mode claude -c # continue last session claude --resume # pick a session claude --permission-mode plan # plan first, no edits /init /clear /review /model /mcp #memory @file ``` --- **Related:** [`devin-cli.md`](./devin-cli.md) ยท [`codex-cli.md`](./codex-cli.md) ยท [`../PROMPTS/`](../PROMPTS/) ยท [`../SKILLS/agent-behavior-guidelines.md`](../SKILLS/agent-behavior-guidelines.md) _Last updated: 2026-05-28 ยท verify flags against your installed version (`claude --help`)._