Skip to content
Sharbel.

How to Use Claude Code: The Complete Guide

Setup, permission modes, CLAUDE.md, context, cost, skills, hooks and the seven day path to actually learning it.

From the videoLearn 95% Of Claude Code In 29 Minutes

Claude Code is Anthropic's coding agent. It runs inside your project folder, edits your real files, and shows you what it changed. You install it with one command or from the Claude desktop app, point it at a folder, and then control three things: permissions, a CLAUDE.md file, and your context window. Get those three right and it stops fighting you.

Most people install it, watch it burn through a usage limit in an afternoon, and conclude it is overhyped. The tool is fine. The defaults are what get you. This guide covers the parts that actually decide whether it works, in the order you need them.

What Claude Code is, and how it differs from the Claude app and Cowork

There are three Claudes and each is built for a different job.

The Claude app is the normal chat. Questions, quick lookups, explaining an error, drafting an email. You ask, you get an answer, you move on.

Cowork does work on your computer. Point it at a messy folder and it sorts every file. Hand it a hundred PDFs and it pulls every invoice total into one spreadsheet.

Claude Code writes code. It lives inside your project and it builds: a full app from scratch, a bug fixed across your codebase, a feature added to something you already shipped.

The one idea worth carrying: Claude Code does not suggest code. It does the work in your actual project and then shows you what it did.

How to install Claude Code

Two paths, about two minutes either way.

Terminal:

bash
npm install -g @anthropic-ai/claude-code

Then type claude and hit enter.

Or install the Claude desktop app and find Claude Code inside it. No terminal at all. That is the path most people should take.

Two install paths: the terminal with npm install -g @anthropic-ai/claude-code, or the Claude desktop app

Either way, point it at a folder. An existing codebase, or an empty folder for something new. From that second it can see everything inside that folder, which is the whole point.

Claude Code permission modes, and which one to use

Before a file changes or a command runs, Claude Code can stop and ask. That is the permission mode. Cycle it with shift+tab, or click it in the desktop app.

  • Auto is the default. A second model checks each action in the background, so it only stops you for what actually matters.
  • Manual asks before every change. Correct, and unbearably spammy.
  • Accept edits stops asking about file edits and makes them while you watch.
  • Plan only plans. Nothing changes until you approve the plan.
  • Bypass permissions is a separate toggle. Enable it and Claude never asks for anything, ever.

The permission menu: Auto, Manual, Accept edits, Plan, and the Bypass permissions toggle

Use Auto for most work. Start with Bypass permissions off. Turn it on later, once you know what it does when nobody is watching.

What CLAUDE.md is, and the prompt that writes it for you

If you take one thing from this guide, take this.

CLAUDE.md is a plain text file in your project. Every time Claude Code starts, it reads that file first. It is a memory that survives. Without it you re-teach the same context every session. With it, Claude Code walks in already knowing your rules.

CLAUDE.md sitting in a project tree beside src, package.json and README.md. No install, no config, no format

The trap is dumping everything into it. The whole file tree, every dependency, a paragraph on the architecture. That file loads into memory on every single session, so every line you put in it, you pay for, on every message you send. Stuff it full and you burn tokens all day while burying the rules that actually matter, so it follows them less.

Every message pays for it: a bloated CLAUDE.md drives per-message tokens from 780 to 4,316 and rules actually followed from 88% down to 18%

The fix is that you write none of it. Paste this in and let Claude write its own instructions:

Read my whole codebase and write me a CLAUDE.md. Keep it under 40 lines. Only include what you could not work out by reading the code yourself. The exact build and test commands, the conventions I follow, the folders to never touch, and my always-do-it-this-way rules. Do not describe the file structure, and do not list dependencies. Be specific.

That returns a tight, high signal file in about thirty seconds. If yours has already grown into a monster, do not start over. Run /doctor. It reads the file, shows you everything Claude could already work out for itself, and trims it the moment you say yes.

One honest catch: this file is guidance, not a cage. Claude reads it and almost always follows it. Almost. For something that has to happen every time, like running tests before a commit, you want a hook, not a line in here.

How the context window works, and the three commands that manage it

