Overview
This skill provides AI-powered search and access to a locally mirrored copy of Anthropic's official documentation. The documentation lives at ~/.claude-code-docs and covers ~1,700 paths across four categories.
When a user asks about Anthropic documentation, use the search tools and reference files described below to find the relevant content, read it, and synthesize an answer. Do not guess — always read the actual documentation before answering.
Domain Concept Map
Documentation sources: Two Anthropic domains are mirrored:
code.claude.com — Claude Code CLI documentation
platform.claude.com — Everything else: API, Agent SDK, guides
Four categories organize the paths (approximate counts as of 2026-06):
| Category |
User Label |
Paths |
Covers |
claude_code |
Claude Code CLI |
~43 |
CLI setup, hooks, skills, MCP, memory, plugins, settings, sub-agents |
api_reference |
Claude API |
~1,460 |
Messages API, models, batches, files, admin, multi-language SDKs (Python/TS/Go/Java/Kotlin/Ruby), Agent SDK |
core_documentation |
Claude Documentation |
~200 |
Prompt engineering, tool use, vision, streaming, extended thinking, evaluation, release notes, resources |
uncategorized |
Other |
~1 |
Paths not yet assigned to a category |
Agent SDK paths live within api_reference but are labeled "Claude Agent SDK" for users. They cover: overview, Python/TypeScript SDKs, sessions, skills, subagents, MCP, plugins, structured outputs, and more.
File naming convention: Documentation files use double underscores for path separators:
docs__en__hooks.md — Claude Code CLI page /docs/en/hooks
en__docs__claude-code__hooks.md — Alternate format for the same page
en__api__messages__create.md — API reference page /en/api/messages/create
How to Search
Follow this workflow when handling documentation queries:
Step 1: Sync the latest docs (MANDATORY — always do this first)
Before searching or reading anything, pull the latest documentation. This is the
first action for every docs request — it guarantees fresh content and clones the
mirror on first use. There is no search index to build (search runs over the live
files). Run exactly this:
DOCS="$HOME/.claude-code-docs"
if [ -d "$DOCS/.git" ]; then
git -C "$DOCS" pull --ff-only --quiet 2>/dev/null || true
else
git clone --quiet https://github.com/seanGSISG/claude-code-docs.git "$DOCS"
fi
# Refresh the runtime helper from tracked source (used for direct topic reads)
[ -f "$DOCS/scripts/claude-docs-helper.sh" ] && { cp "$DOCS/scripts/claude-docs-helper.sh" "$DOCS/claude-docs-helper.sh" 2>/dev/null; chmod +x "$DOCS/claude-docs-helper.sh" 2>/dev/null; }
# Best-effort: ensure ripgrep for the standalone helper (the Grep tool already
# bundles ripgrep, so this is optional; grep is the universal fallback).
if ! command -v rg >/dev/null 2>&1; then
if command -v winget >/dev/null 2>&1; then winget install --silent --accept-source-agreements --accept-package-agreements BurntSushi.ripgrep.MSVC >/dev/null 2>&1 || true
elif command -v brew >/dev/null 2>&1; then brew install ripgrep >/dev/null 2>&1 || true
elif command -v apt-get >/dev/null 2>&1; then sudo -n apt-get install -y ripgrep >/dev/null 2>&1 || true
fi
fi
echo "Docs ready: $(find "$DOCS/docs" -name '*.md' 2>/dev/null | wc -l | tr -d ' ') files"
Proceed to the next step regardless of the sync result — if the network is down,
the existing local mirror is still usable.
Step 2: Analyze Intent
Extract from the user's query:
- Keywords — the specific concepts they want (e.g., "hooks", "extended thinking", "batch API")
- Product context — if they specify one (e.g., "in the agent sdk", "cli hooks", "api rate limits")
- Query type — how-to, reference lookup, comparison, discovery
Step 3: Locate the doc(s)
Search the live files with Claude Code's built-in tools — they use bundled ripgrep,
so they are fast and return only compact results (paths/snippets), keeping token use
low. Search the docs directory ~/.claude-code-docs/docs (use the absolute $HOME
path when calling the tools).
- Content search — the Grep tool over the docs directory:
- Find candidate files:
output_mode: "files_with_matches".
- Rank by relevance:
output_mode: "count" and prefer files with more matches.
- Disambiguate without opening files:
output_mode: "content", -C: 2, small head_limit.
- Topic / path lookup — the Glob tool (filenames encode the path):
**/*<topic>*.md over the docs directory — e.g. hooks → claude-code__hooks.md,
docs__en__hooks.md.
Filenames map directly to doc paths, so a filename match is usually enough to pick the
right doc. There is no index — results are always current.
Shell fallback (e.g., when driving the helper standalone, outside the agent):
~/.claude-code-docs/claude-docs-helper.sh --search-content "<keywords>" # ripgrep, grep fallback
~/.claude-code-docs/claude-docs-helper.sh --search "<topic>" # path match
~/.claude-code-docs/claude-docs-helper.sh <topic> # direct topic read
See references/search-guide.md for detailed search tool usage.
Step 4: Decide — Synthesize or Ask
Check which product categories the results span:
- Same category (e.g., all Claude Code CLI) → Read all matching docs silently, synthesize a unified answer. Never ask "which doc do you want?" when results are in the same product context.
- Multiple categories (e.g., CLI + API + Agent SDK) → Ask the user which product context using AskUserQuestion with user-friendly product labels.
See references/category-map.md for the full category-to-label mapping and disambiguation rules.
Step 5: Read and Present
- Read the matching documentation files using their file paths from the search results
- Extract sections relevant to the user's question
- Synthesize a unified answer combining insights from all sources
- Cite all sources at the end with official documentation URLs
Reference Navigation
Load the reference file matching the topic before answering detailed questions about search mechanics or category routing.
| Topic |
Reference File |
Key Contents |
| How to use search tools, filename conventions, Python fallback, direct doc reading |
references/search-guide.md |
Search commands, output formats, file naming patterns, graceful degradation |
| Product categories, user-facing labels, disambiguation rules, when to ask vs synthesize |
references/category-map.md |
Category-to-label map, path patterns, cross-context resolution strategy |
Cross-Reference Guide
Some queries span multiple reference files or require special handling:
| Question Pattern |
Action |
| "How do I use X in agent sdk?" |
Filter search to agent-sdk paths, read all matches, synthesize |
| "What's the difference between X and Y?" |
Search for both terms, read docs for each, present comparison |
| "Show me all docs about X" |
Run path search, present grouped by product category |
| "hooks" (ambiguous — CLI hooks vs Agent SDK hooks) |
Search content, check categories — if split across products, ask user |
| Direct topic name (e.g., "mcp", "memory") |
Try direct file read first: ~/.claude-code-docs/docs/docs__en__<topic>.md |
Freshness check (-t) |
Run: ~/.claude-code-docs/claude-docs-helper.sh -t |
| "what's new" |
Run: ~/.claude-code-docs/claude-docs-helper.sh "what's new" |
| "update the docs" / "pull latest docs" |
Run the Step 1 sync block above (or tell the user to run the /docs-update command, which does the same thing). |
Keeping Docs Current
There is no background hook and no search index — syncing is explicit and always
visible. The mirror is refreshed by the mandatory Step 1 sync block at the start
of this workflow, so every docs request pulls the latest content; search then runs
over the live files, so results are always current. The /docs-update command
runs the same sync on demand without a search.
Key Commands Quick Reference
# Content search (returns JSON with product context)
~/.claude-code-docs/claude-docs-helper.sh --search-content "extended thinking"
# Path search (returns ranked path matches)
~/.claude-code-docs/claude-docs-helper.sh --search "hooks"
# Direct topic lookup
~/.claude-code-docs/claude-docs-helper.sh hooks
# List all available docs
ls ~/.claude-code-docs/docs/*.md | sed 's/.*\///' | sed 's/\.md$//'
# Check freshness and sync
~/.claude-code-docs/claude-docs-helper.sh -t
# What's new
~/.claude-code-docs/claude-docs-helper.sh "what's new"
# Installation status
~/.claude-code-docs/claude-docs-helper.sh --status
# Fallback search (no helper script)
grep -ril "keyword" ~/.claude-code-docs/docs/ | head -20
Important Caveats
- Documentation is a mirror, not the source. Always note that content comes from Anthropic's official documentation. Include official URLs when citing.
- Two base URLs: Claude Code CLI pages are at
code.claude.com/docs/en/<page>. Everything else is at platform.claude.com/<path>.
- No search index — content search runs over the live files via the Grep tool (bundled ripgrep) or the helper's
--search-content (ripgrep, with grep as fallback). Always current; nothing to rebuild.
- Helper script requires Python 3.9+ for enhanced features. Basic topic lookup and freshness checks work without Python. Content and path search need Python.
- ~1,530 files, ~1,702 manifest paths. The manifest tracks more paths than there are files; some are tracked but not downloadable (expected). Exact counts grow as Anthropic publishes docs — run
~/.claude-code-docs/claude-docs-helper.sh --status for live numbers.
1---2name: docs3description: Search and access Anthropic documentation covering Claude Code CLI, API, Agent SDK, and more. Supports natural language queries, content search, and direct topic lookup. Trigger on: /docs, documentation questions about Claude Code, Claude API, Agent SDK, prompt engineering, MCP, hooks, skills, tool use, streaming, batch processing, extended thinking, or any Anthropic platform feature.4---56## Overview78This skill provides AI-powered search and access to a locally mirrored copy of Anthropic's official documentation. The documentation lives at `~/.claude-code-docs` and covers ~1,700 paths across four categories.910When a user asks about Anthropic documentation, use the search tools and reference files described below to find the relevant content, read it, and synthesize an answer. Do not guess — always read the actual documentation before answering.1112## Domain Concept Map1314**Documentation sources:** Two Anthropic domains are mirrored:15- `code.claude.com` — Claude Code CLI documentation16- `platform.claude.com` — Everything else: API, Agent SDK, guides1718**Four categories** organize the paths (approximate counts as of 2026-06):1920| Category | User Label | Paths | Covers |21|---|---|---|---|22| `claude_code` | Claude Code CLI | ~43 | CLI setup, hooks, skills, MCP, memory, plugins, settings, sub-agents |23| `api_reference` | Claude API | ~1,460 | Messages API, models, batches, files, admin, multi-language SDKs (Python/TS/Go/Java/Kotlin/Ruby), Agent SDK |24| `core_documentation` | Claude Documentation | ~200 | Prompt engineering, tool use, vision, streaming, extended thinking, evaluation, release notes, resources |25| `uncategorized` | Other | ~1 | Paths not yet assigned to a category |2627**Agent SDK** paths live within `api_reference` but are labeled "Claude Agent SDK" for users. They cover: overview, Python/TypeScript SDKs, sessions, skills, subagents, MCP, plugins, structured outputs, and more.2829**File naming convention:** Documentation files use double underscores for path separators:30- `docs__en__hooks.md` — Claude Code CLI page `/docs/en/hooks`31- `en__docs__claude-code__hooks.md` — Alternate format for the same page32- `en__api__messages__create.md` — API reference page `/en/api/messages/create`3334## How to Search3536Follow this workflow when handling documentation queries:3738### Step 1: Sync the latest docs (MANDATORY — always do this first)3940Before searching or reading anything, pull the latest documentation. This is the41first action for **every** docs request — it guarantees fresh content and clones the42mirror on first use. There is no search index to build (search runs over the live43files). Run exactly this:4445```bash46DOCS="$HOME/.claude-code-docs"47if [ -d "$DOCS/.git" ]; then48 git -C "$DOCS" pull --ff-only --quiet 2>/dev/null || true49else50 git clone --quiet https://github.com/seanGSISG/claude-code-docs.git "$DOCS"51fi52# Refresh the runtime helper from tracked source (used for direct topic reads)53[ -f "$DOCS/scripts/claude-docs-helper.sh" ] && { cp "$DOCS/scripts/claude-docs-helper.sh" "$DOCS/claude-docs-helper.sh" 2>/dev/null; chmod +x "$DOCS/claude-docs-helper.sh" 2>/dev/null; }54# Best-effort: ensure ripgrep for the standalone helper (the Grep tool already55# bundles ripgrep, so this is optional; grep is the universal fallback).56if ! command -v rg >/dev/null 2>&1; then57 if command -v winget >/dev/null 2>&1; then winget install --silent --accept-source-agreements --accept-package-agreements BurntSushi.ripgrep.MSVC >/dev/null 2>&1 || true58 elif command -v brew >/dev/null 2>&1; then brew install ripgrep >/dev/null 2>&1 || true59 elif command -v apt-get >/dev/null 2>&1; then sudo -n apt-get install -y ripgrep >/dev/null 2>&1 || true60 fi61fi62echo "Docs ready: $(find "$DOCS/docs" -name '*.md' 2>/dev/null | wc -l | tr -d ' ') files"63```6465Proceed to the next step regardless of the sync result — if the network is down,66the existing local mirror is still usable.6768### Step 2: Analyze Intent6970Extract from the user's query:71- **Keywords** — the specific concepts they want (e.g., "hooks", "extended thinking", "batch API")72- **Product context** — if they specify one (e.g., "in the agent sdk", "cli hooks", "api rate limits")73- **Query type** — how-to, reference lookup, comparison, discovery7475### Step 3: Locate the doc(s)7677Search the live files with Claude Code's built-in tools — they use bundled ripgrep,78so they are fast and return only compact results (paths/snippets), keeping token use79low. Search the docs directory `~/.claude-code-docs/docs` (use the absolute `$HOME`80path when calling the tools).8182- **Content search** — the **Grep** tool over the docs directory:83 - Find candidate files: `output_mode: "files_with_matches"`.84 - Rank by relevance: `output_mode: "count"` and prefer files with more matches.85 - Disambiguate without opening files: `output_mode: "content"`, `-C: 2`, small `head_limit`.86- **Topic / path lookup** — the **Glob** tool (filenames encode the path):87 - `**/*<topic>*.md` over the docs directory — e.g. `hooks` → `claude-code__hooks.md`,88 `docs__en__hooks.md`.8990Filenames map directly to doc paths, so a filename match is usually enough to pick the91right doc. There is **no index** — results are always current.9293Shell fallback (e.g., when driving the helper standalone, outside the agent):94```bash95~/.claude-code-docs/claude-docs-helper.sh --search-content "<keywords>" # ripgrep, grep fallback96~/.claude-code-docs/claude-docs-helper.sh --search "<topic>" # path match97~/.claude-code-docs/claude-docs-helper.sh <topic> # direct topic read98```99100See `references/search-guide.md` for detailed search tool usage.101102### Step 4: Decide — Synthesize or Ask103104Check which product categories the results span:105106- **Same category** (e.g., all Claude Code CLI) → **Read all matching docs silently, synthesize a unified answer.** Never ask "which doc do you want?" when results are in the same product context.107- **Multiple categories** (e.g., CLI + API + Agent SDK) → **Ask the user which product context** using AskUserQuestion with user-friendly product labels.108109See `references/category-map.md` for the full category-to-label mapping and disambiguation rules.110111### Step 5: Read and Present1121131. Read the matching documentation files using their file paths from the search results1142. Extract sections relevant to the user's question1153. Synthesize a unified answer combining insights from all sources1164. Cite all sources at the end with official documentation URLs117118## Reference Navigation119120Load the reference file matching the topic before answering detailed questions about search mechanics or category routing.121122| Topic | Reference File | Key Contents |123|---|---|---|124| How to use search tools, filename conventions, Python fallback, direct doc reading | `references/search-guide.md` | Search commands, output formats, file naming patterns, graceful degradation |125| Product categories, user-facing labels, disambiguation rules, when to ask vs synthesize | `references/category-map.md` | Category-to-label map, path patterns, cross-context resolution strategy |126127## Cross-Reference Guide128129Some queries span multiple reference files or require special handling:130131| Question Pattern | Action |132|---|---|133| "How do I use X in agent sdk?" | Filter search to agent-sdk paths, read all matches, synthesize |134| "What's the difference between X and Y?" | Search for both terms, read docs for each, present comparison |135| "Show me all docs about X" | Run path search, present grouped by product category |136| "hooks" (ambiguous — CLI hooks vs Agent SDK hooks) | Search content, check categories — if split across products, ask user |137| Direct topic name (e.g., "mcp", "memory") | Try direct file read first: `~/.claude-code-docs/docs/docs__en__<topic>.md` |138| Freshness check (`-t`) | Run: `~/.claude-code-docs/claude-docs-helper.sh -t` |139| "what's new" | Run: `~/.claude-code-docs/claude-docs-helper.sh "what's new"` |140| "update the docs" / "pull latest docs" | Run the **Step 1** sync block above (or tell the user to run the `/docs-update` command, which does the same thing). |141142## Keeping Docs Current143144There is no background hook and no search index — syncing is explicit and always145visible. The mirror is refreshed by the mandatory **Step 1** sync block at the start146of this workflow, so every docs request pulls the latest content; search then runs147over the live files, so results are always current. The **`/docs-update`** command148runs the same sync on demand without a search.149150## Key Commands Quick Reference151152```bash153# Content search (returns JSON with product context)154~/.claude-code-docs/claude-docs-helper.sh --search-content "extended thinking"155156# Path search (returns ranked path matches)157~/.claude-code-docs/claude-docs-helper.sh --search "hooks"158159# Direct topic lookup160~/.claude-code-docs/claude-docs-helper.sh hooks161162# List all available docs163ls ~/.claude-code-docs/docs/*.md | sed 's/.*\///' | sed 's/\.md$//'164165# Check freshness and sync166~/.claude-code-docs/claude-docs-helper.sh -t167168# What's new169~/.claude-code-docs/claude-docs-helper.sh "what's new"170171# Installation status172~/.claude-code-docs/claude-docs-helper.sh --status173174# Fallback search (no helper script)175grep -ril "keyword" ~/.claude-code-docs/docs/ | head -20176```177178## Important Caveats179180- **Documentation is a mirror, not the source.** Always note that content comes from Anthropic's official documentation. Include official URLs when citing.181- **Two base URLs:** Claude Code CLI pages are at `code.claude.com/docs/en/<page>`. Everything else is at `platform.claude.com/<path>`.182- **No search index — content search runs over the live files** via the Grep tool (bundled ripgrep) or the helper's `--search-content` (ripgrep, with `grep` as fallback). Always current; nothing to rebuild.183- **Helper script requires Python 3.9+ for enhanced features.** Basic topic lookup and freshness checks work without Python. Content and path search need Python.184- **~1,530 files, ~1,702 manifest paths.** The manifest tracks more paths than there are files; some are tracked but not downloadable (expected). Exact counts grow as Anthropic publishes docs — run `~/.claude-code-docs/claude-docs-helper.sh --status` for live numbers.