Getting Started With Claude Code: A Safe Setup Guide
This Claude Code getting started guide gets you installed and productive fast, without letting the agent rewrite half your repo. Install, add guardrails, and run a real task in minutes.
npm install -g @anthropic-ai/claude-code claude --version # confirm it installed cd your-project claude # start a session in your repo
How do you start using Claude Code without accidentally letting it rewrite half your repo on the first run? That's the question that stops most people at the install step — they've heard a terminal agent can edit files and run commands, and the natural next thought is what if it edits the wrong ones. Fair worry. This Claude Code getting started guide is built around exactly that fear: get productive fast, but stay in control the whole time.
By the end you'll have it installed, configured with guardrails, and doing real work on a task you choose.
Claude Code Getting Started in 60 Seconds
Claude Code is Anthropic's terminal agent, distributed as an npm package. You need Node.js installed first, then it's one command.
npm install -g @anthropic-ai/claude-code
claude --version ,[object Object],
,[object Object], your-project
claude ,[object Object],What this does: Installs Claude Code globally, prints the version so you know it's there, then launches an interactive session scoped to your current project directory. On first launch it walks you through authentication.
That's the whole install. The version check matters more than it looks — features and flags are version-specific, and the tool ships fast, so knowing you're on a current build (the 2.1.x series as of August 2026) saves you from chasing docs that don't match your binary.
⚡ Pro tip: Don't run your first session in a repo with uncommitted work you care about. Start in a scratch clone or a branch. Any Claude Code getting started run should assume you'll want a clean
git statusUnderstanding the Variables
Two files and one mode do most of the work of keeping you safe and productive.
The first is
CLAUDE.md# CLAUDE.md
- Test command: `npm test`
- Never edit files under /migrations without asking first
- Match existing code style; no new dependencies without flagging
- After any change, run the test command and report resultsWhat this does: Gives the agent standing instructions it will follow on every run, so you're not re-typing "run the tests" and "don't touch migrations" into every prompt. It's project memory that survives across sessions.
The second variable is the model. Claude Sonnet 5 is the default in current builds, with a large context window (up to 1M tokens). It's the fast, capable everyday model; when a task needs heavier reasoning you switch up with
/model opusThe third is the mode. Plan mode lets the agent describe what it would do without changing anything — a read-only dry run you approve before execution.
Step-by-Step: Your First Real Task
Let's fix a real bug the safe way.
Step one: open a session and switch to plan mode so nothing changes yet.
claude
,[object Object],
,[object Object],
,[object Object],What this does: The
ConciseStep two: read the plan. If it wants to change a file it shouldn't, say so now. This is the two-minute checkpoint that prevents the messy runs people warn each other about.
Step three: approve execution. The agent makes the edits, runs your test command (because your
CLAUDE.mdStep four: diff and commit yourself.
git diff⚡ Pro tip: Scope permissions before you let an agent run commands unattended. Current Claude Code builds support scoped permissions that enforce least privilege on sub-agents, so a child agent can't do more than the task needs. Turn that on for anything running without you watching.
Pro-Level Variations
Once the basics click, three patterns pay off.
A frontend engineer at an e-commerce company runs Claude Code headlessly in a pre-commit hook:
claude -p "review the staged diff for accessibility issues"-pA platform engineer decomposes a large migration with nested sub-agents — a parent agent coordinates while child agents each own a service — then checkpoints the whole tree before logging off, resuming the next morning.
A technical writer with a documentation repo keeps a
CLAUDE.mdclaude -p ,[object Object], > /dev/nullWhat this does: Runs a single non-interactive pass to draft changelog entries from recent commit history, discarding stdout so it's quiet enough to drop into a release script.
Setting Up a Config Your Whole Team Can Share
Once one person's Claude Code getting started run works, the natural next step is making it repeatable for everyone. Two things make that clean.
First, commit your
CLAUDE.mdSecond, layer a personal choice on top of the shared one. A backend engineer tackling a gnarly refactor might switch up to Opus for that one session, while the team default stays on Sonnet 5 for everyday speed. Per-session
/modelclaude --model opus ,[object Object],
,[object Object],What this does: Launches a session on the heavier Opus model for a genuinely hard change while keeping every rule from the committed
CLAUDE.mdThree teams, three shapes of this. A platform team keeps a strict
CLAUDE.md⚡ Pro tip: Treat
CLAUDE.mdCLAUDE.mdTroubleshooting Common Issues
⚠️ Common mistake: Skipping
CLAUDE.mdCLAUDE.mdThe most common first-run stumble is authentication, not editing. Claude Code can run against your Claude subscription or an API key, and the two bill differently: subscription usage draws from your plan's limits, while an API key bills at standard per-token rates. For interactive work on a personal machine the subscription login is simplest; for scheduled or high-volume automation an API key gives you predictable pay-as-you-go costs. Pick deliberately, because a heavy overnight script on a subscription login can quietly eat your daily quota in one run.
If a session feels like it's ignoring your model choice, note that switching
/model--debugAnd if costs climb faster than you expected, it's almost always context, not the model. A session that's been open for an hour accumulates a long history that gets re-sent on each turn, and you pay for those tokens every time. Start a fresh session for a genuinely new task instead of continuing one indefinitely, and drop to a lighter model with
/model⚡ Pro tip: When a run goes sideways,
/resumeYour Turn
You now have a Claude Code getting started path that never puts you at the agent's mercy: install, write a
CLAUDE.mdPick one small, annoying task — the kind you keep putting off, like adding validation to a form handler or writing tests for a neglected module — and run it end to end in a scratch branch tonight. Doing one real task teaches you more than reading five more guides, because you'll hit the exact spot where you want to intervene, and you'll learn where your own comfort line sits. And save the
CLAUDE.mdContinue Reading
Save the prompts from this post
PromptABCD is a free prompt manager. Paste, organize, and reuse your best AI prompts — no more hunting through chat history.
