Programming & AI · · 15 min read

Claude Code for beginners: the setup I wish I'd had on day one


Two weeks ago I ran claude for the first time. Since then it has built this whole site while I mostly watched. This post is the order I’d set things up in if I started again: basics first, then letting it run on its own, then the habits that keep it sharp.

My actual files are in the setup post. This one is the walkthrough. Every tip has the exact setting folded underneath.

1. The first ten minutes

This post assumes a Mac and a paid Claude plan (Pro or above; the free plan doesn’t include Claude Code). Open the TerminalThe text window where you type commands instead of clicking. app (Cmd+Space, type “Terminal”, press Enter), install it with the line under “show the install”, go to a project folder with cd (“change directory”) and type claude. It works in that folder and asks before reaching outside it.

The biggest change from the chat app is how you talk to it. In the chat you ask for code and paste it somewhere. Here you say what you want to happen, and it reads the files, makes the change and runs the commands itself. So say the goal, not the steps: “the post list should show a reading time”, not “open PostList.astro and add a function”.

Then say how to check it: “run the build and fix anything that fails”, or “take a screenshot and compare it with the old one”. With a check it can run, it finds its own mistakes. Without one, finding them is your job.

Next, type /init into Claude, not the terminal: once claude is running, everything you type goes to it. Words starting with / are built-in commands; type / alone to see the list. /init reads the project and writes a CLAUDE.md file: how to run it and how the code is laid out. That file is the next section.

show the install

The install steps for a blank Mac are in the first post. The short version:

curl -fsSL https://claude.ai/install.sh | bash
mkdir -p ~/dev/my-project   # make a folder (skip if you have one)
cd ~/dev/my-project         # go into it
claude

Paste each line into Terminal and press Enter. ~ means your home folder.

It asks you to sign in with your Claude account the first time, and updates itself in the background after that. Homebrew works too (brew install --cask claude-code), but then you update it yourself.

2. Standing rules: CLAUDE.md

Every session starts knowing nothing. CLAUDE.md is what it reads first, so anything it should always know goes there. There are two you’ll use:

  • ~/.claude/CLAUDE.md applies to every project. Put how you like to work here: how much to explain, when to ask, what to never do.
  • CLAUDE.md in the project is about that project: commands, layout, and rules like “ask before adding a dependency”.

/init writes the project one. The global one you write yourself, and it matters more. Mine says, roughly: do things yourself instead of handing me steps, keep replies short, and ask before anything destructive, public or costly. “Write” can mean dictate: tell it “create my global CLAUDE.md with these rules” and paste the starter below. Keep both files short, under about 200 lines: all of it is loaded into every session, and a long file gets followed less closely.

show a starter global CLAUDE.md
# How I like to work

- If you can do it with your tools, do it. Don't hand me steps.
- Only hand off what's actually blocked: signing in, passwords, payments.
- Ask before anything destructive, public, or costly. Otherwise proceed.
- Be short. Put long explanations in files, not chat.
- I'm learning: explain what you changed and why.

The file is read when a session starts (and again after it compacts, see section 7). Change a rule mid-session and the running session won’t notice unless you tell it.

3. Let it run more on its own

How often it stops to ask you depends on its permission mode. Recent versions start in auto mode. Press Shift+Tab to cycle through the others; the current one shows at the bottom of the screen:

  • Auto: a second model reviews each action before it runs and blocks anything risky or beyond what you asked. If it blocks too often, it goes back to asking you. It’s what I use.
  • Manual: asks before every edit and command. Slow, but you see everything, which is good while learning.
  • Accept edits: edits files freely (and runs simple file commands like mkdir and mv), still asks before other commands.
  • Plan: explores and writes a plan, and edits nothing until you approve it. The docs suggest it unless you could describe the change in one sentence: reading a plan takes a minute, undoing a wrong approach takes longer. I haven’t used it much yet; I write the plan in a shared file instead (section 6).

The other half is an allow-list: commands that never need asking, like your buildA step that runs once, before anyone visits, and turns your files into plain HTML, CSS and JavaScript. or a git commit. (Read-only commands like ls or git status never ask anyway.) Pick “yes, and don’t ask again” on a prompt and it adds one for you. /permissions shows and edits the whole list.

show an allow-list

.claude/settings.json in the project:

