- Guides
- Tool guides
- How to use Claude Code
How to use Claude Code
Claude Code works best when you treat it like a capable new colleague: show it the project, give it one clear task and a way to check its own work. This tutorial goes from your first prompt to project rules, reviews and larger jobs.
We have no affiliate deal with Anthropic, and nobody paid to appear on this page.
Before you start
You need a paid Claude plan, Claude Code installed, and a folder to work in. Claude Code is Anthropic's coding agent: it reads the files in a folder, edits them, runs commands and works with git, while you describe what you want 1. It suits developers, and also founders and marketers who want a small tool, a landing page or a data cleanup without writing the code themselves 3.
- A plan: Claude Code needs Pro, Max, Ultra, Team, Enterprise or a Console account; the free plan does not include it 5. Pro is $20 a month, or $17 billed yearly 13.
- Somewhere to run it: the terminal, the VS Code or Cursor extension, or the Code tab of the Claude desktop app, which needs no terminal at all 1 4. Our install and pricing guide has the commands for Mac and Windows.
- A safety net: use git if you can. Claude Code saves checkpoints you can roll back to, but they only track its own file edits, and Anthropic says they are no replacement for git 6.
Know the permission modes before your first task. In Manual mode Claude asks before every edit or command. In Plan mode it reads and proposes without changing files. In Auto mode, the starting mode in recent versions, a separate classifier lets routine actions through and blocks risky ones 8. Press Shift+Tab to switch. Anthropic warns that the bypass mode, which skips every check, belongs only in an isolated container or virtual machine 8.
Your first task
Start with questions about a project you already know, then ask for one small change. Testing Claude on work where you know the right answers shows you quickly whether it reads your project the way you do.
- Open the projectIn a terminal, go to the folder and start Claude Code. In the desktop app, click Code, choose Local and open the folder 2 4.
- Ask before you change anythingAsk what the project does and where things live. Check two or three answers against what you know.
- Give one specific taskName the file, the behavior and what "done" looks like. "Fix the bug" gets worse results than a description of the symptom 2.
- Review and approveRead the proposed change. Approve it, or press
Escto stop Claude and redirect it 3. - CommitAsk Claude to commit with a clear message, so the change is saved in git 2.
cd /path/to/your/project
claude
Prompts that work well for a first session, from Anthropic's quickstart 2:
what does this project do?
explain the folder structure
fix the login bug where users see a blank screen after entering wrong credentials
commit my changes with a descriptive message
No code project? Point Claude at a folder of files instead. Anthropic's beginner guide uses requests like "look at the screenshots on my Desktop and rename them based on what's in each image" 3. A marketer might try:
Read the CSV exports in this folder. Build a one-page HTML report with monthly signups by channel and a chart. Tell me which numbers you could not match across files.
Tip: type / to see every command and skill, and /help for a short list. claude -c continues your last conversation in that folder 2.
Project instructions in CLAUDE.md
CLAUDE.md is a plain text file Claude reads at the start of every session. Put in it what you would otherwise explain again each time: build and test commands, conventions and "always do X" rules 7.
Run /init and Claude writes a first version from your codebase, with the build commands, test steps and conventions it finds. If the file exists, /init suggests improvements instead of overwriting it 7. A short example in Anthropic's style 6:
# Code style
- Use ES modules (import/export) syntax, not CommonJS (require)
- Destructure imports when possible (eg. import { foo } from 'bar')
# Workflow
- Be sure to typecheck when you're done making a series of code changes
- Prefer running single tests, and not the whole test suite, for performance
| Include | Leave out |
|---|---|
| Commands Claude can't guess | Anything it can learn by reading the code 6 |
| Style rules that differ from the defaults | Standard conventions it already knows |
| How to run tests, and which runner | Long API documentation; link to it |
| Branch and pull request conventions | Facts that change often |
| Gotchas that aren't obvious | "Write clean code" and other generic advice |
- Keep it under 200 lines. Longer files cost more and Claude follows them less reliably 7.
- Add a line when Claude makes the same mistake twice, or when you type the same correction you typed last session 7.
- Be concrete: "Run
npm testbefore committing", not "Test your changes" 7. - Where it lives:
./CLAUDE.mdin the project for the team,~/.claude/CLAUDE.mdfor your personal rules in every project, andCLAUDE.local.mdfor private notes you keep out of git 7.
If your repository already has an AGENTS.md for another coding agent, Claude Code reads it when there is no CLAUDE.md 7. Claude also keeps its own notes across sessions, called auto memory, which is on by default; open /memory to see or turn it off 7. Long procedures that only matter sometimes belong in a skill instead: see Claude Code skills and plugins.
Reviewing and testing changes
Give Claude a check it can run, and it fixes its own mistakes before you see them. Anthropic calls this the difference between a session you watch and one you can walk away from 6. A check is anything with a pass or fail: tests, a build, a linter, or a screenshot compared against a design.
write a validateEmail function. example test cases: user@example.com is true, invalid is false, user@.com is false. run the tests after implementing
the build fails with this error: [paste error]. fix it and verify the build succeeds. address the root cause, don't suppress the error
Plan before big changes
For work that touches several files, start in Plan mode: press Shift+Tab or begin the prompt with /plan. Claude reads files and writes a plan but does not edit your source until you approve it. Press Ctrl+G to edit the plan yourself before Claude starts 8.
Get a second opinion
Run /code-review, a built-in skill that checks the current diff for bugs in a fresh context, or ask Claude to "use a subagent to review" against your plan 6. A reviewer that did not write the code is not biased toward it. In the desktop app, click the +12 -1 change counter to open the diff, comment on specific lines, and Claude revises 4.
Undo safely
Press Esc twice or type /rewind to restore the conversation, the code, or both to an earlier point 6. That makes it cheap to let Claude try a risky idea. For checks that must run every time, such as a linter after each edit, ask Claude to write a hook; hooks run on every event, while CLAUDE.md is guidance 6.
Working with larger codebases
On a big project, keep each session focused. Opus 5.5 runs with a 1 million token window by default 10, and Anthropic says that with compaction near the top of it you'll rarely run out of context. Every request still sends the whole conversation, so use /clear between unrelated tasks: a focused context gets better answers and costs less 6.
- Point, don't paste. Reference files with
@and a path instead of describing where code lives 6. - Keep wide searches out of the main chat. Claude already sends broad codebase searches to its built-in Explore subagent; ask for short summaries back so the results don't fill your conversation 6.
- Let Claude interview you before a large feature, write a spec to a file, then start a fresh session to build it 6.
- Split big changes.
/batchspreads one change across 5 to 30 subagents, each in its own copy of the repo 6.
Use subagents to investigate how our authentication system handles token refresh, and whether we have any existing OAuth utilities I should reuse.
I want to build [brief description]. Interview me in detail using the AskUserQuestion tool. Ask about technical implementation, UI/UX, edge cases, concerns, and tradeoffs. Keep interviewing until we've covered everything, then write a complete spec to SPEC.md.
Once a workflow is routine, you can run it without the chat window. claude -p "your prompt" runs one task and exits, which is how teams put Claude Code into scripts and CI 6.
Saving usage
Claude rereads your whole conversation on every message, so short, focused sessions last longest. On Pro and Max, Claude Code shares one five-hour and weekly limit with Claude chat 12. These are the habits our newsletter told readers to fix in October 2026, checked against Anthropic's docs:
- One task per sessionType
/clearwhen you switch to unrelated work; stale context costs tokens on every message 9. - Rewind instead of arguingAfter two failed corrections, rewind or clear and send a better prompt 6. Failed attempts left in the chat are re-sent with every later message 9.
- Ask side questions with
/btwThe answer never enters the conversation history 6. - Match the effort and model to the jobOpus 5.5 and Sonnet 5.5 default to medium effort; raise it with
/effortonly for hard problems 10. Anthropic's advice: "plan with Opus, execute with Sonnet" 11. - Compact before a breakYour first message after a long pause reprocesses the full context 9. Run
/compactwith what to keep, such as/compact Focus on the API changes6.
Type /usage to see your plan bars and what used them, by skill, subagent, plugin and MCP server. It suggests fixes for anything behind 10% or more of recent usage, and pressing f applies the ones it can 9. Our guide to Claude usage limits covers the plan side.
Questions people ask
Can I use Claude Code if I can't code?
Yes. Anthropic's beginner guide says you describe what you want in plain English and Claude writes the code. The desktop app's Code tab avoids the terminal entirely; start with a small task you can check yourself.
How do I use Claude Code in VS Code?
Install the Claude Code extension from the Extensions view, open its panel and sign in with your Claude plan. You get inline diffs, plan review and @-mentions of files; the same works in Cursor.
What should I put in CLAUDE.md?
Commands Claude can't guess, style rules that differ from the defaults, test instructions and project gotchas. Keep it under 200 lines and run /init to generate a first draft.
How do I stop Claude Code asking permission every time?
Use Auto mode, where a classifier approves routine actions and blocks risky ones, or pre-approve commands you trust with /permissions. Avoid the bypass mode outside an isolated machine.
How do I undo what Claude Code did?
Press Esc twice or type /rewind to restore code, conversation or both to an earlier checkpoint. Checkpoints only cover Claude's own file edits, so commit to git as well.
Related
New features, explained the week they ship
195,000 readers get Uncover AI's practical AI briefing. We show you what is new and how to use it in your work.
Sources
- Claude Code overview
- Claude Code quickstart
- Terminal guide for new users
- Get started with the desktop app
- Claude Code advanced setup
- Claude Code best practices
- How Claude remembers your project (CLAUDE.md)
- Claude Code permission modes
- Claude Code: manage costs effectively
- Claude Code model configuration
- Models, usage and limits in Claude Code
- Using Claude Code with your Pro or Max plan
- Claude pricing