Claude Code is a command-line agent that turns Claude into a developer who lives in your terminal.
π€ You ββdescribe goalβββΆ π» Claude Code ββreads + editsβββΆ π Your repo
β² β
β βββrunsβββΆ βοΈ Commands (tests, builds, git)
β β
ββββββββasks for approvalβββββββ
Unlike Claude.ai (which talks about your code), Claude Code can:
npm install -g @anthropic-ai/claude-code
claude --version
π¦ Official package: @anthropic-ai/claude-code on npm
cd ~/projects/my-app
claude
Youβll be prompted to authenticate on first use.
π€ You describe a goal
β
βΌ
π§ Claude plans ββββββββββββββββ
β β
βΌ β
Read-only or edit? β
β β β
βΌ βΌ β
π Read π Propose β
files edit β
β β β
β βΌ β
β π€ You approve? β
β β β β
β yes no βββΆ π¬ push back βββ
β βΌ
β βοΈ Apply
β β
βΌ βΌ
π¬ Report ββ Done? βββΆ β
Finished
β
no βββΆ (back to plan)
> Take a look at this repo and give me a 5-bullet summary of what it does and how it's organized.
> The README is out of date β it still references the old folder structure.
Read the actual repo and rewrite the README's "Project Structure" section.
Show me the diff before applying.
Youβll see Claude plan β read β propose β ask permission β apply.
| Command | What it does |
|---|---|
/help |
Show all commands |
/model |
Switch model (opus, sonnet, opusplan) |
/clear |
Reset the conversation |
/init |
Generate a CLAUDE.md for this repo |
/cost |
Show token usage and cost so far |
/exit |
Quit |
CLAUDE.md β your projectβs system promptRun /init once per repo. It creates a CLAUDE.md Claude reads at the start of every session.
# CLAUDE.md
## Project: my-app
A Next.js 14 app with TypeScript, Tailwind, Prisma.
## Conventions
- Components live in `src/components/`, one per file, named exports.
- API routes use Zod for input validation.
- Never commit to `main` directly. Branch from `develop`.
## Commands
- `npm run dev` β dev server
- `npm test` β Jest test suite
- `npm run lint` β ESLint
- `npm run build` β production build (run before claiming "done")
## Don't
- Touch `src/legacy/`
- Modify migrations without explicit instruction
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β WITHOUT PLAN MODE β
β β
β You: "Add soft-delete to Posts" β
β Claude: *immediately starts editing files* β
β You: *15 minutes later*: "no wait, that's wrong way" β
β β mess to undo β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β β
WITH PLAN MODE β
β β
β You: "Plan adding soft-delete to Posts. Don't touch β
β files yet." β
β Claude: *writes a 7-step plan* β
β You: *review, push back on step 4* β
β Claude: *revises plan* β
β You: "Approved. Execute." β
β β clean implementation β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Use /model opusplan for an automatic Opus-plans / Sonnet-executes hybrid that saves cost while keeping quality.
> I got this stack trace in production:
[paste]
Track down the cause. Don't change anything yet β show me where the
bug is and propose a fix.
> We're renaming `User.email_address` to `User.email` everywhere.
Find every usage, plan the migration (including DB), walk me through
it before changing files.
> Add a "soft delete" feature to the Posts model:
1. Add a `deleted_at` column
2. Update queries to exclude soft-deleted rows by default
3. Add a `withDeleted()` helper
4. Update tests
Implement step by step. Run tests after each step.
> Review the changes in the current branch (compare to develop).
Flag anything risky, anything that violates our conventions in
CLAUDE.md, and anything missing tests.
> I just inherited this codebase. Spend a few minutes exploring it,
then teach me the architecture in 10 minutes. Start with a high-level
diagram, drill into the 3 most important modules.
Claude wants to run a command, edit a file, or make a network request
β
βΌ
Configured as auto-allow?
β β
YES (safe ops: NO (everything else)
git status, npm β
test, etc.) βΌ
β π€ Asks you first
βΌ β
β
Auto-allow βΌ
You approve?
β β
yes no
βΌ βΌ
βοΈ Execute π« Skip & explain
[!CAUTION] Never run Claude Code on a directory you canβt afford to lose. Use git. Commit before big agentic runs. Youβll thank yourself.
1. Always start with a plan.
It's faster to throw away a bad plan than a bad commit.
2. Keep CLAUDE.md curated.
Whenever you correct Claude on a convention, add it to the file.
3. Use small models for grunt work.
Sonnet/Haiku for repetitive edits, Opus for architecture.
4. Commit often.
After each successful step: git add . && git commit. Easy rollback.
5. Don't watch silently.
If Claude is going down a wrong path, interrupt. You're the senior.
6. Watch the cost.
/cost shows token usage. Stay aware if you're paying per token.
| Task | Best tool |
|---|---|
| ποΈ Brainstorming architecture | π¬ Claude.ai |
| βοΈ Writing the launch blog post | π¬ Claude.ai |
| π§ Single function in isolation | Either |
| π Multi-file refactor | π» Claude Code |
| π PR review | π» Claude Code |
| π Debugging a flaky test suite | π» Claude Code |
| π€ Pair programming on a new feature | π» Claude Code |
A lot of pros use both: Claude.ai for thinking, Claude Code for shipping.
You should now have:
CLAUDE.md in at least one of your real reposπ Next up: Module 06 β API Development β building your own apps powered by Claude.
| β Previous | π Home | Next β |
|---|---|---|
| Module 04 β Claude.ai Features | Course README | Module 06 β API Development |