Rick-Brick
Claude Code Complete Beginner's Guide — Systematically Understanding All Features of the AI Coding Agent

Claude Code Complete Beginner's Guide — Systematically Understanding All Features of the AI Coding Agent

48min read

Introduction — What is Claude Code

In February 2025, Anthropic released Claude Code, a revolutionary AI coding tool that fundamentally redefines the concept of AI-assisted development. It not only predicts and suggests code but autonomously handles tasks like file reading/writing, executing commands, git operations, and PR creation.

Difference from Simple Code Completion

Traditional AI coding tools mainly performed “code completion”: predicting the next segment based on cursor position, which developers then review and accept. While effective, it remains purely a “suggestion”.

Claude Code surpasses this. When a developer instructs it to “write tests for this authentication system, run them, and fix any issues,” Claude Code reads files, generates and runs tests, analyzes errors, modifies code, and re-tests—all autonomously.

# Automate test generation and fixing
yet="write tests for the auth module, run them, and fix any failures"
claude "$yet"

# Monitor logs for anomalies in real-time
tail -200 app.log | claude -p "Slack me if you see any anomalies"

# Security review
git diff main --name-only | claude -p "review these changed files for security issues"

Operating Environment

Claude Code can be used in various environments:

EnvironmentMethod
Terminalclaude command (CLI)
VS Code / CursorExtension
JetBrains IDEPlugin
Desktop AppClaude Desktop
Browserclaude.ai

Most developers access it via the terminal using the claude command. Starting in the project root initiates a session with access to the entire codebase.

Feature Development Timeline

Since its release in February 2025, Claude Code has rapidly expanded its capabilities:

FeatureRelease Date
Release of Claude CodeFeb 2025
MCP IntegrationNov 2024
SubagentsJul 2025
HooksSep 2025
SkillsOct 2025
Agent TeamsFeb 2026

As of March 2026, Claude Code has evolved into a platform that can be called an “AI Coding OS.” This article systematically explains these features.


Installation and Initial Setup

Installation Methods

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

This installs natively with automatic updates in the background.

Windows PowerShell

irm https://claude.ai/install.ps1 | iex

Windows requires Git for Windows.

Homebrew (macOS)

brew install --cask claude-code

Note: When installed via Homebrew, it does not auto-update; run brew upgrade claude-code periodically.

First Launch and Authentication

Navigate to your project directory and run:

cd your-project
claude

On first launch, login authentication is required. Once authenticated, an interactive chat interface appears, allowing you to give instructions.

Basic Commands

Remember these common commands:

CommandDescription
claudeStart interactive session
claude -p "prompt"Non-interactive execution (for CI/CD)
claude --continueResume last session
claude --resumeChoose and resume past session
/initAuto-generate CLAUDE.md
/clearReset context
/compactCompress context
/memoryView/edit CLAUDE.md and memory files
/agentsManage subagents
/hooksCheck hook settings
/permissionsManage permissions
/skillsCheck skills

CLAUDE.md — Designing the “Memory” of the Project

What is CLAUDE.md?

Claude Code always loads a Markdown file called CLAUDE.md at session start. It documents coding standards, workflows, architecture decisions, serving as a “persistent context” to prevent repeatedly explaining the same information.

It’s akin to giving a new engineer a document summarizing team rules beforehand. Claude Code reads this document before starting work.

3 Levels of Placement

CLAUDE.md can be managed across three scopes:

ScopePathTargetShared in Team
Organization Policy/etc/claude-code/CLAUDE.md (Linux)All usersIT Admin
Project./CLAUDE.md or ./.claude/CLAUDE.mdProject membersGit-managed
User Personal~/.claude/CLAUDE.mdAll projectsPersonal only

When multiple CLAUDE.md files exist, specific scopes take precedence. For shared rules, use the project-level CLAUDE.md. For personal preferences like editor setups, use the user-level one.

What to Write or Not

Guidelines for effective CLAUDE.md:

What to WriteWhat Not to Write
Bash commands Claude cannot predictReadable from code
Non-default code stylesKnown language conventions
Testing policies and frameworksDetailed API docs (use links)
Branch and PR naming conventionsFrequently changing info
Project-specific architectureObvious instructions like “write clean code”
Essential environment variablesList of files in codebase

Sample:

# Example CLAUDE.md for Project

## Style
- Use ES modules (`import`/`export`); no CommonJS (`require`)
- Prefer destructuring imports

## Workflow
- Run type checks after changes: `npx tsc --noEmit`
- Run tests only on specific files

## Commands
- Build: `npm run build`
- Test: `npm test`
- Lint: `npm run lint`

## Security
- Secrets in `.env.local`; do not commit
- PR base branch: develop (no direct push to main)

/init Auto-generation

