ASK (Agent Skills Kit) Integration
Relevant source files
The following files were used as context for generating this wiki page:
The Agent Skills Kit (ASK) integration provides AI coding agents with efficient, on-demand access to the Claude Code documentation mirror. Instead of including the entire documentation set (which can exceed 5MB) into the LLM context, ASK allows agents to lazily resolve, search, and read specific documentation pages as needed.
This integration utilizes the ask CLI to manage a version-pinned local checkout of the documentation. It enables semantic search via the csp (Code Search Please) utility, allowing agents to find relevant technical information through natural language queries rather than exhaustive reading of the documentation manifest.
Sources: README.md:21-25, skills/claude-code-docs/SKILL.md:1-6
Architecture and Data Flow
The integration operates by caching a GitHub-mirrored version of the documentation and providing a standardized interface for agents to interact with it. The sync.ts utility ensures the mirror remains consistent with the source llms.txt manifest, while the SKILL.md defines how an agent should utilize these tools to answer user questions.
Documentation Lifecycle
The documentation is synced every 6 hours from the canonical source. The sync process treats llms.txt as the source of truth, rebuilding the docs/ directory to ensure deletions in the source are reflected in the mirror.
The diagram shows the flow from the canonical documentation source through the sync process to the AI agent's context via ASK tools.
Sources: README.md:11-15, sync.ts:1-10, skills/claude-code-docs/SKILL.md:12-25
Key Components
The ASK CLI
The ask tool is the primary interface for managing documentation checkouts. It handles the cloning and caching of the repository on first use.
| Command | Purpose |
|---|---|
ask add | Appends the documentation repository to ask.json |
ask install | Generates AGENTS.md and the Claude Code skill |
ask src | Resolves and prints the absolute path to the cached docs root |
ask docs | Resolves the specific cached documentation directory (/docs) |
ask search | Performs semantic search over the cached documentation |
Sources: README.md:27-41, skills/claude-code-docs/SKILL.md:12-16
Semantic Search (csp)
Semantic search is delegated to csp (Code Search Please). This allows for token-efficient retrieval by indexing per-page markdown files in the docs/ directory while ignoring the large llms-full.txt bundle to avoid duplicate results.
This sequence demonstrates how an agent initiates a search that traverses through the ASK and CSP layers to retrieve documentation.
Sources: README.md:43-55, skills/claude-code-docs/SKILL.md:27-37
Claude Code Plugin Integration
The repository acts as a Claude Code plugin, utilizing hooks to intercept tool calls. Specifically, a PreToolUse hook monitors the WebFetch tool to optimize documentation retrieval.
URL Rewriting Hook
When an agent attempts to fetch a standard HTML documentation URL (e.g., code.claude.com/docs/en/agents), the rewrite-docs-url.sh script intercepts the call. It rewrites the URL to point to the .md source (e.g., code.claude.com/docs/en/agents.md). This ensures the agent receives clean Markdown rather than a heavy HTML application shell.
{
"matcher": "WebFetch",
"hooks": [
{
"type": "command",
"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/rewrite-docs-url.sh"
}
]
}
Sources: hooks/hooks.json:4-15, hooks/rewrite-docs-url.sh:1-10, README.md:57-73
Skill Implementation Details
The claude-code-docs skill defines a four-step fallback logic for agents to ensure reliability:
- Resolve Mirror: Use
ask src github:pleaseai/claude-code-docsto find the local path. - Semantic Search: Use
csp searchorask searchto find the most relevant top-K pages. - Keyword Fallback: If semantic search is unavailable, use
grep -rilacross the$DOCSdirectory. - WebFetch Fallback: If the local mirror cannot be resolved, fetch the manifest from
https://code.claude.com/docs/llms.txtand retrieve individual.mdpages directly via web.
Sources: skills/claude-code-docs/SKILL.md:10-60
Conclusion
The ASK Integration transforms the static Claude Code documentation mirror into an interactive, low-latency resource for AI agents. By combining local caching (ask), semantic indexing (csp), and proactive URL rewriting (hooks), it minimizes token usage while maintaining high accuracy in documentation retrieval.
Sources: README.md:21-25, skills/claude-code-docs/SKILL.md:1-6