PRESENTATION 10 OF 10
The Complete Claude Cheat Sheet
Anthropic Claude Series · 2025
| # | Presentation | Key Topics |
|---|---|---|
| 01 | Introduction to Claude | What Claude is, Constitutional AI, model family, capabilities |
| 02 | Getting Started | Account setup, first conversations, plans & pricing basics |
| 03 | Claude.ai Deep Dive | Web UI, Projects, Artifacts, keyboard shortcuts, tips |
| 04 | Claude Code | CLI installation, slash commands, CLAUDE.md, agentic coding |
| 05 | API & SDK | REST API, Python/TypeScript SDKs, streaming, tool use |
| 06 | Integrations | MCP servers, IDE plugins, CI/CD, third-party tools |
| 07 | Agents | Agentic patterns, multi-agent, orchestration, guardrails |
| 08 | Productivity & Workflows | Prompt engineering, templates, batch processing, automation |
| 09 | Future Capabilities | Roadmap, computer use, extended thinking, research |
| 10 | Summary & Quick Reference | This deck — cheat sheets, tables, templates, links |
| Attribute | Haiku 3.5 | Sonnet 4 | Opus 4 |
|---|---|---|---|
| Speed (tokens/sec) | Fastest (~100+ t/s) | Fast (~80 t/s) | Moderate (~50 t/s) |
| Input $/1M tokens | $0.80 | $3.00 | $15.00 |
| Output $/1M tokens | $4.00 | $15.00 | $75.00 |
| Context Window | 200K tokens | 1M tokens | 1M tokens |
| Max Output | 8,192 tokens | 16,000 tokens | 32,000 tokens |
| Vision | Yes | Yes | Yes |
| Tool Use | Yes | Yes | Yes |
| Extended Thinking | No | Yes | Yes |
| Best For | Classification, routing, high-volume tasks, chat | Coding, analysis, general-purpose, daily driver | Complex reasoning, research, agentic tasks |
| API Model ID | claude-3-5-haiku-latest | claude-sonnet-4-20250514 | claude-opus-4-20250514 |
Tip: Use Haiku for routing/classification, Sonnet as your default, Opus for hard problems.
| Plan | Price | Includes |
|---|---|---|
| Free | $0/mo | Limited Sonnet access, basic features |
| Pro | $20/mo | All models, 5x more usage, Projects |
| Max | $100–$200/mo | Pro + highest usage limits |
| Team | $30/seat/mo | Pro + admin, sharing, higher limits |
| Enterprise | Custom | SSO, SCIM, audit logs, SLA, dedicated |
| Model | Input | Output |
|---|---|---|
| Haiku 3.5 | $0.80 | $4.00 |
| Sonnet 4 | $3.00 | $15.00 |
| Opus 4 | $15.00 | $75.00 |
Prompt caching: 90% discount on cache hits. Batches: 50% discount.
Included with Max plan ($100/mo) or uses API credits directly. Max includes 5x Pro usage for Claude Code.
| Action | Shortcut |
|---|---|
| New conversation | Ctrl/Cmd + Shift + O |
| Focus chat input | Ctrl/Cmd + Shift + ; |
| Send message | Enter |
| New line (without send) | Shift + Enter |
| Copy last response | Ctrl/Cmd + Shift + C |
| Stop generation | Esc |
| Toggle sidebar | Ctrl/Cmd + Shift + S |
| Action | Shortcut |
|---|---|
| Search conversations | Ctrl/Cmd + K |
| Upload file | Ctrl/Cmd + U |
| Select model | Ctrl/Cmd + / |
| Toggle dark/light mode | Ctrl/Cmd + Shift + L |
| Create Artifact | Ask Claude to create one |
| Star conversation | Ctrl/Cmd + Shift + F |
| Delete conversation | Ctrl/Cmd + Shift + D |
On macOS use Cmd, on Windows/Linux use Ctrl. Shortcuts may update — check Help menu.
| Command | Description |
|---|---|
/help | Show help and available commands |
/clear | Clear conversation history |
/compact | Compact conversation to save context |
/config | Open or edit configuration |
/cost | Show token usage and cost |
/doctor | Diagnose setup issues |
/init | Initialize CLAUDE.md in project |
| Command | Description |
|---|---|
/login | Authenticate with Anthropic |
/logout | Sign out of current session |
/model | Switch model (sonnet/opus) |
/permissions | View and manage tool permissions |
/review | Review git changes / PR |
/status | Show current session status |
/terminal-setup | Install shell integration (Shift+Enter) |
Run claude --help for CLI flags: --model, --allowedTools, --print, --dangerously-skip-permissions
| Tool | Purpose | Key Parameters |
|---|---|---|
| Read | Read file contents (text, images, PDFs) | file_path, offset, limit, pages |
| Write | Create new files or full rewrites | file_path, content |
| Edit | Exact string replacement in files | file_path, old_string, new_string, replace_all |
| Bash | Execute shell commands | command, timeout, run_in_background |
| Grep | Regex search across files (ripgrep) | pattern, path, glob, output_mode |
| Glob | Find files by name pattern | pattern, path |
| Agent | Spawn sub-agent for complex subtasks | task, tools |
| WebFetch | Fetch content from URLs | url, format |
| WebSearch | Search the web | query, max_results |
Permissions: tools require approval on first use. Grant with /permissions or allowedTools in settings.
| Endpoint | Method |
|---|---|
/v1/messages | POST — Create message |
/v1/messages | POST (stream) — Stream response |
/v1/messages/batches | POST — Batch requests |
/v1/messages/count_tokens | POST — Count tokens |
x-api-key: YOUR_API_KEY
anthropic-version: 2023-06-01
content-type: application/json
Base URL: https://api.anthropic.com
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID (e.g., claude-sonnet-4-20250514) |
messages | array | Yes | Conversation messages [{role, content}] |
max_tokens | int | Yes | Maximum tokens in response |
system | string | No | System prompt |
temperature | float | No | 0.0 – 1.0 (default 1.0) |
stream | bool | No | Enable SSE streaming |
tools | array | No | Tool definitions for function calling |
# Installation
pip install anthropic
# Basic usage
import anthropic
client = anthropic.Anthropic() # uses ANTHROPIC_API_KEY
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[
{"role": "user",
"content": "Explain quantum computing"}
]
)
print(message.content[0].text)
# Streaming
with client.messages.stream(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{"role": "user",
"content": "Write a poem"}]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
# With system prompt
message = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
system="You are a helpful tutor.",
messages=[{"role": "user",
"content": "Explain gravity"}]
)
# Tool use
tools = [{"name": "get_weather", "description": "Get current weather",
"input_schema": {"type": "object", "properties": {"location": {"type": "string"}}, "required": ["location"]}}]
msg = client.messages.create(model="claude-sonnet-4-20250514", max_tokens=1024, tools=tools,
messages=[{"role": "user", "content": "Weather in Tokyo?"}])
// Installation
npm install @anthropic-ai/sdk
// Basic usage
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic(); // ANTHROPIC_API_KEY
const message = await client.messages.create({
model: "claude-sonnet-4-20250514",
max_tokens: 1024,
messages: [
{ role: "user",
content: "Explain quantum computing" }
],
});
console.log(message.content[0].text);
// Streaming
const stream = client.messages.stream({
model: "claude-sonnet-4-20250514",
max_tokens: 1024,
messages: [
{ role: "user", content: "Write a poem" }
],
});
for await (const event of stream) {
if (event.type === "content_block_delta"
&& event.delta.type === "text_delta") {
process.stdout.write(event.delta.text);
}
}
const finalMessage = await stream.finalMessage();
// Multi-turn conversation
const messages = [
{ role: "user", content: "What is the capital of France?" },
{ role: "assistant", content: "The capital of France is Paris." },
{ role: "user", content: "What is its population?" }
];
const resp = await client.messages.create({ model: "claude-sonnet-4-20250514", max_tokens: 1024, messages });
<context>, <instructions>Chain of Thought: "Think step by step" Few-Shot: Provide 2-3 examples Role: System prompt persona XML Tags: <doc>...</doc> for structure Prefill: Start assistant response with desired prefix
# CLAUDE.md - Project Instructions for Claude Code
## Project Overview
This is a [type] project using [stack]. The main entry point is [file].
## Tech Stack
- Language: TypeScript 5.x / Python 3.12
- Framework: Next.js 14 / FastAPI
- Database: PostgreSQL with Prisma / SQLAlchemy
- Testing: Jest / pytest
## Key Commands
- `npm run dev` — start dev server
- `npm test` — run test suite
- `npm run lint` — lint and format
## Code Conventions
- Use functional components with hooks (React)
- Prefer named exports over default exports
- All functions must have docstrings/JSDoc
- Error handling: use Result types, never throw
## Architecture
- /src/components — React components
- /src/lib — shared utilities
- /src/api — API route handlers
- /src/db — database models and migrations
## Important Notes
- Never modify files in /src/generated/
- Always run tests before committing
- Use conventional commit messages
# agents.md - Instructions for Sub-Agents
## Role
You are a specialized agent focused on [specific task].
You have access to: Read, Grep, Glob tools only.
## Constraints
- Do NOT modify any files — only read and analyze
- Do NOT run shell commands
- Report findings in structured format
- Stay focused on the assigned subtask
## Output Format
Return your findings as:
1. Summary (1-2 sentences)
2. Relevant files (absolute paths)
3. Key findings (bulleted list)
4. Confidence level (high/medium/low)
## Context
The parent agent will provide you with a specific
question about the codebase. Answer it thoroughly
by searching and reading relevant files.
CLAUDE.md goes in project root (or ~/.claude/CLAUDE.md for global). agents.md is referenced from CLAUDE.md or passed to sub-agents via the Agent tool.
~/.claude/claude_desktop_config.json (Desktop).mcp.json (Project-level for Claude Code)
{
"mcpServers": {
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"/path/to/allowed/dir"
]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_TOKEN": "ghp_xxx"
}
}
}
}
| Server | Purpose |
|---|---|
server-filesystem | Local file read/write access |
server-github | GitHub API (repos, PRs, issues) |
server-postgres | PostgreSQL database queries |
server-sqlite | SQLite database access |
server-brave-search | Web search via Brave |
server-puppeteer | Browser automation |
server-slack | Slack workspace access |
server-memory | Persistent knowledge graph |
server-sequential-thinking | Step-by-step reasoning |
Install: npx @modelcontextprotocol/create-server myserver
| Use Case | Best Option | Why |
|---|---|---|
| Quick questions & brainstorming | Claude.ai | No setup, rich UI, artifacts |
| Coding in a repo | Claude Code CLI | Full repo context, file editing, git-aware |
| IDE-integrated coding | VS Code / JetBrains plugin | Inline suggestions, stays in editor |
| Building a product/app | API + SDK | Full control, custom UI, production-grade |
| High-volume processing | Batch API | 50% cheaper, async, up to 10K requests |
| Real-time chat product | Streaming API | SSE, token-by-token, low latency |
| Connecting external tools | MCP | Standardized protocol, growing ecosystem |
| CI/CD automation | Claude Code + GitHub Actions | Headless mode, PR reviews, code gen |
| Multi-agent orchestration | API + Agent framework | Custom routing, tool use, state management |
| Data analysis / research | Claude.ai Projects | Upload docs, persistent context, artifacts |
| Team knowledge base | Team plan + Projects | Shared projects, admin controls |
| HTTP Code | Error Type | Cause | Solution |
|---|---|---|---|
| 400 | invalid_request_error | Malformed request body | Check required fields, message format, model ID |
| 401 | authentication_error | Invalid or missing API key | Verify x-api-key header, check key status |
| 403 | permission_error | Key lacks required permissions | Check API key scopes and workspace access |
| 404 | not_found_error | Invalid endpoint or model | Verify URL path and model ID spelling |
| 429 | rate_limit_error | Too many requests or tokens | Implement exponential backoff, check tier limits |
| 529 | overloaded_error | API is temporarily overloaded | Retry with backoff, consider off-peak times |
| 500 | api_error | Internal server error | Retry request; if persistent, check status page |
Exponential backoff: 1s, 2s, 4s, 8s, 16s. Max 5 retries. Only retry 429, 529, 500. Add jitter to avoid thundering herd.
Tier 1: 60 RPM, 60K tokens/min. Tier 2: 1000 RPM, 80K t/m. Tier 3: 2000 RPM, 160K t/m. Tier 4: 4000 RPM, 400K t/m. Check with x-ratelimit-* headers.
| Model | Input | Output |
|---|---|---|
| Haiku 4.5 | 200K tokens | 8K tokens |
| Sonnet 4.6, Opus 4.6 | 1M tokens | 16K-32K tokens |
1 token ~ 4 characters ~ 0.75 words (English). 1M tokens ~ 750K words ~ 2,500 pages.
input_cost = input_tokens * (price / 1M)
output_cost = output_tokens * (price / 1M)
total = input_cost + output_cost
# Example: Sonnet, 1K in / 500 out
# ($3 * 1000/1M) + ($15 * 500/1M)
# = $0.003 + $0.0075 = $0.0105
Prompt Caching
Cache static system prompts and long documents. 90% input discount on cache hits. Min 1024 tokens to cache.
Batch API
50% discount for non-urgent requests. Results within 24 hours. Up to 10,000 requests per batch.
Token Reduction
Summarize long docs before sending. Use smaller models for simple tasks. Set appropriate max_tokens.
.env files locally + .gitignoreHardcoding API keys in source code • Exposing keys in client-side JavaScript • Logging full API responses with sensitive data • Not validating model output before executing • Skipping input sanitization • Using production keys in development
| Term | Definition |
|---|---|
| Constitutional AI (CAI) | Anthropic's alignment method using a set of principles to train helpful, harmless, honest AI |
| RLHF | Reinforcement Learning from Human Feedback — training technique using human preference rankings |
| Tokens | Smallest units of text processed by the model (~4 chars in English) |
| Context Window | Maximum number of tokens (input + output) a model can process in one call |
| System Prompt | Special instructions that set the model's behavior, role, and constraints |
| Temperature | Controls randomness in output: 0 = deterministic, 1 = more creative |
| Stop Sequence | String that causes the model to stop generating when encountered |
| Term | Definition |
|---|---|
| MCP | Model Context Protocol — open standard (donated to the Linux Foundation's Agentic AI Foundation) for connecting AI to external tools and data |
| Tool Use | Ability for Claude to call defined functions and process their results |
| Artifacts | Rich, interactive outputs (code, documents, diagrams) in Claude.ai |
| Extended Thinking | Mode where Claude shows its reasoning process (chain-of-thought) |
| Prompt Caching | Reuse previously sent context at 90% cost reduction |
| Batch API | Async endpoint for processing many requests at 50% discount |
| Agentic Coding | AI autonomously reads, writes, tests code with tool access |
| SSE | Server-Sent Events — protocol for streaming API responses |
End of Series — Thank you for following along! Bookmark this reference deck.