For existing projects, /init is handy. Claude Code analyzes the codebase, detects build/test commands, project rules, and generates an initial CLAUDE.md. Review, delete unnecessary parts, add missing info.

Managing Rules with .claude/rules/

For large projects, CLAUDE.md can grow too long, so split rules into files under .claude/rules/:

.claude/
  CLAUDE.md
  rules/
    code-style.md
    testing.md
    security.md
    branching.md

Rules can also be applied selectively to specific files with frontmatter:

---
paths:
  - "src/api/**/*.ts"
---
# API Development Rules
- Include input validation for all endpoints
- Use RFC 7807 for error responses

This applies only when editing files under src/api/.

Auto Memory (Learning Support)

Version 2.1.59 and above introduces Auto Memory. Claude Code automatically saves what it learns—discovered bugs, design decisions, frequently used build commands—into a memory file.

Stored at ~/.claude/projects/<project>/memory/MEMORY.md. Use /memory to view/edit. This lets the session remember previous insights and resume work seamlessly.


Skills — Packaging Reusable Workflows

Concept of Skills

Skills are packaged workflows or knowledge stored in SKILL.md files. Invoke them with slash commands (/skill-name) or let Claude automatically load relevant skills.

For example, defining a “Fix GitHub Issue” skill can enable /fix-issue 123 to perform the entire process: review details, modify code, run tests, create PR.

While CLAUDE.md commands are always active and apply broadly, Skills are invoked only when needed, acting as reusable units.

Structure of SKILL.md

Skills include YAML frontmatter and content:

---
name: fix-issue
description: >
  Fix GitHub issue. Used when issue number is specified.
disable-model-invocation: true
user-invocable: true
allowed-tools: Read, Grep, Bash, Write, Edit
---

Fix the GitHub issue $ARGUMENTS.

1. Use `gh issue view $ARGUMENTS` to understand details
2. Identify related files and implement fixes
3. Write and run tests, ensure passing
4. Commit with descriptive message and create PR

Arguments are filled via $ARGUMENTS, e.g., /fix-issue 123. Multiple arguments accessible via $ARGUMENTS[0], $ARGUMENTS[1].

Frontmatter Main Fields

FieldDescription
nameSlash command name (lowercase, hyphens, max 64 chars)
descriptionUsed by Claude to assess relevance
disable-model-invocationtrue for user-only invocation, safe for actions like deploy
user-invocablefalse hides from slash menu
allowed-toolsTools permitted during invocation
contextfork for isolated sub-agent
modelModel to use
effortThought effort level (low, medium, high, max)

Reference vs Task Skills

Skills can be broadly categorized:

  • Reference Skills: Inject specifications or documentation on demand, keeping CLAUDE.md concise.
---
name: api-spec
description: >
  Reference REST API specs for related implementation.
user-invocable: false
---
# API spec snippets
---
  • Task Skills: Package specific operations—code review, deployment, issue resolution.

Call Control Settings

Control which users or Claude can invoke skills:

FrontmatterUser LaunchAuto Launch
(default)YesYes
disable-model-invocation: trueYesNo
user-invocable: falseNoYes

Set disable-model-invocation: true for sensitive skills like deployments.

Built-in Skills

Claude Code includes native skills:

SkillUse
/batch <instruction>Run bulk changes
/claude-apiLoad Claude API reference
/debug [desc]Debug session logs
/loop [interval] <prompt>Repeat prompts (polling)
/simplify [focus]Improve recently changed code

CLAUDE.md vs Skills Comparison

CLAUDE.mdSkills
Load TimingAlways at startCall/auto-detected
Best ForProject rules & policiesReusable procedures, expertise
Context UseAlways consumedWhen needed

Subagents — Delegating Tasks to Experts

Concept of Subagents

Subagents are independent AI assistants specialized in specific tasks. Each has its own context window, prompt, and tool access.

They excel at tasks like “reading a large number of files,” “read-only access,” or “reducing cost by offloading to lightweight models.”

Four Benefits

  1. Context Protection: Subagents explore files within their own context, returning only summaries, not polluting main conversation.
  2. Tool Restrictions: Limit tools for subagents—for instance, read-only—preventing accidental file modifications.
  3. Expert Specialization: Define agents with domain-specific prompts, e.g., “security review,” “performance optimization.”
  4. Cost Efficiency: Delegate heavy tasks to lightweight models, reserving larger models for critical decisions.

Built-in Subagents

Claude Code includes three built-in agents:

AgentModelPurpose
ExploreHaiku (fast)Read-only codebase exploration
PlanInheritedResearch in planning mode
General-purposeInheritedComplex multi-step tasks

How to Define Custom Subagents

Define in a Markdown file with YAML frontmatter:

---
name: code-reviewer
description: Domain expert for code review.
tools: Read, Grep, Glob, Bash
model: sonnet
---

