Skip to content

Claude Code Complete Guide

Claude Code Free Course Guide — Master AI-Driven Development with Anthropic's Official Training

Target Audience

  • Developers with basic CLI and Git knowledge who want to fully leverage Claude Code

Key Points

Complete overview of the Claude Code free course and its learning areas Practical approaches to CLAUDE.md context management Concrete implementation methods for MCP, Hooks, and custom commands

Anthropic has released "Claude Code in Action," a free course. More than just operational instructions, it systematically teaches practical workflows for maximizing development velocity through AI agent collaboration. This article previews the course content while providing immediately usable configuration examples and code snippets.

Course Overview and Access

"Claude Code in Action" is available for free on Anthropic's Skilljar platform. No Anthropic account is required—just create a Skilljar account to start.

ItemDetails
URLanthropic.skilljar.com/claude-code-in-action
CostFree
PrerequisitesCLI basics, Claude Code access, API key

The course is divided into four major parts. The basics cover Claude Code architecture and setup, intermediate topics include context management and custom commands, advanced sections cover MCP server integration and GitHub workflows, and expert topics include Hooks and the SDK.


Part 1: Claude Code Fundamentals — How AI Coding Assistants Work

What is a Coding Assistant?

The course begins by explaining how Claude Code operates. Claude Code is an AI agent that runs in your terminal, automating file operations, command execution, and code analysis.

The key insight is that Claude Code interacts with your codebase through a "tool system." Operations like reading files, editing, and executing bash commands are all defined as tools. Claude Code combines multiple tools to handle complex tasks step by step.

Setup and Initial Configuration

The course walks through installation and initial setup in detail. Installation itself is straightforward:

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

After installation, run the claude command in your project directory to start an interactive session. On first launch, using /init to initialize your project and generate a CLAUDE.md file is recommended.


Part 2: Context Management — Leveraging CLAUDE.md

What is CLAUDE.md?

CLAUDE.md is a configuration file that communicates project-specific information to Claude Code. It's automatically loaded at session start and recognized by Claude as "important instructions left by the developer for you."

Since Claude Code is an agent, it fundamentally doesn't maintain memory between sessions. CLAUDE.md serves as the primary means of sharing state across sessions and team members.

CLAUDE.md Locations and Loading Order

Claude Code loads multiple CLAUDE.md files hierarchically:

LocationPurposeGit Management
~/.claude/CLAUDE.mdGlobal settings (all projects)Manage via dotfiles
./CLAUDE.mdProject settings (team-shared)Commit to Git
./.claude/CLAUDE.mdProject settings (local)Add to .gitignore

Claude Code recursively searches from the current working directory to the root, loading all CLAUDE.md files found. CLAUDE.md files in subdirectories are also automatically referenced when working with files in those directories.

Writing Effective CLAUDE.md Files

The course recommends against writing comprehensive manuals upfront. Instead, iteratively record corrections when Claude makes mistakes.

Here's a practical CLAUDE.md example:

# Project Guide

## Language Settings
- Always communicate in English

## Development Workflow
- Always read and understand existing code before making changes
- Create detailed plans before implementation
- Use test-driven development

## Coding Standards
- Always use `pytest tests/` for test execution
- Don't use `python -m unittest` (custom configs won't load)
- Use `poetry add <package>` when adding packages

## Critical Constraints
**Important**: Always create backups before database operations
**Required**: Ensure all tests pass before creating PRs

Best Practices for CLAUDE.md

  • Be specific: "Use 2-space indentation" is clearer than "format code appropriately"
  • Add emphasis to critical rules (**Important**) to improve Claude's compliance
  • Don't duplicate information (leads to confusion when updates are missed)

Adding Memory with the # Shortcut

A convenient feature covered in the course is the # shortcut. Starting your input with # prompts Claude Code to add that content to CLAUDE.md.

# Always use -v option when running pytest

This lets you choose which memory file to save to—a convenient way to capture insights during work.


Part 3: Custom Commands and Workflow Automation

Creating Custom Slash Commands

To streamline repetitive workflows, you can create custom slash commands. These are saved as Markdown prompt templates and invoked with /.

Commands are placed in these locations:

LocationScope
~/.claude/commands/Available in all projects
./.claude/commands/Available only in current project

Practical Custom Command Examples

GitHub Issue Fix Command

Save as .claude/commands/fix-github-issue.md to invoke with /fix-github-issue 123:

Analyze and fix the GitHub issue: $ARGUMENTS

