1. What Is Claude Code and How Does It Work?


Claude Code is an AI assistant that helps you write and improve code. But it does more than just write — it follows a simple three-step loop, over and over, until your task is finished:

  1. Read — it looks at your files, your project, your logs

  2. Think — it decides what needs to change and how

  3. Act — it edits files, runs commands, or starts other tasks

The important thing to understand is this: Claude cannot read or change files just by thinking. It needs tools to do that — like a person needs hands to build something. Claude Code comes with many built-in tools, such as reading files, editing code, and running terminal commands.

The better the tools, the more Claude can do. That's why Claude Code is so powerful.


2. How to Install It

You only need a terminal (the black window where you type commands). No special software, no code editor required.

Run this one command:

bash

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

After it installs, type claude in your terminal to start it. It will ask if it can access your current folder — say yes.

Tip: Before starting Claude Code, move into your project folder first. This way, Claude only works inside that folder and won't touch anything else on your computer.

bash

cd /path/to/your/project
claude


3. Setting Up Your Project

The first time you use Claude Code in a project, run this command:

/init

Claude will read all your project files and create a file called claude.md. This file acts like a briefing document — it tells Claude everything important about your project, every time it starts.

A good claude.md includes things like:

  • What the project does and what technology it uses

  • Which files are important

  • How the code should be written (naming rules, style, etc.)

  • Where to find key documents like your database setup

  • Notes about your environment

Why this matters: Claude reads claude.md at the start of every session. You never need to explain your project from scratch again. Set it up once, and Claude always knows the context.


4. Giving Claude the Right Information

Pointing to specific files

When you want Claude to look at a particular file, use the @ symbol:

Read @database-setup.md and tell me one table we could remove.

This is useful for large or important files — like your database schema, API documentation, or configuration files — that Claude might not find on its own.

Saving things for Claude to remember

Use the /memory command to open your project memory and add notes that Claude will always keep in mind:

/memory

You can also just open claude.md in any text editor and add your notes there directly.

Note: An older method using #remember no longer works in recent versions. Use /memory or edit claude.md instead.


5. Three Modes You Should Know

Press Shift + Tab to switch between these three modes:

Mode

What it does

Default

Claude works normally and asks you before doing anything risky

Plan mode

Claude reads your files and makes a plan — but changes nothing. Good before big tasks.

Auto-accept

Claude works without stopping to ask. Good when you trust the task completely.

About "think harder": In older versions, you could add phrases like ultra think or think hard to your message to make Claude reason more deeply. This no longer does anything — Claude Code already uses maximum thinking by default. Just write your message normally.

You can also press Escape at any time to stop Claude and give it new instructions.


6. Creating Your Own Shortcuts

This is one of the most useful features — and most people never use it.

If you keep typing the same instructions again and again, you can save them as a custom command. Create a folder called .claude/commands/ in your project, then add a simple text file inside it:

.claude/
  commands/
    write-tests.md
    review-pr.md
    explain-error.md

The name of the file becomes your command. Whatever you write inside becomes the instruction Claude follows.

Example — .claude/commands/write-tests.md:

Write unit tests for the file below. Make sure to cover edge cases.
Focus on: $ARGUMENTS

Now you can use it like this:

/write-tests src/utils/auth.ts

The $ARGUMENTS part gets replaced by whatever you type after the command name. Clean, fast, no repetition.


7. Adding Extra Powers with MCP Servers

MCP stands for Model Context Protocol. In simple terms, MCP servers are add-ons that give Claude new abilities it doesn't have by default.

Here are some examples:

MCP Server

What it lets Claude do

Playwright MCP

Open a real browser, click things, take screenshots, and check how your website looks

N8N MCP

Build automation workflows by just describing what you want in plain English

Custom MCPs

Connect any tool, API, or service so Claude can use it like a built-in feature

To add an MCP server, go to Claude Code settings or add it to your project configuration. Once it's connected, Claude finds the new tools automatically and uses them when they're helpful.


8. Connecting to GitHub

You can connect Claude Code to your GitHub account by running:

/install-github-app

After that, two things become possible:

  • In any GitHub pull request or issue, you can mention @claude and it will review the code, answer questions, or take action

  • From your terminal, Claude can push code changes, open pull requests, and reply to review comments — without you needing to open a browser


9. Hooks and the SDK

Hooks — automatic checks before and after Claude acts

A hook is a small script that runs automatically before or after Claude uses a tool. There are two kinds:

  • Pre-tool hooks — run before Claude does something. They can stop Claude if a condition is met. For example, you can use one to prevent Claude from ever reading your .env file (which contains passwords and secret keys).

  • Post-tool hooks — run after Claude does something. For example, automatically check for code errors after every file edit.

Two useful real examples:

  • Run a TypeScript check (tsc --noEmit) after every file is edited, so errors are caught right away

  • Automatically check if new code already exists somewhere in the project, to avoid writing the same thing twice

Important: Always use full (absolute) file paths in your hook scripts, not relative paths. The full path is different on every computer, so Anthropic recommends using a $PWD placeholder and replacing it with a small setup script.


The SDK — building your own agents

Claude Code also has a developer interface called the Agent SDK, available in TypeScript and Python. It lets you build your own AI tools that work the same way Claude Code does — but built for your specific needs. You can find the documentation on the Anthropic website.