You are a senior code reviewer. Check:
- Readability, naming, duplication
- Error handling
- Security (secrets, input validation)
- Test coverage
- Performance

Provide prioritized feedback with specific examples.

Place in .claude/agents/. For user-wide access, put in ~/.claude/agents/.

Major Frontmatter Fields

FieldPurpose
nameIdentifier (lowercase, hyphens)
descriptionUsed for delegation decision
toolsAllowed tools
disallowedToolsTools to exclude
modelsonnet, opus, haiku
permissionModeAccess mode (default, acceptEdits, dontAsk, bypassPermissions, plan)
maxTurnsMax turns
isolationworktree for isolated git worktree

Calling Method

Invoke subagents in three ways:

# Natural language (Claude decides)
"Use code-reviewer to review recent changes"

# Mention (@) for explicit use
@"code-reviewer" authの変更をレビューして

# Agent mode start
claude --agent code-reviewer

Agent Teams — Coordinating Multiple Agents

Difference from Subagents

Released in February 2026, Agent Teams advance Subagents by enabling multiple agents to communicate and work in parallel.

SubagentsAgent Teams
CommunicationMain → Sub (one-way)Agent ↔ Agent (two-way)
Suitable forSingle task delegationLarge-scale parallel, long-term
SessionMain sub-sessionIndependent collaborative session

Four Core Components

  • Lead: Oversees the team, decomposes tasks, assigns to Teammates, manages progress and quality.
  • Teammates: Specialized agents executing instructions, each with unique prompts.
  • Task List: Tracks tasks and dependencies, identifies parallelizable tasks.
  • Mailbox: Asynchronous messaging for results and questions.

When to Use Teams

task_is_complex?
  ↓ No → Regular Claude Code
  ↓ Yes
fits_in_context?
  ↓ Yes → Use Subagents
  ↓ No
are_independent_subtasks_available?
  ↓ No → Sequential (single agent)
  ↓ Yes → Use Agent Teams

Ideal for large refactors, multi-module updates, complex data pipelines, and cross-repository consistency checks.


Hooks — Fully Guaranteed Automation

Concept of Hooks

Hooks are scripts that run at specific lifecycle events of Claude Code. They aim to automate reliably—overcoming the partial compliance of instructions.

While commands in CLAUDE.md are suggestions Claude attempts to follow (~80% adherence), Hooks execute 100%.

Use Hooks for critical automation like auto-linting or blocking dangerous commands.

Event Types

EventTriggerMain Use
SessionStartStart of sessionSetup environment
UserPromptSubmitUser submits promptFilter inputs
PreToolUseBefore tool runsBlock dangerous commands
PostToolUseAfter successful toolRun lint, log
PostToolUseFailureOn tool failureError handling
StopEnd of Claude responseQuality check, decide continue
SubagentStartSubagent launchSetup
SubagentStopSubagent endCleanup
SessionEndEnd of sessionRecord stats

Setting Up

Configure in .claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [{"type": "command", "command": "npm run lint --fix"}]
      }
    ],
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{"type": "command", "command": "./.claude/hooks/check-dangerous-command.sh"}]
      }
    ]
  }
}

Example: after editing files, auto-run lint.

Sample check script:

#!/bin/bash
# .claude/hooks/block-dangerous.sh

INPUT=$(cat)
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')

if echo "$COMMAND" | grep -q 'rm -rf'; then
  echo "Blocked dangerous command: $COMMAND" >&2
  exit 2
fi

exit 0

Hook Exit Codes:

CodeMeaning
0Allowed
2Blocked (Claude notified)
OtherError (not blocking)

Hook Types

Supports scripts and multiple execution modes:

typeDescription
commandShell command
httpPOST to URL
promptSingle prompt to Claude model
agentRun a sub-agent for validation

Files Location

ScopePath
User~/.claude/settings.json
Project.claude/settings.json
Local.claude/settings.local.json

MCP Server Integration — Connecting External Services

What is MCP?

Model Context Protocol (MCP), released by Anthropic in Nov 2024, is an open standard for integrating external data sources/tools with AI agents. Claude Code uses MCP to connect with various external services.

By March 2026, companies like Apple (Xcode) and OpenAI (ChatGPT) announced MCP support, signaling industry adoption.

Examples of Connectable Services

  • Development Tools: GitHub / GitLab (issues, PRs), Jira
  • Communication: Slack
  • Documents: Google Drive, Notion
  • Databases: PostgreSQL, SQLite
  • Design: Figma
  • Cloud: AWS, GCP, Azure

Setup Method

Add MCP servers interactively:

claude mcp add

Or edit .mcp.json directly:

{
  "playwright": {
    "type": "stdio",
    "command": "npx",
    "args": ["-y", "@playwright/mcp@latest"]
  },
  "github": {
    "type": "stdio",
    "command": "uvx",
    "args": ["mcp-server-github"],
    "env": {"GITHUB_TOKEN": "${GITHUB_TOKEN}"}
  }
}