Claude Code has a memory limit for a single conversation, called the context window. Everything it has read and done this session sits inside it.

Here is the part nobody warns you about. As that window fills, the tool gets worse. It forgets your early instructions, repeats itself, and re-breaks things it already fixed. It is not getting dumber. It is getting full.

It is not getting dumber, it is getting full. As the window fills it forgets your early instructions, repeats itself, and re-breaks what it already fixed

Three moves:

  • /context shows how full it is. The small wheel next to the chat window shows the same thing faster.
  • /compact summarises the session so far and frees room. You lose detail in the squeeze.
  • /clear wipes it entirely. The equivalent of a new chat.

The professional habit is not to compact endlessly. Finish a task, /clear, start the next one clean, and let CLAUDE.md carry the important things across.

This is what is really happening when it feels like it got dumb halfway through a session. It did not get dumb. The window filled up and you did not catch it.

What Claude Code costs, and which model to pick

Cost depends almost entirely on two things you control: which model you use, and how full your context gets. Every message carries the whole conversation with it, so a long bloated session is not just forgetful, it is expensive. You are paying to re-send everything, every turn.

Pick the model for the job: Haiku for simple mechanical tasks, Sonnet for routine well scoped work, Opus for complex work needing judgement, Fable for the genuinely hard problems

The model line-up, cheapest first:

  • Haiku is fastest and cheapest. Simple mechanical tasks.
  • Sonnet is the generalist you will live in. Routine, well-scoped work.
  • Opus is the expert. Complex problems needing real judgment.
  • Fable is the specialist. The genuinely hard things smaller models keep failing.

The bigger and more ambiguous the problem, the bigger the model.

One thing that costs people real money: set your model at the start of a session, not partway through. Every model keeps its own separate cache of your conversation. Switch mid-session and the new one has none of that cache, so it re-reads the entire conversation from scratch at full price. Claude Code will stop and ask you to confirm, because it knows what it is about to cost you.

Claude Code is not expensive if you drive it properly. It is expensive if you put your senior engineer on every tiny job and never clear the desk.

How to install Claude Code skills

A skill is a saved procedure. Install or write one once and Claude Code knows how to do that task correctly, forever. It is the difference between telling a new hire how to do something and handing them the handbook.

You already have some. /code-review goes through your changes hunting real bugs, not style. /security-review looks for holes in what you just wrote. Both ship built in.

Three more worth installing on day one:

bash
# Anthropic's own skills: real Word files, Excel sheets, slide decks, PDFs
/plugin marketplace add anthropics/skills
/plugin install document-skills@anthropic-agent-skills

# Superpowers: interviews you, writes a plan, builds test first
/plugin install superpowers@claude-plugins-official

# Oh My Claude Code: routes each job to the model that suits it
/plugin marketplace add https://github.com/Yeachan-Heo/oh-my-claudecode
/plugin install oh-my-claudecode

obra/superpowers: it refuses to start coding the second you ask. It interviews you first, writes a plan, builds it test first, and sends subagents to review its own work

oh-my-claudecode: it routes each job to the model that suits it. Cheap models for the small work, expensive ones for the hard work

The honest catch: a skill is not just text. It can run shell commands on your machine. Before you install one, ask Claude to read it and tell you whether it is safe.

What subagents do

A subagent is a second Claude your main Claude hands a job to. It runs in its own context, does the task, and reports back with just the answer. The messy, token-heavy work happens off to the side and your main session stays clean. Use /agents to set them up.

The heavy reading happens off to the side: your session stays clean while subagents read, search and summarise, and only the summary comes back

The catch is that subagents cannot talk to each other, and each one costs. This is not about spawning ten agents for a thumbnail. It is about pushing large, dirty reading and searching jobs off your main thread.

MCP or the command line: which to use

To do real work, Claude Code often needs to reach outside your folder. Your database, GitHub, a browser.

MCP (Model Context Protocol) is an adapter that plugs a service directly in, with permissions and structure. Add one with claude mcp add.

The command line means letting Claude use tools you already have, like the GitHub CLI.

MCP versus the command line: MCP is structured and safe but loads its instructions into every session, the CLI is lighter but messier

