Everything you need to go from never-opened-it
to shipping pull requests with an agentic CLI by your side. Read top to
bottom in one sitting — or jump to any chapter.
Claude Code is Anthropic's command-line coding agent. You talk to it in
plain English; it reads your repository, proposes a plan, edits files,
runs commands, and iterates until the task is done.
Unlike an autocomplete that lives inside your editor, Claude Code
operates at the project level. It can touch many files at once,
execute shell commands, run tests, and coordinate multi-step work — the
kind of thing that used to take an afternoon of tab-juggling.
The mental model worth holding: a fast, tireless colleague
who has just been handed the keys to your repo. Specific instructions
and a willingness to review diffs will take you a long way.
“Describe the outcome. Let the agent choose the path. Read the diff before you commit.”
02
Installation
Claude Code ships as an npm package. You'll need
Node.js 18+ and either a Claude subscription or
an Anthropic API key.
Install the CLI
terminal
npm install -g @anthropic-ai/claude-code
Run it in a project
terminal
cd ~/projects/my-app
claude
On first launch Claude Code opens a browser tab so you can sign in.
After that, every time you run claude from a repo root,
a new session starts with that project in context.
03
Your first run
The first session in a new project should be exploratory — let Claude
read the code before it touches it.
~/projects/my-app
$ claude
✻ Welcome to Claude Code
cwd: ~/projects/my-app
> Give me a high-level tour of this repo. Don't edit anything.
● Scanning 142 files…
● Reading README.md, package.json, src/index.ts…
✓ Here's what I found:
Next.js 15 app with a Postgres backend via Prisma.
Entry point: src/app/layout.tsx.
Auth is in src/lib/auth/*, API routes under src/app/api.
Tests run with vitest; see *.spec.ts next to sources.
>▍
Three things to notice above:
Claude summarized first instead of editing.
It named concrete files, not vague areas.
It left the repo untouched — nothing to revert.
04
How to prompt
Claude Code rewards specificity. The sharpest prompts name a
goal, a constraint, and a stopping condition.
Vague
“Fix the login bug.”
Specific
“Users report that logging in with an unverified email shows a 500. Reproduce it in a test, then fix it. Don't change the public API.”
A prompting checklist
What is the desired outcome?
Which files or modules are in scope?
Which files must not be touched?
How will we know it's done — a test, a behavior, a benchmark?
Should Claude plan first, or just go?
Patterns that work
Plan before edit
> Don't change anything yet. Read the payment flow and
propose a plan to add partial refunds.
Tests as the contract
> Write a failing test that captures the bug, then make it
pass. Run the whole suite before you finish.
Bounded refactor
> Rename getUser() to fetchUser() repo-wide. Update imports
and docstrings only. Don't change behavior.
05
Slash commands
Inside a session, commands that start with / control the
agent rather than ask it to do work. These are the ones worth learning.
/help
List every available command with a short description.
/init
Generate a CLAUDE.md that teaches future sessions about your project.
/clear
Reset the conversation — useful between unrelated tasks.
/compact
Summarize the conversation so far to free up context window space.
/review
Ask Claude to code-review its own changes before you commit.
/model
Switch models — a faster one for tight loops, a stronger one for planning.
/cost
Show tokens (and dollars) spent in the current session.
/exit
Leave the session. History is saved so you can resume later.
Keyboard shortcuts
EscStop Claude mid-reply without losing the session.
EscEscRewind to your previous prompt.
TabTabCycle completion suggestions.
CtrlCInterrupt the currently running tool call.
06
Workflows
Five tasks where Claude Code consistently earns its keep. Paste the
prompts verbatim; edit them to taste.
Workflow 01
Onboard to an unknown codebase
Drop into a repo you've never seen and produce a map of it before lunch.
> Give me a high-level tour of this repo. What are the
main entry points, data flows, and where would I start
to fix a login bug? Do not edit anything.
Workflow 02
Ship a feature, tests first
Specify the behavior, generate failing tests, then implement.
> Add a rate limiter to /api/login — 5 attempts per 10
minutes per IP. Write failing tests first, then make
them pass. Don't touch unrelated files.
Workflow 03
Debug a failing test
Paste the error, point at the file, let Claude form a hypothesis and verify.
> tests/checkout.spec.ts fails with:
"Cannot read properties of undefined (reading 'total')".
Find the root cause. Explain the bug, then fix it.
Workflow 04
Refactor across the repo
Large-scale renames and API reshaping are where agents shine.
> Rename getUser() to fetchUser() across the repo. Update
all imports and docstrings. Run tests and fix anything
that breaks.
Workflow 05
Prepare a pull request
Draft a commit message, review the diff, and write PR copy in one pass.
> Stage the changes, write a Conventional Commits message,
and draft a PR description with Summary, Risks, and
Test Plan sections.
07
Project memory
A CLAUDE.md file in your repo root is loaded automatically
on every session. Put conventions and gotchas there so you don't have
to repeat yourself.
Think of it as an onboarding doc for the agent. Keep it short, keep it
truthful, and update it when patterns change. Run /init
once and edit the result.
CLAUDE.md
# My App — agent notes
## Stack
- TypeScript, Next.js 15, Postgres via Prisma.
- Tests live in *.spec.ts next to the file.
## Conventions
- Never import from src/internal/* in src/public/*.
- Prefer pure functions; avoid class-based services.
- Dates: always UTC at the boundary, local for display.
## Before finishing a task
- Run `pnpm test` and `pnpm lint`.
- Update CHANGELOG.md under ## Unreleased.
08
Habits & pitfalls
Ten habits separating people who use Claude Code once from people who
reach for it every day.
Plan, then code.
Ask for a plan before you allow edits on anything non-trivial.
Small diffs win.
Break large tasks into commits the size of a code review.
One page of rules beats repeating yourself ten times a day.
Pin the files that matter.
Mention them by name in the prompt to anchor attention.
Verify with tests.
“Make the tests pass” is a better finish line than “make it work”.
Guard the blast radius.
Use a feature branch; let Claude run loose inside it.
Ask for reasoning.
“Explain why” catches subtle mistakes before you merge them.
Reward specificity.
Vague prompts produce vague code. Precise prompts produce precise code.
— fin —
That's the whole guide. The fastest way forward is to install it and
try one small task on a repo you actually care about. The tool gets
better the more specific you are.