Getting Started
Relevant source files
The following files were used as context for generating this wiki page:
The claude-code-docs project is an unofficial mirror of the official Claude Code documentation. Its primary purpose is to provide a clean, versioned, and programmatically accessible copy of the docs for AI coding agents and CLI tools. By mirroring the content as Markdown, it allows tools to bypass complex HTML structures and interact with the documentation via semantic search or direct file access.
Sources: README.md:1-5, skills/claude-code-docs/SKILL.md:1-10
Core Components and Installation
The system consists of a synchronization engine, a command-line interface (via the ASK tool), and a Claude Code plugin with URL-rewriting capabilities.
Installation Options
Users can interact with the documentation mirror through several different methods depending on their needs:
| Method | Tool Required | Description |
|---|---|---|
| CLI Access | ASK | Allows on-demand resolution of cached docs and semantic search. |
| Claude Code Plugin | Claude Code CLI | Installs a hook to rewrite documentation URLs to clean Markdown. |
| Skill Integration | ASK CLI | Generates an AGENTS.md skill for AI agents to query documentation. |
Sources: README.md:16-25, README.md:38-45, skills/claude-code-docs/SKILL.md:13-25
Setting up the ASK CLI
To use the mirror with the Agent Skills Kit (ASK), you must first install the CLI and resolve the source:
# Install the CLI
brew install pleaseai/tap/ask
# Resolve and cache the docs path
ask docs github:pleaseai/claude-code-docs
Sources: README.md:19-24
Synchronization Architecture
The documentation is mirrored every 6 hours via GitHub Actions. The process treats llms.txt as the source of truth for the documentation structure.
Synchronization Logic
The sync.ts script performs the following steps:
- Fetch Manifest: Downloads the
llms.txtfile from the canonical Claude Code site. - Clean State: Removes the existing
docs/directory to ensure deletions in the source are reflected in the mirror. - Parallel Download: Fetches individual Markdown pages with a concurrency of 10 and up to 3 retries.
- Link Rewriting: Transforms site-absolute links (e.g.,
/en/sub-agents) into relative Markdown links (e.g.,../sub-agents.md) so the mirror is browsable locally or on GitHub.
Sources: sync.ts:7-13, sync.ts:58-85, README.md:11-14
The following diagram illustrates the synchronization and link-rewriting flow:
The sync process ensures that any page removed from the official manifest is also deleted from the git history of the mirror.
Sources: sync.ts:15-38, sync.ts:66-70
Claude Code Plugin and Hooks
The repository acts as a Claude Code plugin that intercepts documentation requests. It uses a PreToolUse hook to redirect standard documentation URLs to their Markdown equivalents.
URL Rewriting Logic
When the WebFetch tool is used, the rewrite-docs-url.sh script checks if the URL belongs to code.claude.com/docs/. If it is a standard page (not an image or raw file), it appends .md and updates the tool input.
| Input URL | Rewritten Output |
|---|---|
https://code.claude.com/docs/en/agents | https://code.claude.com/docs/en/agents.md |
.../docs/en/hooks#anchor | .../docs/en/hooks.md |
Sources: hooks/hooks.json:1-15, hooks/rewrite-docs-url.sh:11-30, README.md:46-55
Hook Execution Flow
The following sequence diagram shows how the plugin intercepts a user request to fetch documentation:
The hook returns a permissionDecision: "allow", which allows the rewritten fetch to proceed without requiring an additional user confirmation prompt.
Sources: hooks/rewrite-docs-url.sh:32-40, README.md:54-57
Semantic Search and Querying
The project integrates with csp (Code Search Please) to provide token-efficient semantic search over the documentation pages.
Using ask search
Users can query the documentation without reading every page by using the search command:
ask search github:pleaseai/claude-code-docs "how do hooks work" --content docs
This command indexes the Markdown files in the docs/ folder, skipping the large llms-full.txt bundle to avoid duplicate results.
Sources: README.md:29-36, skills/claude-code-docs/SKILL.md:27-40
Skill Functionality
The provided skill (/claude-code-docs:claude-code-docs) automates this process. It resolves the cached docs path via ask src, performs the search, reads the top-k results, and answers the user's question with canonical citations.
Sources: skills/claude-code-docs/SKILL.md:13-58, README.md:59-65