Claude Code Guide: Commands, Sessions and Usage
Practical handbook for Anthropic's terminal coding agent: slash command cheatsheet (/clear /compact /resume /cost), subscription vs API metering, and CLAUDE.md project memory - verified against official docs.
What is Claude Code
Claude Code is Anthropic's terminal coding agent: describe a task in natural language and it reads your codebase, plans, edits files and runs tests until done. Requires Node.js 18+; install @anthropic-ai/claude-code globally, then run claude in your project.
10-second cheatsheet
- Clear conversation history and reset context: /clear (keeps CLAUDE.md)
- Compact history keeping key points: /compact (also runs automatically near limits)
- Resume a previous session: /resume (or start with claude -c)
- Costs and status: /cost shows spend, /status shows account state
- Switch models: /model (Sonnet balanced; Opus deep reasoning, burns quota faster; Haiku fast and cheap)
Topics in this guide
- Claude Code Reset Handbook - /clear vs /compact vs /resume, and fixing auth issues
- Claude Code Usage - subscription sliding windows vs pay-as-you-go API
CLAUDE.md: project memory
CLAUDE.md stores build commands, conventions and architecture notes; /clear keeps it. Run /init to generate a first draft in your repo.
FAQ
How do I install Claude Code?
Install Node.js 18+, run npm install -g @anthropic-ai/claude-code, then start claude in your project and follow the login flow.
Is there a free tier?
No free tier: usage requires a Claude Pro/Max subscription or an Anthropic API key billed per token; enterprises can use AWS Bedrock or Google Vertex.
Claude Code vs Cursor?
Claude Code is a terminal agent that executes multi-step tasks autonomously; Cursor is an AI-native IDE for interactive editing. Pick by workflow, or run both on the same real task and compare.