{
  "permissions": {
    "allow": [
      "Bash(npm run build)",
      "Bash(git add *)",
      "Bash(git commit *)"
    ]
  }
}

Bash is Claude Code’s name for running a terminal command, and the * matches anything after it. Or pick “yes, and don’t ask again” a few times and it writes this file for you.

Keep asking for the things you can’t take back: pushing to the live site, deleting, anything that costs money. Put those in CLAUDE.md as rules even if the permission allows them. The permission says it can; CLAUDE.md says when.

Auto mode lowers the risk, but the docs are clear that it isn’t a guarantee. To keep it away from files with passwords and keys, add deny rules: a deny always wins over an allow.

show deny rules for secrets

In ~/.claude/settings.json, so they apply in every project:

{
  "permissions": {
    "deny": [
      "Read(.env)",
      "Read(.env.*)",
      "Read(~/.ssh/**)",
      "Read(~/.aws/**)"
    ]
  }
}

A deny on reading a file also blocks editing it. A script it runs could still open the file; only the sandbox (/sandbox) stops that.

show which settings file wins

There are three you’ll touch, and the higher one in this list wins:

  1. .claude/settings.local.json: just you, in this project. Not committed.
  2. .claude/settings.json: everyone on this project. Committed with the code.
  3. ~/.claude/settings.json: just you, in every project.

Allow-lists don’t override each other: they add up across all three.

The safety net: rewind and git

Letting it run is safer than it sounds: there’s an undo. I haven’t had to use it yet, but it’s the first thing I’d reach for. Press Esc twice with the input box empty (or type /rewind) to go back to an earlier message and restore the files, the conversation, or both.

Rewind only covers its own file edits, though. Edits by a subagent, a file deleted by a shell command, a push, or anything sent to a website stay done. That’s what git is for. Git saves snapshots of your project (each one is a “commit”), so you can go back to any of them. If your folder isn’t using git yet, ask it to “set up git here”. Then ask it to commit after each working step, and any mistake is one step back.

4. Eyes and hands: browser and Mac

Most of my “can you do X” moments weren’t about code. Change a setting in a web dashboard. Save a key. Install something that needs my password.

  • The browser. With the Claude in Chrome extension, it drives my own Chrome in its own tab: clicks through a dashboard, fills a form, reads the browser’s error log (the console) when a page breaks. It uses my existing sign-ins, and it leaves my other tabs alone. Most of this site’s setup went through it: the Google sign-in settings, the database, the email sender, the newsletter. I only pasted the secrets.
  • Admin prompts. Instead of telling me to run a sudo command (one that needs my Mac password), it runs it through osascript (a built-in Mac tool that can show system dialogs), and macOS shows its normal password dialog. I type my password there; it never sees it.
  • Desktop apps. Computer use lets it see the screen and click around Mac apps. I haven’t tried it yet. It needs a Pro or Max plan and is off until you turn on computer-use in /mcp. The docs call it “the broadest and slowest” option: it tries a connector, then the terminal, then the browser, and only then your screen.
  • What stays mine: passwords, payments, CAPTCHAs, accepting terms. When it hits a login page or a CAPTCHA, it stops and asks. It should set everything up first so my part is one click.
show how to turn on the browser

Install the Claude in Chrome extension (it works in Chrome and Edge) and sign in to Claude Code with /login (your Claude plan; an API key won’t work). Then either start with claude --chrome, or type /chrome and pick “Enabled by default”. Always-on uses a little more context in every session.

The first time it visits a site, Claude Code asks whether it may act there (in auto mode the safety check may approve it for you). One gotcha: a page that pops up a JavaScript alert freezes it until you close the alert by hand.

show the rule and the admin trick

In ~/.claude/CLAUDE.md:

- Web consoles and admin settings count too: drive my Chrome to click,
  paste and save instead of asking me to.
- Needs admin rights? Use osascript "with administrator privileges" so I
  just type my password in the macOS dialog.

What it runs:

osascript -e 'do shell script "<command>" with administrator privileges'

This is my own rule, not a built-in feature. It works because the password goes into macOS’s dialog, not into the chat.

5. A chime when it needs you

Once it runs on its own, you stop watching. Then you miss the moment it finishes or gets stuck on a question.

