Claude
Skills
Sign in
Back

claude-howto-guide

Included with Lifetime
$97 forever

```markdown

Writing & Docs

What this skill does

```markdown
---
name: claude-howto-guide
description: Master Claude Code features — slash commands, memory, hooks, subagents, MCP, skills, plugins, checkpoints, and CLI — using the claude-howto structured tutorial guide.
triggers:
  - how do I use Claude Code effectively
  - set up Claude Code slash commands
  - configure hooks in Claude Code
  - create a subagent workflow with Claude Code
  - install MCP servers for Claude Code
  - use Claude Code memory and CLAUDE.md
  - set up a Claude Code plugin
  - automate code review with Claude Code
---

# Claude How-To: Master Claude Code Features

> Skill by [ara.so](https://ara.so) — Daily 2026 Skills collection.

`claude-howto` is a structured, visual, example-driven tutorial guide for Claude Code. It covers every major feature — slash commands, memory, skills, subagents, MCP, hooks, plugins, checkpoints, and CLI — with copy-paste templates, Mermaid diagrams, and a progressive 11–13 hour learning path.

---

## Installation

```bash
git clone https://github.com/luongnv89/claude-howto.git
cd claude-howto
```

No Python dependencies are required to use the templates. To build the offline EPUB:

```bash
uv run scripts/build_epub.py
```

---

## Repository Structure

```
claude-howto/
├── 01-slash-commands/     # User-invoked shortcuts (/cmd)
├── 02-memory/             # Persistent context (CLAUDE.md)
├── 03-skills/             # Reusable capabilities (auto-invoked)
├── 04-subagents/          # Specialized AI assistants
├── 05-mcp/                # External tool access via MCP protocol
├── 06-hooks/              # Event-driven automation
├── 07-plugins/            # Bundled feature packages
├── 08-checkpoints/        # Session snapshots and rewind
├── 09-advanced-features/  # Planning, thinking, background tasks
├── 10-cli/                # CLI commands, flags, options
├── LEARNING-ROADMAP.md    # Guided learning path
├── CATALOG.md             # Full feature catalog
└── CONTRIBUTING.md
```

---

## Quick 15-Minute Setup

```bash
# Create Claude Code command directory in your project
mkdir -p /path/to/your-project/.claude/commands

# Copy a slash command template
cp 01-slash-commands/optimize.md /path/to/your-project/.claude/commands/

# Set up project memory
cp 02-memory/project-CLAUDE.md /path/to/your-project/CLAUDE.md

# Install a skill
cp -r 03-skills/code-review ~/.claude/skills/
```

---

## Feature 1: Slash Commands

Slash commands are Markdown files in `.claude/commands/`. The filename becomes the command name.

**File:** `.claude/commands/review.md`

```markdown
# Code Review

Review the current file or selection for:
- Logic errors and edge cases
- Performance bottlenecks
- Security vulnerabilities
- Style and readability

Provide a structured report with severity levels (critical / warning / suggestion).
```

**Usage in Claude Code:**
```
/review
```

**Copy all example commands:**
```bash
cp 01-slash-commands/*.md .claude/commands/
```

---

## Feature 2: Memory (CLAUDE.md)

`CLAUDE.md` files give Claude persistent context about your project. They are auto-loaded at session start.

**Scopes:**
- `~/.claude/CLAUDE.md` — global, applies to all projects
- `./CLAUDE.md` — project-level
- `./src/CLAUDE.md` — directory-level

**Template:** `./CLAUDE.md`

```markdown
# Project: my-api

## Stack
- Python 3.12, FastAPI, PostgreSQL
- Tests: pytest, httpx
- Linting: ruff, mypy

## Conventions
- All endpoints return `{"data": ..., "error": null}` or `{"data": null, "error": "..."}`
- Use `async def` for all route handlers
- Database sessions via `get_db()` dependency injection

## Key Commands
- `make test` — run test suite
- `make lint` — ruff + mypy
- `make migrate` — run Alembic migrations

## Do Not
- Never commit secrets or `.env` files
- Never use `print()` for logging — use `structlog`
```

**Copy the template:**
```bash
cp 02-memory/project-CLAUDE.md ./CLAUDE.md
```

---

## Feature 3: Skills

Skills are reusable capability definitions that Claude invokes automatically based on context. They live in `~/.claude/skills/` (global) or `.claude/skills/` (project).

**Structure:**
```
~/.claude/skills/
└── code-review/
    ├── skill.md        # Skill definition
    └── templates/      # Supporting templates
```

**Install a skill:**
```bash
cp -r 03-skills/code-review ~/.claude/skills/
```

**Example `skill.md`:**
```markdown
# Skill: Code Review

Trigger: When reviewing code, PRs, or diffs.

## Behavior
1. Check for security vulnerabilities (injection, secrets, auth bypass)
2. Identify performance issues (N+1 queries, unbounded loops)
3. Verify error handling completeness
4. Assess test coverage gaps
5. Output findings as a structured Markdown report
```

---

## Feature 4: Subagents

Subagents are specialized Claude instances delegated subtasks. Define them in `.claude/agents/`.

**File:** `.claude/agents/security-auditor.md`

```markdown
# Agent: Security Auditor

## Role
Specialized security review agent. Focus exclusively on:
- Injection vulnerabilities (SQL, command, LDAP)
- Authentication and authorization flaws
- Secrets or credentials in code
- Insecure dependencies

## Output Format
Return a JSON report:
{
  "critical": [...],
  "high": [...],
  "medium": [...],
  "low": [...]
}
```

**Orchestrating subagents in a workflow:**

```python
# Example: Trigger subagent delegation via Claude Code SDK
import anthropic

client = anthropic.Anthropic()

orchestrator_prompt = """
You are an orchestrator. For the following code diff, delegate to:
1. The security-auditor agent for vulnerability scanning
2. The performance-reviewer agent for bottleneck detection

Return a combined report.

Code diff:
{diff}
""".format(diff=open("changes.diff").read())

response = client.messages.create(
    model="claude-opus-4-6",
    max_tokens=4096,
    messages=[{"role": "user", "content": orchestrator_prompt}]
)
print(response.content[0].text)
```

---

## Feature 5: MCP (Model Context Protocol)

MCP servers give Claude access to external tools and live data. Configure in `.claude/mcp.json`.

**File:** `.claude/mcp.json`

```json
{
  "servers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    },
    "postgres": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-postgres"],
      "env": {
        "DATABASE_URL": "${DATABASE_URL}"
      }
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
    }
  }
}
```

**Environment variables (never hardcode):**
```bash
export GITHUB_TOKEN="your-token-here"
export DATABASE_URL="postgresql://user:pass@localhost/db"
```

**Copy MCP config templates:**
```bash
cp 05-mcp/mcp.json .claude/mcp.json
```

---

## Feature 6: Hooks

Hooks are scripts triggered by Claude Code events. They live in `.claude/hooks/`.

**Supported events:**
| Event | Trigger |
|-------|---------|
| `pre-tool-use` | Before Claude runs any tool |
| `post-tool-use` | After a tool completes |
| `pre-file-write` | Before writing a file |
| `post-file-write` | After writing a file |
| `session-start` | When a session begins |
| `session-end` | When a session ends |

**File:** `.claude/hooks/post-file-write.sh`

```bash
#!/bin/bash
# Auto-run linter after Claude writes a Python file

FILE="$1"

if [[ "$FILE" == *.py ]]; then
  echo "Running ruff on $FILE..."
  ruff check --fix "$FILE"
  mypy "$FILE" --ignore-missing-imports
fi
```

**File:** `.claude/hooks/pre-file-write.py`

```python
#!/usr/bin/env python3
"""Block writes to protected paths."""

import sys
import os

PROTECTED = [".env", "secrets.json", "credentials.yaml"]

file_path = sys.argv[1] if len(sys.argv) > 1 else ""
filename = os.path.basename(file_path)

if filename in PROTECTED:
    print(f"BLOCKED: Writing to {filename} is not allowed.", file=sys.stderr)
    sys.exit(1)

sys.exit(0)
```

**Register hooks in `.claude/config.json`:*

Related in Writing & Docs