Scope for Subagents

You can assign MCP servers to specific subagents:

---
name: browser-tester
description: Playwright-based browser testing
mcpServers:
  - playwright:
      type: stdio
      command: npx
      args: ["-y", "@playwright/mcp@latest"]
  - github
---

This way, main conversation can hide sensitive MCP tools, while subagents have access.

Here are some practical MCP server options for early setup:

Development & Code Management

ServerPurposeRecommendation
GitHubIssue/PR management, code review★★★
GitLabSimilar for GitLab users★★★
PlaywrightBrowser automation, E2E testing★★★
SentryError monitoring, bug analysis★★☆

Documentation & Knowledge

ServerPurposeRecommendation
Context7Real-time API docs★★★
NotionDocument reference★★☆
Google DriveSpecs & designs★★☆

Data & Infrastructure

ServerPurposeRecommendation
PostgreSQLSQL commands, schema★★★
SupabaseManage database & RLS★★☆
AWSCloud resource control★★☆

Communication & External APIs

ServerPurposeRecommendation
SlackMessaging, notifications★★☆
Jira / LinearIssue management★★☆
Google CalendarScheduling★☆☆

Top 3 Recommendations for Beginners

Start with these:

  1. GitHub MCP — Streamlines PR/issue handling in conversation
  2. Context7 — Access latest APIs with commands
  3. Playwright — Automate UI screenshots after changes

Example setup:

# Add GitHub MCP
claude mcp add github -- uvx mcp-server-github

# Add Context7
claude mcp add context7 -- npx -y @upstash/context7-mcp@latest

Context Management — The Key to Performance

Why Context Management Matters

Claude Code performance hinges on context window management: the amount of information fed into the model.

The window supports up to 200,000 tokens (~150,000 words). As sessions lengthen, context accumulates, nearing capacity, which can cause Claude to “forget” previous instructions, reducing accuracy.

Effective context management is crucial for reliable results.

Commands for Context Control

CommandDescriptionWhen to Use
/clearReset all contextStart a new unrelated task
/compactCompress info while retaining essentialsContinue same task, save space
/compact Focus on the API changesCompress with focusKeep specific info relevant
/btwSide question (not in history)Quick question without clutter
Esc+Esc or /rewindRewind menuUndo last actions

When nearly full (~95%), auto-compaction triggers. Override threshold with CLAUDE_AUTOCOMPACT_PCT_OVERRIDE=50.

Plan Mode — Exploration Without Modification

Plan mode is for “thinking first, coding later.” It reads files but does not modify them (read-only).

Switch with Shift+Tab twice or set default in settings.json:

{
  "permissions": {
    "defaultMode": "plan"
  }
}

Workflow:

  1. Exploration (read files, understand)
  2. Planning (draft your implementation plan)
  3. Implementation (write code, test, fix)
  4. Commit (push PR)

This mode reduces token use and costs, focusing on design without actual coding.

Common Pitfalls and Solutions

PatternSymptomsSolution
Kitchen-sink sessionsMisplaced focus, mistakesUse /clear between tasks
Loop of revisionsRepeated mistakesIf happens twice, /clear and restart
Bloated CLAUDE.mdOverlooked rulesRegularly review and trim
Implementation without testingLooks right but buggyAlways run tests, build, verify screenshots
Infinite explorationContext overloadNarrow scope or delegate to subagents

Best Practices for Context Efficiency

  • Keep CLAUDE.md under 200 lines.
  • Separate detailed specs into Skills for on-demand loading.
  • Scope MCP tools wisely.
  • Adopt 30-minute sprints with /compact between to maintain high performance.
  • Use subagents for large explorations.

Summary — Feature Comparison and Next Steps

Feature Table

FeaturePurposeWhenDeterministic
CLAUDE.mdPersistent instructions & contextAt session startNo (~80% compliance)
SkillsReusable procedures/knowledgeCall or detect
HooksReliable automationLifecycle eventsYes (100%)
SubagentsSpecialized tasksDelegation decision
Agent TeamsLarge-scale parallel workTask start
MCPConnect to external servicesTool call

How to Get Started

  1. Create and maintain a clear CLAUDE.md to set project rules.
  2. Package repetitive steps into Skills.
  3. Automate frequent actions with Hooks.
  4. Use Subagents for large, specialized, or sensitive tasks.
  5. Integrate MCP for external data/services.
  6. For big projects, consider Agent Teams.

Claude Code can transform your entire development workflow. Start by running /init to generate CLAUDE.md, then refine and optimize over time.

As you deepen usage, it will evolve into a tailored AI coding assistant, guided by the right configuration and context management habits.


This article was automatically generated by LLM. It may contain errors.