Guide
April 2026 · aistro.online

Claude Code — Complete Guide 2026

Claude Code is Anthropic's official agentic CLI that brings Claude directly into your terminal. It reads and edits files, runs shell commands, manages git, and navigates entire codebases — all through natural language. This guide covers everything from first install to advanced power-user workflows.

What Is Claude Code?

Unlike a chat interface, Claude Code is an autonomous agent that operates inside your project directory. It can plan and execute multi-step tasks, spawn parallel sub-agents, hook into your git workflow, and remember project context across sessions — without you having to copy-paste code back and forth.

Key distinction: Claude Code doesn't just suggest code — it reads your files, makes the edits, runs the tests, and commits the changes. You stay in control via a tiered permission system.

Installation & Free Setup

Claude Code requires a Claude Pro ($20/mo) or Max subscription by default. But you can route it through OpenRouter's free models to use it at no cost — great for experimentation.

Standard Install

  1. Install via npm: npm install -g @anthropic-ai/claude-code
  2. Run claude in your project directory
  3. Sign in with your Anthropic account on first launch

Free Setup via OpenRouter

Create or edit .claude/settings.local.json in your project (gitignored by default):

{
  "env": {
    "ANTHROPIC_AUTH_TOKEN": "any-string-here",
    "ANTHROPIC_BASE_URL": "https://openrouter.ai/api",
    "ANTHROPIC_DEFAULT_SONNET_MODEL": "minimax/minimax-m2.5:free"
  }
}
Note: Free models require more structured, explicit prompts. They work well for focused tasks but may struggle with large multi-file operations that Sonnet/Opus handle seamlessly.

Keyboard Shortcuts

ShortcutAction
Shift + EnterNew line without sending
Shift + TabCycle permission modes
Ctrl + CCancel current operation
Cmd/Meta + TToggle Extended Thinking
Cmd/Meta + POpen model picker

Permission System

Claude Code uses a tiered approach so you're never surprised by unexpected file changes:

Permission mode is set in .claude/settings.json (shared via git) or ~/.claude/settings.json (personal). Modes: default, plan (read-only analysis), auto (AI decides), acceptEdits (auto-approve file edits).

Essential Slash Commands

CommandPurpose
/initInitialize project — creates CLAUDE.md
/compactCompress conversation context
/clearWipe context and start fresh
/diffInteractive diff viewer
/modelSwitch between Opus / Sonnet
/planPlan before coding
/memoryManage saved context

CLAUDE.md — Project Memory

Claude Code reads CLAUDE.md at the start of every session. Think of it as a permanent briefing document for the AI. Include:

Keep it under 200 lines. For larger projects, split rules into .claude/rules/ files. Run /init to generate a starter version automatically.

Hooks — Automation at Every Step

Hooks let you run shell commands at specific lifecycle points. Configure them in settings.json:

Example: auto-run prettier after every file edit, or eslint --fix after JS changes.

MCP Servers

Model Context Protocol servers extend Claude Code with external integrations — browsers, databases, APIs, design tools. Add one with:

claude mcp add --transport stdio playwright -- npx @playwright/mcp@latest

Install plugins from the marketplace with /plugin install. Popular MCP servers: Playwright (browser automation), Figma, Postgres, filesystem extensions.

Model Selection

ModelBest forCost
Opus 4.6Complex, multi-step tasks$$$
Sonnet 4.6Daily coding (recommended default)$$
MiniMax M2.7Strong coding, budget-friendly$
DeepSeek V3Simple tasks, cheapest option¢

Use /model to switch mid-session. Non-Anthropic models require routing through CC Switch or OpenRouter as shown in the free setup above.

Recommended Workflow

The three pillars of effective Claude Code use:

  1. Modular structure — split files at ~300 lines so Claude has focused context
  2. One task per session — plan → code → test → commit → /clear
  3. Understand before prompting — know the building blocks of what you're asking

Power Prompts

Force planning before coding

"Analyze the structure, list every file you'll touch, explain the changes you plan to make, then wait for my approval before writing any code."

Root-cause debugging

"Find the root cause of this bug — don't just fix the symptom. Explain exactly what's wrong, fix it properly, then run the tests."

Parallel sub-agents

"Split this into 3 independent tasks and run them in parallel using sub-agents: [task A], [task B], [task C]."

Clarify before starting

End any complex prompt with: "Ask me any clarifying questions before you start." This prevents Claude from making wrong assumptions on large tasks.

IDE Integration

Claude Code integrates with VS Code, Cursor, JetBrains IDEs (IntelliJ, PyCharm, WebStorm), and any terminal. In VS Code, install the Claude Code extension for inline diffs and a dedicated panel. In Cursor, it works alongside Cursor's own AI features.

Custom Commands & Skills

Skills (recommended): Markdown files at .claude/skills/name/SKILL.md with YAML frontmatter. They auto-trigger based on context and can bundle resources.

Legacy commands: Still supported at .claude/commands/. Use $ARGUMENTS to accept input when invoked via /command-name.

Frequently Asked Questions

Does Claude Code require a paid subscription?

Yes — by default it requires Claude Pro ($20/mo) or Max. The free workaround via OpenRouter (described above) works well for lighter use.

What happens when context gets full?

Claude Code auto-compacts when the context window fills. You can also run /compact manually to summarize the conversation, or /clear to start fresh (losing history but freeing all context).

Can I use it without an internet connection?

No — Claude Code requires a connection to the model API. For local/offline use, consider routing to a local model via Ollama or LM Studio through the ANTHROPIC_BASE_URL override.

Is it safe to use on sensitive codebases?

The permission system gives you full control. Use plan mode for read-only analysis, review every bash command before approval, and keep secrets in gitignored settings.local.json.

Browse all AI coding tools at aistro.online · See also: Best AI Coding Assistants 2026 · Cursor vs GitHub Copilot