Follow these steps:
1. Get issue details with `gh issue view $ARGUMENTS`
2. Understand the problem and search for related files
3. Implement the fix
4. Create and run tests
5. Run linting and type checking
6. Create a descriptive commit message
7. Create a PR

Use the `gh` CLI for GitHub integration.

Strict Code Review Command

Save as .claude/commands/hard-review.md:

Repeat until no issues are found:

1. Review changed files
2. Fix any problems found
3. After fixes, review again

Pay special attention to:
- Type consistency
- Edge case handling
- Security issues
- Performance impact

Commit & Push Command

Perform commit and push with these steps:

1. Check changes with `git diff`
2. Create a commit message summarizing changes
3. Stage changes with `git add .`
4. Commit with `git commit -m "generated message"`
5. Push with `git push`

Use this commit message format:
- feat: New feature
- fix: Bug fix
- docs: Documentation
- refactor: Refactoring

Part 4: MCP Server Integration — External Tool Connectivity

What is MCP?

MCP (Model Context Protocol) is a standard protocol for integrating Claude Code with external tools and services. By configuring MCP servers, you can add capabilities like browser automation, database access, and external API integration.

The course covers MCP fundamentals through practical configuration methods.

Configuring MCP Servers

Add MCP servers using claude mcp add. Storage location varies by scope:

ScopeOptionStorage Location
local-s local (default).claude/settings.local.json
project-s project.mcp.json (Git-manageable)
user-s user~/.claude/settings.json

Practical MCP Server Examples

Playwright (Browser Automation)

claude mcp add playwright -s project -- npx -y @playwright/mcp@latest

This adds web browser control capabilities to Claude Code. Instructions like "Open this URL and take a screenshot" become possible.

GitHub Integration

claude mcp add github -s user \
  -e GITHUB_PERSONAL_ACCESS_TOKEN=your-token \
  -- npx -y @modelcontextprotocol/server-github

With the GitHub MCP server configured, advanced operations like these become possible through natural language:

  • "Add the feature from JIRA issue ENG-4521 and create a GitHub PR"
  • "Review the latest PR and add comments if there are issues"
  • "Check if this can be merged to the develop branch"

PostgreSQL Integration

claude mcp add postgres -s user \
  -e DATABASE_URL="postgresql://user:password@localhost:5432/dbname" \
  -- npx -y @modelcontextprotocol/server-postgres

You can execute database queries directly. Operations like "Get the latest 10 records from the users table" become possible.

Context7 (Latest Library Specs)

claude mcp add context7 -s user -- npx -y @upstash/context7-mcp@latest

With Context7, Claude can fetch the latest library specifications it hasn't learned. This enables accurate code generation based on new API usage.

What's Possible with MCP Servers Connected

With MCP servers connected, you can ask Claude Code to:

  • Implement features from issue trackers: "Add the feature from JIRA issue ENG-4521 and create a GitHub PR"
  • Analyze monitoring data: "Check Sentry and Statsig for ENG-4521 feature usage"
  • Query databases: "Search the Postgres database for email addresses of 10 random users who used the ENG-4521 feature"
  • Integrate designs: "Update the standard email template based on the new Figma design posted to Slack"
  • Automate workflows: "Create Gmail drafts inviting these 10 users to a feedback session about the new feature"

Part 5: Hooks — Deterministic Automation

What are Hooks?

Hooks are user-defined shell commands that execute at various points in Claude Code's lifecycle. They guarantee specific operations "always" run without relying on AI judgment.

The course covers Hook fundamentals through practical implementation patterns.

Hook Event Types

EventTimingPrimary Use
PreToolUseBefore tool executionBlock dangerous commands, validate input
PostToolUseAfter tool executionRun formatters, quality checks
UserPromptSubmitWhen prompt is submittedValidate prompts, inject context
PermissionRequestWhen permission dialog showsAuto-approve/reject
StopAfter agent response completesEnd-of-turn quality checks
SessionStartWhen session startsLoad context
SessionEndWhen session endsSave logs, cleanup

Practical Hook Configuration Examples

Configure hooks in .claude/settings.json or .claude/settings.local.json.

Auto-format TypeScript Files

Automatically run Prettier after file edits:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '.tool_input.file_path' | { read file_path; if echo \"$file_path\" | grep -q '\\.ts$'; then npx prettier --write \"$file_path\"; fi; }"
          }
        ]
      }
    ]
  }
}

Block Dangerous Commands