The tradeoff that matters: every connected MCP server loads its instructions into your context whether you use it that session or not. The CLI is lighter but messier.

So connect an MCP server when you will genuinely use it a lot. Lean on the CLI for one-off jobs. And go into Connectors, Manage Connections, and turn off anything you have not used in a month. You are paying for those instructions in every message.

Six Claude Code hacks worth learning today

  1. Make it interview you first. Put use askuserquestion until you reach clarity at the end of your prompt. It fires multiple choice questions at you, you answer, then it builds the thing you actually wanted. More wrong builds come from vague asks than from hard problems.
  2. Turn the thinking up. /effort sets the dial: low, medium, high, extra, max. For a single message, put the word ultrathink anywhere in the prompt. It costs more because it thinks for longer.
  3. Point at files with @. Type @, start typing a filename, and it pulls that exact file in. It stops hunting and stops reading the wrong thing.
  4. Never sit and wait. Type your next instruction while it works and it queues behind the current one. Hit escape to stop, and it keeps the work already done.
  5. Show it, do not describe it. Paste a screenshot straight into the prompt. Describing a broken layout in words is slow and loses detail.
  6. Ask side questions with /btw. You get your answer without adding it to the session history, so your context stays clean.

Six that take seconds to learn: make it interview you first, turn the thinking up, point at files with @, queue while it works and escape to stop, show it do not describe it, ask side questions with /btw

And one worth ten of those: /batch takes a big job, splits it into as many as thirty pieces, runs them in parallel in their own copies of your project, and opens the pull requests when they are done.

Every one of these is speed, not judgment. /batch will happily open thirty pull requests full of the same wrong idea, and ultrathink on a vague prompt buys you a confidently wrong answer more slowly and more expensively. The prompt still has to be good.

What to do when Claude Code goes wrong

Three failure modes, three fixes.

  • The loop. It tries a fix, fails, tries almost the same fix, fails again, forever. Do not repeat yourself. Change the instruction entirely.
  • Confidently wrong. It acts on a misunderstanding and your code is worse. Make it explain before it acts.
  • It did too much. Use /rewind to roll the conversation and its changes back. Then remember git exists: git status to see what it touched, git restore to undo since your last commit.

Three ways it goes wrong, three ways out: the loop, change the instruction. Confidently wrong, make it explain first. Did too much, /rewind or git restore

Commit before you start. That is the whole trick.

How to make Claude Code check its own security

Claude Code will build you a working app you can ship without opening a single file it wrote. Running and safe are not the same thing.

Instead of a checklist you will not follow, install the official plugin:

bash
/plugin install security-guidance@claude-plugins-official

In the desktop app: the + button next to the prompt, then Plugins, then Add plugin.

It reviews Claude's code while Claude writes it, on three levels. Every file written is pattern matched for dangerous things, and that layer is free because there is no model behind it. At the end of every turn it diffs what changed and sends it to a background review. On every commit it runs a deeper review that reads the surrounding code first. That review is a separate call with a fresh context and one instruction, so it is not the same Claude grading its own homework.

It reviews on three levels: every file edit pattern matched and free, the diff reviewed at the end of every turn, and a deeper read on every commit

Two things to know before you install: it needs Python 3.7 or later on your PATH, and 3.10 or later for the commit review. On first run it builds a virtual environment. And only the per-edit pattern check is free. Both model-backed layers cost usage.

The honest catch: none of this blocks anything. It does not stop the write, it does not stop the commit, and it can still miss things.

Hooks, and running Claude Code from your phone

Hooks are automatic rules that fire on a trigger. Every time it finishes editing a file, run the tests. Set once, happens forever.

They live in ~/.claude/settings.json for you or .claude/settings.json for a project. You do not write that file yourself. Say it in plain English:

add a hook that runs my tests every time I edit a file

It writes the rule, saves it, and it goes live without a restart. Then /hooks shows every rule you have running and where each came from. Note that /hooks is view only. You change hooks by asking Claude or editing the file.

A hook fires on a trigger: every time a file is edited, the tests run, set once and it happens forever

Remote control pairs your phone to a session running on your machine. Run claude remote-control, press space to show the QR code, then open the Claude app on your phone, go to Code, and scan it. From then on you can approve a permission prompt from the sofa, send new instructions, and watch output land.