A hookA command Claude Code runs automatically at a fixed moment, like when it finishes a turn. It always runs, whatever the model decides. fixes that. Hooks are commands Claude Code runs at fixed moments, every time, whatever the model thinks. Mine plays a soft chime on two of them: Stop (it finished its turn) and Notification (it needs me).

show the hook

In ~/.claude/settings.json:

{
  "hooks": {
    "Stop": [
      { "hooks": [{ "type": "command", "async": true,
        "command": "afplay -v 0.4 /System/Library/Sounds/Glass.aiff" }] }
    ],
    "Notification": [
      { "hooks": [{ "type": "command", "async": true,
        "command": "afplay -v 0.4 /System/Library/Sounds/Glass.aiff" }] }
    ]
  }
}

afplay is the Mac’s built-in sound player. Any file in /System/Library/Sounds/ works. Stop fires every time it finishes replying, not only when the whole task is done.

You don’t have to write that yourself. Ask “play a sound when you finish or need me” and it will set up the hook. /hooks lists the ones you have.

The same trick works for rules that must never be skipped. A hook can run a check that catches certain code mistakes (a type check) after every edit, or refuse a command like git push --force before it runs. A rule in CLAUDE.md is advice; a hook always runs.

6. Two Claudes: chat and Code

I talk about design in the claude.ai app, often on my phone. Claude Code builds on my Mac. They can’t see each other’s conversations, so they share a file.

For the site, that’s docs/plan.md in the repo: the roadmap, decisions and a log of where the build departed from the plan. For this post, it was a Claude Doc that both sides read and edit. The chat wrote the outline; Claude Code read it at the start of the session.

The rule that makes it work: whoever changes direction updates the shared file first. The first post has the details.

7. Context: why long sessions get worse

Everything in a session, every message, file it read and command output, sits in its contextEverything the model can see in a session: your messages, its replies, files it read and command output. It is reread on every reply.. Each new reply rereads all of it. So a long session gets slower, costs more, and gets worse at remembering the details from the start.

Four tools keep it small:

  • /clear empties the context and starts fresh in the same window. Use it between unrelated tasks. It costs nothing, and the old conversation isn’t lost: /resume brings it back. Text you type after /clear on the same line names the old conversation; it isn’t sent as a request, so send the next request on its own.
  • /compact replaces the conversation so far with a summary. Use it when you’re mid-task and don’t want to lose the thread. It has to read the whole conversation to summarise it, so compacting a huge session is itself a big request.
  • /context shows what’s taking up space, as a coloured grid.
  • Subagents. Ask it to “send a subagent to look through X”. The subagent reads the files in its own context and reports back a summary, so the main session stays small.

And for a quick side question, /btw answers without adding the question or the answer to the conversation.

Here’s what that looks like in my own session logs. A fresh session starts at about 50,000 tokensThe unit AI models read and write in. Roughly ¾ of a word., before I type anything. Less than a tenth of that is my own CLAUDE.md files and memory; the rest is Claude Code’s own instructions and the list of tools it can use. Subagents start smaller, at about 40,000.

Each tool call (a file read, a command) adds about 1,000. One request of mine, a single task with lots of file reads, took a session from 58,000 to 169,000. My longest day went from 55,000 to 715,000 tokens in about four hours. By the end, a one-line question carried 715,000 tokens of history with it.

show where those numbers come from

Claude Code keeps a log of every session on your Mac, under ~/.claude/projects/. Each request records how many tokens it sent. I had it add those up for ten sessions from 8 to 21 October. (/context shows the same thing live, for the session you’re in.)

The model I use (Opus 5.5) has a 1 million token window; older models have 200,000. It compacts on its own only at about 967,000, so it never did. (/autocompact 300k makes it compact much sooner.) What did shrink it was stepping away. After about 54 minutes idle, a session over 200,000 tokens compacts itself before its short-term cache of the conversation expires (after that, rereading it costs more). That happened twice: 621,000 tokens became a 13,000-token summary, and 459,000 became 19,000. The next request was back near the starting size.

A bigger window doesn’t mean you should use it. The docs: “LLM performance degrades as context fills.” Claude may start forgetting earlier instructions or making more mistakes. Their advice when you’ve corrected it more than twice and it’s still wrong: /clear and write a better first prompt.

The habit that matters most: one session per task. Starting fresh with a link to a spec, like this post did, beats dragging a three-hour session into a new job.