Preemptively block rm -rf and .env file access:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "python3 -c \"import json, sys; data=json.load(sys.stdin); path=data.get('tool_input',{}).get('file_path',''); sys.exit(2 if any(p in path for p in ['.env', 'package-lock.json', '.git/']) else 0)\""
          }
        ]
      }
    ]
  }
}

When a hook returns exit code 2, tool execution is blocked and the error message is fed back to Claude.

Log Bash Commands

Record all executed Bash commands to a log file. Useful for auditing and debugging:

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [
          {
            "type": "command",
            "command": "jq -r '\"\\(.tool_input.command) - \\(.tool_input.description // \"No description\")\"' >> ~/.claude/bash-command-log.txt"
          }
        ]
      }
    ]
  }
}

End-of-Turn Quality Checks

Automatically run linting and tests when Claude's response completes:

{
  "hooks": {
    "Stop": [
      {
        "matcher": "*",
        "hooks": [
          {
            "type": "command",
            "command": ".claude/hooks/end-of-turn-check.sh"
          }
        ]
      }
    ]
  }
}

Example .claude/hooks/end-of-turn-check.sh:

#!/bin/bash
set -e

# Install dependencies and type check
pnpm install
pnpm check

# Run E2E tests if .tsx files changed
if git diff --name-only | grep -q '\.tsx$'; then
  pnpm test:e2e
fi

Hook Security Considerations

Hooks execute automatically, so malicious code can cause data leaks. When Git-managing .mcp.json or .claude/settings.json, always review hook configurations when cloning third-party repositories.


Part 6: GitHub Integration and CI/CD

Setting Up GitHub Integration

The course covers building automated PR review and issue processing workflows using the GitHub MCP server.

With GitHub integration enabled, Claude Code can perform these operations through natural language:

  • Retrieve and analyze issue details
  • Create and checkout branches
  • Create PRs and add review comments
  • Determine merge readiness

GitHub Actions Integration

Using Claude Code Action, you can automatically run code reviews on PRs. Example GitHub Actions workflow:

name: Claude Code Review
on:
  pull_request:
    types: [opened, synchronize]

jobs:
  review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Claude Code Review
        uses: anthropics/claude-code-action@v1
        with:
          anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
          review_type: comprehensive

Part 7: Claude Code SDK

SDK Overview

The final part covers programmatic integration using the Claude Code SDK. The SDK lets you embed Claude Code functionality into your own tools and scripts.

import { query } from "@anthropic-ai/claude-code-sdk";

for await (const message of query({
  prompt: "List files in my project",
  options: {
    mcpServers: {
      "filesystem": {
        command: "npx",
        args: ["@modelcontextprotocol/server-filesystem"],
        env: { ALLOWED_PATHS: "/Users/me/projects" }
      }
    },
    allowedTools: ["mcp__filesystem__list_files"]
  }
})) {
  if (message.type === "result" && message.subtype === "success") {
    console.log(message.result);
  }
}

The SDK enables batch processing and custom workflow automation.


Learning Roadmap

Here's a suggested roadmap for effective course learning.

Week 1: Foundation

  1. Complete course Parts 1-2 (setup and context management)
  2. Create CLAUDE.md for your project
  3. Build the habit of capturing insights with the # shortcut

Week 2: Workflow Automation

  1. Complete course Part 3 (custom commands)
  2. Convert 3 frequently used workflows into custom commands
  3. Introduce quality improvement commands like /hard-review

Week 3: External Integration

  1. Complete course Part 4 (MCP integration)
  2. Set up GitHub MCP server to automate PR creation
  3. Add MCP servers your project needs (DB, Slack, etc.)

Week 4: Advanced Automation

  1. Complete course Parts 5-6 (Hooks, GitHub Actions)
  2. Auto-run formatters with PostToolUse
  3. Automate quality checks with Stop hooks

Summary

Anthropic's official Claude Code free course systematically teaches practical skills for maximizing development velocity through AI agent collaboration—not just operational instructions.

Key Skills Covered

  • Context management and team knowledge sharing via CLAUDE.md
  • Workflow standardization through custom commands
  • External tool integration via MCP servers
  • Deterministic quality assurance with Hooks
  • GitHub integration and CI/CD

Immediate Action Items

  1. Register at Claude Code in Action to start the course
  2. Create a CLAUDE.md for your current project
  3. Convert frequently used workflows into custom commands

Collaborating with AI agents isn't just about having them write code. By providing appropriate context, automating workflows, and building quality assurance mechanisms, your development experience transforms fundamentally. This course serves as a practical starting point for that transformation.

References