The work is still running on your computer with your files and your tools. Your phone is only the steering wheel. It needs a Pro, Max, Team or Enterprise plan and a claude.ai login. It does not work on an API key, on Bedrock, Vertex or Foundry, or with a custom ANTHROPIC_BASE_URL. Your computer has to stay awake, and Ctrl+C ends the session.

On hooks, one warning: automation multiplies mistakes as fast as it multiplies work. A hook that runs the wrong command runs it every single time.

When Claude Code is the wrong tool

It is the wrong tool when the job is tiny and you already know the answer. If you need a fast question answered that has nothing to do with a codebase, just ask Claude chat.

The honest catch on all of it: Claude Code makes a mediocre engineer faster and a careless engineer dangerous. It amplifies whoever is driving. It does not replace judgment, it scales it in both directions.

A seven day plan to learn Claude Code

You do not need to master all of this today. Each day removes the reason you could not go further the day before.

  1. Install it. Point it at a folder and make one small change in plan mode.
  2. Write your CLAUDE.md with the prompt above. Every session after this one starts smarter, so this is the day that pays back longest.
  3. Learn the meter. Watch context fill and clear between tasks instead of compacting forever.
  4. Pick your model and effort on purpose instead of leaving the default.
  5. Install the security plugin and one skill. Safer and more capable, and neither took work.
  6. Break something on purpose and get out with /rewind. This is the day you stop being scared of it.
  7. Hand it a real job you have been putting off. Turn on remote control, walk away, and watch it from your phone.

The 7-day path: install it, write your CLAUDE.md, learn the meter, pick your model and effort, install the security plugin and one skill, break something and recover with /rewind, then hand it a real job

Do that for a week and it stops feeling like a fight. The hard part was never the tool. It was starting on the right step.

Chapters

Time Section
0:00 Intro
0:57 The mental model
2:10 Setup
3:12 Permissions
4:36 CLAUDE.md
6:57 Context
8:59 Cost
11:52 Skills
14:21 Subagents
15:31 MCP vs the CLI
17:25 The six hacks
20:53 When it breaks
22:15 Security
23:59 Hooks and phone
26:07 The wrong tool
27:02 The 7-day path

Start here

Install it, point it at a folder, and run the CLAUDE.md prompt above before you do anything else. That single file is what makes every session after it start smarter, and it takes about thirty seconds to produce. Everything else on this page is easier once it exists.

Questions

What is CLAUDE.md and where does it go?
CLAUDE.md is a plain text file in your project root. Claude Code reads it first every time it starts, so it works as a memory that survives between sessions. Keep it under about 40 lines and include only what cannot be worked out by reading the code, such as build commands, conventions and folders never to touch.
Why does Claude Code get worse partway through a session?
The context window filled up. Everything it has read and done that session sits inside it, and as it fills the model forgets early instructions, repeats itself and re-breaks things it already fixed. Check it with /context, then use /clear between tasks rather than compacting endlessly.
How do I reduce what Claude Code costs?
Two levers control almost all of it: which model you use and how full your context gets. Use Haiku or Sonnet for routine work and save Opus or Fable for genuinely hard problems. Set the model at the start of a session, because switching midway makes the new model re-read the whole conversation at full price.
Is code written by Claude Code safe to ship?
Running and safe are not the same thing. Install the official security-guidance plugin, which pattern matches every file edit for free and sends the diff for a background review at the end of each turn. It surfaces findings but does not block writes or commits, so you still have to read them.
Can I run Claude Code from my phone?
Yes, with remote control. Run claude remote-control on your computer, press space to show the QR code, then scan it from the Code tab in the Claude phone app. The work still runs on your machine. It needs a Pro, Max, Team or Enterprise plan and does not work with an API key or a custom base URL.
Sharbel Ayyoub

Written by

Sharbel Ayyoub

I build AI tools and agents for my own business, then show the whole process on YouTube: what shipped, what it cost, and what broke. This write-up is the build behind one of those videos.

You made it to the end

That is the whole build. Want the next one?

Free. One per video, about twice a week.

Read next