Claude Code 101 Basics
10 examples to get you started with Claude Code 101 - 7 basic and 3 intermediate.
Prerequisites
- A terminal you are comfortable working in, and a project directory you want Claude Code to work on.
- The Claude Code CLI installed on your machine (covered in example 1 below).
- An Anthropic account with access to Claude Code, since the CLI needs to authenticate before it can run a session.
Basic Examples
1. Install the CLI
Install Claude Code from your terminal before doing anything else.
npm install -g @anthropic-ai/claude-code- The CLI installs globally so you can launch it from any project directory.
- Installation is a one-time step; after this you only need to keep it updated occasionally.
- If
npmis not your preferred package manager, check platform.claude.com/docs for the current install options.
Related: Installing Claude Code and Connecting Your First Project - the full walkthrough this example summarizes.
2. Check the installed version
Confirm the CLI installed correctly and see which version you are running.
claude --version- A version number confirms the install succeeded and the
claudecommand is on yourPATH. - Run this again after an update to confirm the new version took effect.
- If the command is not found, your shell's
PATHlikely needs to include the global npm bin directory.
3. Launch the REPL in a project
Start an interactive Claude Code session inside the project you want help with.
cd ~/projects/my-app
claude- Claude Code launches as a REPL: a standing session where you type natural-language requests.
- It orients itself in the current directory, so always
cdinto the project first. - The session stays open across multiple requests until you exit it.
Related: Navigating the Claude Code REPL: Prompts and Slash Commands - what you can type once the session is open.
4. Give it your first natural-language request
Type a plain-English instruction at the prompt instead of writing code yourself.
> Add a README.md that explains what this project does- Claude Code reads the project first, then plans and writes the file.
- You do not need special syntax; describe the outcome you want.
- Vague requests get vague results, so name specifics (files, functions, behavior) when you can.
5. Review a proposed change
See what Claude Code wants to change before it happens.
# Claude Code shows a diff-style preview of the edit
# you approve, edit the request, or reject it- Reviewing the diff is how you catch a misunderstood request before it becomes a real edit.
- Whether you see this preview by default depends on your permission mode.
- Treat the first few sessions in a new project as a chance to build trust in its plans.
Related: Permission Modes Explained: Auto-Accept vs Ask-Every-Time - controls whether you see this preview for every action.
6. Use a built-in slash command
Trigger built-in behavior with a leading slash instead of a natural-language request.
> /init- Slash commands are distinct from natural-language requests; the leading
/signals a built-in action. /initis a common first command in a new project, since it lets Claude Code build up context about the codebase.- Other slash commands exist for clearing or compacting the session's context.
7. Exit the session cleanly
End your Claude Code session when you are done.
> /exit- Exiting cleanly closes the REPL session without leaving background work running.
- Your project files retain whatever changes were already approved during the session.
- You can always relaunch with
claudefrom the same directory to pick up where you left off.
Intermediate Examples
8. Set your permission mode for a session
Choose whether Claude Code asks before each action or proceeds on its own.
claude --permission-mode ask-every-timeask-every-timeprompts for approval before each file edit or shell command.- Omitting the flag uses your configured default, which may be auto-accept.
- Start new or unfamiliar projects with
ask-every-timeuntil you trust the agent's plans in that codebase.
Related: Permission Modes Explained: Auto-Accept vs Ask-Every-Time - the full comparison of both modes.
9. Research safely with Plan Mode first
Let Claude Code investigate a risky or unfamiliar change before it touches any files.
> /plan
> Investigate why the checkout flow fails intermittently and propose a fix- In Plan Mode, Claude Code can read files and reason about an approach, but it cannot make real edits.
- Review the proposed plan, then switch to execution mode to let it actually apply the fix.
- This two-step flow is the safest way to hand off a task you do not fully understand yet.
Related: Switching Between Plan Mode and Execution Mode - the full workflow for moving from research to real edits.
10. Chain a multi-step task across files
Give Claude Code one instruction that requires touching several files and running a command.
> Rename getUserData to fetchUserProfile everywhere it's used, then run the test suite- A single instruction can trigger reading several files, editing each usage, and running a shell command to verify the result.
- This is the agent loop in practice: read, plan, act, verify, all from one natural-language request.
- Reviewing the summary Claude Code reports back confirms the test suite actually passed, not just that files changed.
Related: The Claude Code Mental Model: Agent, Not Autocomplete - why one instruction can safely trigger a multi-step plan like this.
Stack versions: Written against the Claude model lineup current as of ~June 2026 - Claude Fable 5, Claude Opus 4.8, Claude Sonnet 5 (the default), and Claude Haiku 4.5. Model names, pricing, and product features move quickly - verify current specifics at platform.claude.com/docs before relying on them.