
How to use Claude Code: step-by-step tutorial
Anthropic’s coding agent for the terminal: install, plans that include it, shared limits, safe approvals, CLAUDE.md and coding workflows you can copy.
At a glance
Is Claude Code right for this job?
Use Claude Code for
- Fixing bugs with a failing test first
- Explaining an unfamiliar codebase
- Multi-file refactors you review as a diff
- Code review on a branch
- Writing tests and docs
Think twice for
- Approving commands you haven’t read
- Repos with secrets in plain files
- Huge jobs right before a limit resets
- Deploying to production without a human check
Get set up: step by step
Basics
What it is
Claude Code is Anthropic’s coding agent. It runs in your terminal (and in IDEs and on the web), reads your project, edits files and runs commands with your approval. It is included in the Pro, Max, Ultra, Team and Enterprise plans, not Free, and shares your Claude usage limits, which reset on a 5-hour window plus weekly limits (claude.com/pricing).
Why this step matters: Knowing what it is good and bad at stops you using it for jobs where it will fail quietly.
Setup
Step 1: Get the official app
- Install Node.js 22 or newer.
- Run
npm install -g @anthropic-ai/claude-code(no sudo), per Anthropic’s docs. - In your project folder, run
claudeand sign in with your Claude account. - Only install from npm’s official package name above or Anthropic’s docs at code.claude.com.
Why this step matters: Copycat apps and unofficial installers are common; starting from the official source protects your account and data.
Setup
Step 2: Plans, limits and costs
- Not included in Claude Free.
- Pro: $20/month, or $17/month billed yearly ($200).
- Max: from $100/month. Ultra: $200/month.
- Team and Enterprise plans include it too.
Claude Code shares your plan’s usage limits: a 5-hour window and weekly limits (claude.com/pricing, checked Oct 30, 2026).
Why this step matters: Paying for features you don't use is the most common waste. Knowing the limits first tells you if the free tier is enough.
Real things to do with Claude Code