/usage shows what you’ve used of your plan’s limits. On a subscription, its dollar figure is what the session would cost if you paid per token (API prices), not your bill. The limit bars are the number that matters. What those sessions would have cost at API prices is in the building post.

8. Memory

CLAUDE.md is what you write down. Memory is what it notices: when you correct it, or say “always do X”, it saves a short note in a folder outside your project and reads the index at every start.

Each note says why, not just the rule, which lets it handle cases the rule doesn’t name. Mine has ten now, from “delete merged branches” to “end turns with buttons so I can tap from my phone”.

/memory opens the notes and has a switch to turn memory off. They’re plain text files, so if one goes stale, tell it to forget it or edit the file yourself.

9. Tips that saved me time

  • Let it check its own work. Ask for screenshots before you look. It catches broken layouts before you do.
  • Turn up the effort for hard problems. /effort high makes it think longer on every reply. Writing “think hard” in a prompt no longer does anything special.
  • ! runs a command yourself. Type ! git status and the output lands in the conversation, so it sees what you saw.
  • Ctrl+B sends a slow command to the background so you can keep talking. /tasks lists what’s running.
  • Connect your hosting first. ConnectorsModel Context Protocol: a standard way to plug outside tools, like your hosting account, into an AI agent. plug your accounts in, and /mcp shows which are connected. The one I use most is Vercel, where this site lives. It watches a previewA private copy of the site, with its own link, built from a branch so you can check it before it goes live. build and opens it when it’s ready, adds DNSThe internet's address book: records that say which servers handle a domain's website and email. records, and reads the server logs. When comments broke with an error, the logs showed a missing key.
  • Let it buy things only on your yes. It found my domain, showed me the price for the first year and after, and waited until I typed “buy shrey.cloud”. The first payment failed. It knew because the tool said so, not because it guessed. It opened the billing page, I fixed my card, and the second try went through.
  • No connector? The browser is the connector. Any dashboard without one it can drive in Chrome (section 4).
  • Get a second opinion from a different model. I asked Codex, OpenAI’s coding agent, to review the whole project. It found a hole in the limit on how many comments one reader can post, which Claude had built that same week. The session that wrote the code didn’t see it.
  • Give the reviewer the same access, or read its “not verified” lines. That review also flagged that the contact form had no rate limit. A firewall rule in Vercel already limited it, but the reviewer couldn’t see Vercel. A reviewer only knows what you give it.
  • Carry on from your phone. /remote-control connects the Claude app on your phone to the session on your Mac.
show one model vs several

I once asked the same question two ways: a council of three models that only had my description, and one Claude Code agent with access to the repo and DNS. Both found the big items. Only the council thought of things outside the code, like email scanners clicking sign-in links before the reader does. Only the agent found things it could check, like a missing email record that made my address bounce. Different models find different things; the one with access finds the concrete ones.

Connect only what you’ll use, too. I have a few connectors that have never been called for this site.

10. Mistakes to avoid

  • Approving without reading. The prompt says exactly what it’s about to run. Read it, especially when it touches anything outside the project.
  • One session for everything. It gets slower and forgetful (section 7).
  • Pasting long lists of steps. Say the goal, and let it work out the steps. It often finds a better route than the one I’d have written.
  • Following old tutorials. Claude Code changes every week, and plenty of advice from 2025 no longer works.
show advice that's out of date
Old advice Now
Write “think hard” in the prompt /effort high
Start a line with # to save a memory Say “add this to CLAUDE.md”, or /memory
A .claudeignore file Read(...) deny rules (section 3)
Tell it to keep a todo list Not needed on current models
/agents to make a subagent Ask for one, or add a file in .claude/agents/
--dangerously-skip-permissions to stop prompts Auto mode, the default

Checked against the changelog on 21 October 2026.

11. A day-one checklist

Each line links back to its section.

  1. Install, cd to a project, run claude.
  2. Run /init, and tell it how to check its work.
  3. Write ~/.claude/CLAUDE.md with how you like to work.
  4. Allow your build and git commits.
  5. Learn Shift+Tab and Esc Esc (rewind).
  6. Give it a browser: install Claude in Chrome.
  7. Add the chime hook.
  8. Keep a shared plan file if you use the chat app too.
  9. One task per session; /clear between.
  10. Commit often, so any mistake is one step back.