Skip to content
AI Skill Index
CodingBeginner

Claude Code guide: setup, CLAUDE.md, permissions and skills

Install Claude Code, write a short CLAUDE.md, choose a permission mode, then add hooks, skills and MCP servers. Each step comes from Anthropic's docs and links to the page.

Editorial·9 min read·
Sign in to save

This guide takes you from installing Claude Code to a project set up with instructions, checks, permissions and extensions. The facts and commands come from Anthropic's Claude Code documentation, read on November 3, 2026, and each section links to the page it came from. Claude Code changes often, so if a line here and the docs disagree, follow the docs.

What Claude Code is

Anthropic calls it an agentic coding tool. It works inside your repository, where it reads the code, changes files and runs commands, and it connects to your development tools. It runs in the terminal, VS Code, JetBrains IDEs, a desktop app and the browser. All of them use the same engine, so your CLAUDE.md files, settings and MCP servers work in each one (overview).

Install it and start a session

On macOS, Linux or WSL, the recommended install is one command:

curl -fsSL https://claude.ai/install.sh | bash

In Windows PowerShell, run irm https://claude.ai/install.ps1 | iex. Homebrew (brew install --cask claude-code) and WinGet (winget install Anthropic.ClaudeCode) also work. Native installs update themselves in the background, and Homebrew and WinGet installs don't.

Open a new terminal, check that claude --version prints a version number, then start it in a project:

cd your-project
claude

It asks you to log in on first use. You need a Claude subscription (Pro, Max, Ultra, Team or Enterprise), a Claude Console account, or a supported cloud provider. The quickstart suggests opening with a question such as what does this project do? and walks through a first task from there.

Write a short CLAUDE.md

Every session starts with a fresh context window. CLAUDE.md is the file you write to carry instructions from one session to the next. Run /init and Claude generates a starter with the build commands, test instructions and conventions it finds.

Then cut it down. Claude loads the file into every session, and the memory docs suggest staying under 200 lines, because longer files use more context and Claude follows them less reliably. The best practices page says to keep what Claude can't work out from the code:

  • the exact test, typecheck and lint commands
  • places where the code misleads, such as an old pattern new code must not copy
  • decisions that aren't in the repo, such as how deploys work
  • anything you have had to correct twice

It tests each line with two questions. Could Claude find this by reading the code? Would it actually go and look? If both answers are yes, leave the line out.

Commit ./CLAUDE.md to share it with your team. Personal instructions go in ~/.claude/CLAUDE.md for all your projects, or in ./CLAUDE.local.md for one project (add that file to .gitignore). If the repo already has an AGENTS.md, Claude Code can use it instead of a CLAUDE.md. Claude also keeps auto memory, which is notes it writes itself from your corrections and preferences.

Give Claude a check to run

Claude ends a task when it judges the task finished, and without a command to run it can only judge by how the work looks. The best practices page advises handing it a command with a clear pass or fail result, such as a test file, a linter or a build's exit code. Claude can then try a change, read the command's output and correct its own mistakes, and you no longer have to catch each one by hand.

Name the check in your prompt, as in Anthropic's example:

claude "write tests for the auth module, run them, and fix any failures"

On this site, the Test writer skill and the Write tests for this function prompt are written for that job.

Decide what it can do without asking

Permission modes set what runs without a prompt:

ModeWhat runs without asking
Manual (default)Reads only
acceptEditsReads, file edits and common filesystem commands
planReads, plus commands the classifier approves when auto mode is available. Claude proposes a plan and edits nothing until you approve it
autoEverything, with background safety checks
dontAskFile reads in your working directories and pre-approved tools. Anything that would prompt is denied
bypassPermissionsEverything. Anthropic says isolated containers and VMs only

From v2.1.283, auto mode is the default for interactive terminal and VS Code sessions. A separate classifier model reviews actions in your place. A session that can't use auto mode starts in Manual. Shift+Tab cycles through the modes during a session, but dontAsk never appears in that cycle, so set it with --permission-mode dontAsk. To approve every edit and command yourself, start with claude --permission-mode manual. To read and plan first, start with claude --permission-mode plan.

Before you let it work on a shared repo, go through What to check before letting an agent touch your codebase.

Move rules that can't bend into hooks and deny rules

Claude treats CLAUDE.md as context, not enforced configuration, so a line such as "never read .env" holds almost every time. Where "almost" isn't enough, Anthropic points to hooks and deny rules, which Claude Code applies itself. A deny rule applies in every mode, bypassPermissions included.

A hook is a shell command that runs at a fixed point in Claude's loop, such as after a tool call. This one, from the hooks guide, runs Prettier on each file Claude edits and uses jq to read the file path:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [{ "type": "command", "command": "jq -r '.tool_input.file_path' | xargs npx prettier --write" }]
      }
    ]
  }
}