Fix a bug the safe way
Ask for a failing test before the fix, so you know the bug is real and fixed.
The checkout total is wrong when a coupon and tax both apply.
Write a failing test that shows it, then the smallest fix. Show the diff before applying.
Review a pull request
Get a severity-ranked review, then fix the top issues yourself or with its help.
Review the diff between main and this branch.
List issues by severity (high/medium/low) with file and line, and a one-line fix each.
Find security smells
Ask for a read-only scan for common risks, then verify each finding.
Read-only: look for hard-coded secrets, SQL built from strings, and missing input validation. List file and line. Don’t change anything.
Learn a new repo fast
A read-only tour, then a CLAUDE.md that captures what you learned.
Give me a tour of this repo: entry points, main modules, how to run tests. Then draft a CLAUDE.md.
Clean data with a script
Ask for a script with row counts before and after, and run it on a copy.
Write a Python script that dedupes customers.csv by email, keeping the newest row. Print counts before and after.
Write the docs nobody wrote
Have it read the code and draft a README you correct.
Read the src folder and draft a README: what it does, install, usage example, tests. Mark anything you’re unsure of.The 5-part prompt that works in Claude Code
Most weak answers come from weak instructions, not a weak model. Before you send anything important to Claude Code, check that your message has these five parts. It takes thirty seconds and saves several rounds of “that’s not what I meant.”
- Situation. Who you are and why you are asking. “I run a two-person bakery” changes every answer that follows.
- Task. One clear verb: draft, compare, summarize, fix, plan, explain. If you have three tasks, send them as three steps.
- Inputs. Paste or attach the material it should use, and say what to ignore. Name the file and the pages if it is long.
- Format. Length, structure and tone: “a table with 4 columns”, “under 150 words”, “plain English, no jargon”.
- Checks. Tell it how you will judge the answer: “give a source link for every number”, “say unknown instead of guessing”, “list your assumptions first”.
Save the version that works. In Claude Code the natural home for reusable instructions is a CLAUDE.md file in your repo with build, test and style rules, so you never type the same context twice.
Go further: steps continued
Use
Step 3: Your first real task
Start read-only: ask Claude Code to explain your project before it changes anything.
Read this repository and explain, in 10 bullets, what it does, how to run it, and where the tests live. Don’t change any files yet.Why this step matters: A prompt with situation, task and format gets a usable answer first time, so you learn what the tool can actually do.
Setup
Step 4: Privacy
- Don't paste passwords, ID numbers, card numbers or other people's private details.
- Assume the company can read and keep your chats unless its official policy says otherwise.
- For health, money or legal decisions, confirm with a professional or an official source.
- Keep secrets in environment variables or a secrets manager, never in files Claude Code reads into chat.
- Review every command before you approve it, especially anything that deletes, pushes or deploys.
- Use your employer’s approved plan for company code.
Why this step matters: Anything you paste may be stored and read. Deciding what never goes in is easier than undoing a leak.
Mistakes
Mistakes
- Approving commands without reading them.
- Starting a huge refactor late in a 5-hour window.
- Letting it commit without running tests.
- Pointing it at a folder with secrets in plain files.
Why this step matters: Knowing how it typically fails tells you where to look when you review its work.
A good session, start to finish
Decide what “done” looks like
Write one sentence describing the finished result before you open the chat: “a one-page plan I can send to my landlord by Friday.” If you cannot describe it, the bot cannot hit it.
Give context once, in the right place
Put standing facts about you, your business or your project where {name} keeps them between chats, instead of pasting them into every message.
Ask for a draft, then steer
Take the first answer as a rough draft. Reply with specific edits (“shorter”, “cut the second option”, “use our real prices”) rather than starting over.
Check the parts that matter
Open the source behind every number, name, date and quote you will reuse. For files, spot-check two page references. For code, run it.
Save what worked
Copy the final prompt into a notes file or saved instructions. Next time the same job takes one message instead of ten, and you spend fewer credits doing it.
Your first week with Claude Code
How to spot a wrong answer
Warning signs
- It gives an exact number, date or quote with no link, or with a link that does not contain it.
- It agrees with everything you say, including a wrong assumption you slipped in to test it.
- The answer is fluent but vague: lots of “generally” and “it depends” and no specifics you can act on.
- It claims to have done something (sent, saved, booked, run) without a link, ID or file you can open.
- Two answers to the same question, asked in fresh chats, disagree on a fact.
- It names a setting, menu or plan feature you cannot find. Apps change their menus often, so check the official help pages.
What to do
Open the source and find the exact sentence. Ask Claude Code to separate what it checked from what it assumed. Re-ask in a fresh chat with the source attached. If it still cannot back the claim up, treat it as unknown and use the official page instead.
None of this means the tool is bad. It means you are the editor, and editors check.
Power-user tips
Build, test and style rules in the repo save tokens and mistakes every session.
Ask for a plan and file list first; approve before edits.
Ask for the smallest change that passes tests.
Deletes, pushes and installs deserve a second look.
Start big refactors early in a window.
Commit before a session so you can roll back cleanly.
Privacy and safety with Claude Code
Claude Code reads files it needs from your project. Keep secrets out of the repo, review commands, and use your company’s approved plan for work code.
- Never paste passwords, API keys, one-time codes, full card numbers or government ID numbers into any chat.
- Remove other people’s names, addresses and account details from files before you upload them, unless you have their permission and a reason.
- Open the privacy or data-controls settings in your first week and decide whether your chats may be used to improve models.
- Use the account your employer approved for work material. A personal plan follows the consumer terms, not your company’s contract.
- For health, legal, tax or money decisions, use the bot to prepare questions, then confirm with a professional or an official source.
Claude Code or another bot?
| If you need… | Pick | Why |
|---|---|---|
| Terminal coding agent | Claude Code | Reads the repo, edits and runs commands with approval. |
| AI code editor | Cursor or Windsurf/Devin | Full editor with AI built in. |
| Code completion in GitHub | GitHub Copilot | Tight GitHub integration. |
| Build an app in the browser | Replit | Hosting and agent in one place. |
Our editorial judgment, not a benchmark. Try your own real task in two bots before you pay for either.
Questions people ask
Is Claude Code free?
No. It’s included with Claude Pro ($20/month, or $17/month yearly at $200), Max (from $100), Ultra ($200), Team and Enterprise, but not Free (claude.com/pricing, checked Oct 30, 2026).
How do I install it?
Install Node.js 22+, then run npm install -g @anthropic-ai/claude-code (no sudo) and start with claude in your project.
Does it share limits with Claude chat?
Yes, it shares your plan’s 5-hour window and weekly limits.
Can it run commands?
Yes, with your approval. Read each one before approving.
What is CLAUDE.md?
A file in your repo with instructions Claude Code reads at the start of each session.
Can I use it in CI?
It supports non-interactive use; keep human approval on pushes and deploys.
Does it work in my IDE?
Anthropic documents IDE and web options alongside the terminal at code.claude.com.
Is my code used for training?
Check your Claude privacy settings and your plan’s terms; business plans have their own commitments.
Words you will see
The Claude Code quiz, first-week checklist and cost calculator now have their own page.
Where these facts come from
- Claude pricing: Claude Code included in Pro ($20, or $17/month yearly at $200), Max ($100), Ultra ($200), Team, Enterprise; not Free; shared 5-hour and weekly limits
- Claude Code docs: npm install -g @anthropic-ai/claude-code, Node 22+, run claude
Checked Oct 30, 2026. Plans change, so confirm on the official page before you pay.
Next: Claude Code lessons →