$ claude
✓ Claude Code
# Your AI pair programmer
# in the terminal
> How can I help?
Goal · turn Claude Code from a smart autocomplete into a capable cognitive partner for complex engineering tasks.
Prerequisite · Claude Code installed; you can run claude in a terminal.
“It’s not a chatbot in a terminal. It’s an agent that reads, writes, searches, and executes — and loops until the task is done.”
CLI-first · runs in your terminal, next to your shell, files, and Git history. Also available as desktop app, IDE extensions (VS Code, JetBrains), and web app.
Agentic · not one-shot Q&A — loops: perceive → plan → act → observe → repeat
Tool-using · reads files, writes code, runs bash, searches the web, spawns subagents, and can run workflows when enabled
Key insight · the model decides which tools to use, in what order, and how many times.
$ claude "add unit tests
for src/auth.ts"
● Reading src/auth.ts
● Scanning test patterns
● Writing tests/auth.test.ts
● Running: npm test
✓ 12 tests passing
“The difference between a chatbot and an agent is the difference between giving advice and doing the work.”
Claude Code can run many tool calls in one turn: read code, inspect test output, make changes, and re-run checks before it stops.
“A tool is a function the model can call. The model decides when — and how many times.”
| Category | Enables |
|---|---|
| File I/O | Read any file; create or surgically modify code |
| Pattern Search | Find files by name; search content by regex |
| Shell | Run tests, git, npm, docker — any terminal command |
| Web | Fetch docs, read changelogs, search answers |
| Agents | Spawn subagents, isolate context, and run workflow orchestration when available |
| MCP | GitHub PRs, Jira tickets, Postgres, and more |
Permission model · dangerous operations (file deletion, git push) require explicit user approval. You control the blast radius.
“Skills are reusable playbooks. Slash commands are session controls. Together they automate your workflow.”
Skills are reusable prompt playbooks. Some are bundled, some come from plugins, and teams can add project-specific ones. When exposed as commands, invoke them as /skillname.
| Skill | Purpose |
|---|---|
/code-review |
Review diff for bugs and cleanups |
/simplify |
Refactor for clarity and efficiency |
/security-review |
Security audit of pending changes |
/deep-research |
Multi-source research with citations |
| Skill | Purpose |
|---|---|
/verify |
Test that a change actually works |
/run |
Launch and drive the app |
/init |
Generate CLAUDE.md for this repo |
/review |
Review a pull request |
Install-dependent · available skills vary by setup. Use /help or the command palette in your Claude Code install to see the current list.
Session & Context
| Command | Purpose |
|---|---|
/clear |
Reset conversation history |
/compact |
Compress history, keep summary |
/context |
Inspect context usage and heavy inputs |
/usage |
Show usage and limit breakdown |
/status |
Show session, model, MCP, and sandbox status |
/config |
Configure settings |
Modes & Control
| Command | Purpose |
|---|---|
/plan |
Enter planning mode |
/fast |
Toggle faster output when supported |
/model |
Switch Claude model |
/help |
List all commands |
/doctor |
Diagnose config issues |
/workflows |
Watch live workflow progress |
Commands move fast · use /help as the source of truth for your install. Older aliases such as /cost may still work, but /usage and /context are the clearer defaults.
“The context window is finite. What’s in it decides what Claude can reason about.”
Fills fast · large tool outputs (full files, verbose logs) consume tokens rapidly.
Fix · Claude can compact long sessions, but you still control the inputs. Use /compact, limit reads to relevant files, and trim verbose bash output.
“CLAUDE.md is persistent memory — what Claude should always know, even after
/clear.”
# My Project CLAUDE.md
## Stack
TypeScript monorepo, Node 22, pnpm
## Conventions
- ESM only (no require())
- Tests: Vitest + @testing-library
- Branch: feat/<ticket>-description
## Commands
- Test: pnpm test
- Build: pnpm build
## Never
- Push directly to main
- Commit .env files
Auto-generate
Run /init in any repo — Claude inspects the codebase and writes a CLAUDE.md for you. Edit it to add conventions and “never do” rules.
It compounds · add a rule once, Claude follows it forever.
Auto-memory · Claude can save reusable learnings such as preferences, project context, and reference pointers. Review what it stores, and disable or redirect it in settings when a project needs stricter boundaries.
# .claude/settings.json
{
"hooks": {
"PostToolUse": [{
"matcher": "Edit",
"hooks": [{
"type": "command",
"command": "pnpm lint"
}]
}]
}
}
What hooks do · run shell commands automatically at lifecycle events — no per-prompt reminder needed.
Key events · PreToolUse · PostToolUse · Stop · UserPromptSubmit — and more
Use cases · lint after edits · run typecheck before stopping · block risky bash commands · log file writes
Keep them scoped · prefer narrow matchers and non-mutating checks unless automatic edits are truly intentional.
Over time, auto memory accumulates noise: stale facts, relative dates that lose meaning, and contradictions. Dream runs a reflective consolidation pass to clean this up.
Four phases · orient (read existing memories) → gather signal (scan recent session logs) → consolidate (merge, update, fix dates) → prune (keep index under 200 lines)
Experimental · the feature exists in the UI (/memory shows auto-dream toggle) but /dream may not be fully wired up in all versions. Review its output before trusting it.
# In a Claude Code session
> /memory
Auto-memory: on
Auto-dream: on
Last dream: 13h ago
# Dream consolidates memories
# between sessions, like sleep
# does for the brain:
# - Merges duplicates
# - Fixes stale dates
# - Removes contradictions
# - Prunes the index
“Subagents handle parallel work. Workflows are for the cases where simple fan-out is not enough.”
Let Claude decide
Define custom subagents when
Default · trust Opus to orchestrate subagents on its own. Only define custom subagents or reach for workflows when you need durable orchestration, progress tracking, or team-shared specialists.
Advanced automation · workflows can coordinate many agents with scripts, background runs, progress views, and structured outputs. Verify the exact API in your installed Claude Code version.
| Pattern | Use when | Simpler alternative |
|---|---|---|
| Adversarial verify | A high-risk review needs independent challenge | One subagent + manual review |
| Judge panel | Several viable designs need comparison | Ask for tradeoffs first |
| Loop-until-dry | You need repeated search until no new findings | One targeted verification pass |
| Pipeline | Many items need the same multi-stage treatment | Script + one Claude pass |
Rule of thumb · start with one agent. Add workflows only when the coordination overhead is lower than managing the task manually.
“Explore first. Edit second.”
In planning mode Claude reads files and proposes an approach before edits happen. Start it with /plan or claude --permission-mode plan, then review the plan before execution.
| Situation | Without Planning | With Planning |
|---|---|---|
| Refactor across 20 files | Broken imports, partial changes | Coherent strategy, clean execution |
| Add auth to existing app | Picks wrong pattern for codebase | Existing patterns understood first |
| Multi-service change | Inconsistent API contracts | All surfaces identified upfront |
| Mysterious bug | Treats symptoms, not cause | Root-cause analysis before editing |
Rule of thumb · if the task touches >3 files or crosses service boundaries, plan first. ~5 min of planning saves 1–2 hours of rework.
Pro tip · front-load clarity: state intent, constraints, and acceptance criteria upfront. Let Claude draft the plan. Approve it or give one round of feedback — then execute.
Before broad edits
/plan for cross-file changesBefore accepting work
git diffPrinciple · let Claude move quickly inside boundaries you can verify.
“Claude Code is an execution engine. Give it intent, constraints, and a finish line; then verify what changed.”
Over-specified
“First read auth.ts. Then check the test file. Then look for mocks. Then write a test for login using the existing mock pattern.”
Step-by-step instructions limit Claude’s ability to explore and adapt.
Intent + acceptance criteria
“Add unit tests for the auth module. Done when: all public functions covered, edge cases tested, conventions followed, pnpm test passes.”
Define what done looks like. Claude figures out how.
The one prompting rule that still matters · Claude can explore the codebase, choose tools, and loop on failures. The one thing it can’t infer is your definition of done. End every task with acceptance criteria, then verify those criteria before accepting the result.
Mental model · delegate the work, but keep ownership of the result. Inspect the diff, run checks, and review the PR before merging.
“When two Claude sessions edit the same files, you don’t get double the speed — you get merge conflicts. Worktrees give each session its own universe.”
Without worktrees
With worktrees
Key insight · a git worktree is a second checkout of the same repo — same .git/ database, different working tree. Claude Code manages them with a single flag.
Usage · claude --worktree feature-auth creates an isolated worktree and starts Claude in it. -w is the short alias.
Pro tip · add worktree directories to .gitignore. Use git worktree add/list/remove for manual control.
“Claude Code is most powerful when you treat it as a partner, not a search engine.”
CLAUDE.md for memory · /plan for complex tasks · Worktrees for isolation · Subagents for parallel work · Skills for repeatable actions · /compact when context fills · Intent + acceptance criteria · Diff + tests before acceptance
Other slide decks on software engineering practices
$ claude --help
Claude Code — AI pair programmer
Use it well. Ship great software.