Put it in .claude/settings.json to share it with the project, or in ~/.claude/settings.json for all your projects. Type /hooks to see it listed.

Package repeated procedures as skills

A skill suits a checklist you keep pasting into chat, or a procedure that has outgrown CLAUDE.md. It is a folder holding a SKILL.md file. Saved as .claude/skills/<name>/ it belongs to one project, and saved as ~/.claude/skills/<name>/ it is available in all of them. Type /skill-name to run it yourself, or let Claude pick it up when a task matches. For that, every session's context holds the name and description, and Claude opens the rest only when it needs it, so a long procedure adds little until then.

For a skill with side effects, such as cutting a release, add disable-model-invocation: true. It then runs only when you type its command. Files in .claude/commands/ keep working and create commands the same way.

This site's skills unpack into those folders, including Code reviewer, Commit message writer and Pull request description writer. Each page gives the install steps. To write your own, read Writing a skill that actually gets used.

Connect outside tools with MCP

The Model Context Protocol connects Claude Code to tools outside the repo, such as an issue tracker or a database. Add a server when you keep copying data from another tool into chat. The MCP quickstart starts with Anthropic's hosted docs server, which gives Claude full-text search over the Claude Code docs and needs no sign-in:

claude mcp add --transport http claude-code-docs https://code.claude.com/docs/mcp

Anthropic says to verify you trust each server before you connect it, because servers that fetch outside content can expose you to prompt injection.

Use subagents for separate work

A subagent has a separate context window, system prompt, tool access and permissions, and it sends back a summary. It suits a side task whose search results or logs would otherwise fill your conversation:

use a subagent to investigate how our auth system handles token refresh

To define your own, add a file to .claude/agents/ for one project or ~/.claude/agents/ for all of them. Subagents draw on the same usage limits as your main conversation. Anthropic also says delegation alone won't improve an answer. The gain comes in review, from a reader who hasn't followed your thinking.

Steer a session and review the result

These controls come from the best practices page and the commands reference:

  • Esc stops Claude mid-action and keeps the work so far.
  • /rewind returns to an earlier prompt and can restore the code, the conversation or both. It doesn't restore a file that only a Bash command changed, so keep using git.
  • /clear starts a new conversation. After two failed corrections, Anthropic recommends /clear and one better prompt over a third correction.
  • /diff shows what changed, and /code-review checks the current diff for correctness bugs.
  • /doctor looks for problems in your installation and configuration.

For your own review after that, Reviewing code an AI wrote gives an order to read in, and Review a diff like a senior engineer is a prompt for the same job.

Run it from scripts and in parallel

claude -p runs without an interactive session and reads from stdin, so it fits scripts and CI:

git log --oneline -20 | claude -p "summarize these recent commits"

claude --worktree feature-auth starts a session in its own git worktree, so a second session with a different name won't collide with its edits. Common workflows has prompts for bugs, refactors, tests and pull requests.

Old advice you can drop

Anthropic's best practices page lists habits current models no longer need. Writing IMPORTANT or ALL CAPS in instructions tends to make Claude over-apply the rule. think hard in a prompt is ordinary text, and the effort setting is the control for that. Putting "keep going" in a prompt tends to produce extra work. If a run does stop short, say continue. Claude reads the repo itself, so your architecture and file layout don't belong in CLAUDE.md.

Anthropic's own Claude Code guides

What you want to doAnthropic's page
Install and run a first taskQuickstart
See install options, updates and uninstallingAdvanced setup
Find prompts for everyday tasksCommon workflows
Get better resultsBest practices
Set instructions and memoryHow Claude remembers your project
Choose a permission modePermission modes
Automate stepsHooks guide
Build a skillExtend Claude with skills
Connect a toolMCP quickstart
Define a subagentCreate custom subagents
Look up a commandCommands reference

Anthropic also runs Claude Academy, with free self-paced courses that include Claude Code 101.

If you are weighing Claude Code against Codex, the Copilot CLI, Cline or Aider, Claude Code alternatives compares them, including which of them read the skills you wrote for Claude Code.

ShareXLinkedIn

Used in this tutorial

Skill

Test writer

Writes tests that fail for the right reason and refuse to test the framework.

Skill

Code reviewer

Reviews a diff for defects, and refuses to pad the list with style opinions.

Tool

Claude Code

Anthropic's agentic coding tool for the terminal and IDE.

Cookies

We use only the cookies this site needs to work. Optional analytics helps us see which content is worth writing more of — nothing loads until you say yes.

Read the privacy policy