docs-management

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Claude Docs Management

Claude文档管理

🚨🚨🚨 MANDATORY: Hybrid Parallel Pattern 🚨🚨🚨

🚨🚨🚨 强制要求:混合并行模式 🚨🚨🚨

STOP - Before using this skill for ANY Claude Code documentation query:
IF YOU ARE THE MAIN AGENT, you MUST invoke BOTH sources in the same message:
  1. This skill (
    docs-management
    ) - local cache, token-efficient
  2. claude-code-guide
    subagent
    - live web search
text
[Skill tool: docs-management]
"Find documentation about {topic}"

[Task tool: claude-code-guide] (SAME MESSAGE - USE THIS EXACT PROMPT)
"First WebFetch https://code.claude.com/docs/en/claude_code_docs_map.md to find
relevant doc pages about {topic}. Then WebFetch those specific pages. Use WebSearch
only if needed for additional context. Do NOT use Skill tool (not available).
Return key findings with source URLs."
⚠️ CRITICAL: claude-code-guide does NOT have Skill tool access. Always prompt it to use WebSearch/WebFetch explicitly. If you see "No such tool: Skill" error, you prompted it wrong.
This is AUTOMATIC. Do NOT wait for user to ask for it.
IF YOU ARE A SUBAGENT: Note in your response that main agent should also query
claude-code-guide
.

注意 - 在使用本技能处理任何Claude Code文档查询之前:
如果您是主Agent,必须在同一条消息中调用两个来源
  1. 本技能 (
    docs-management
    ) - 本地缓存,高效节省Token
  2. claude-code-guide
    子Agent
    - 实时网页搜索
text
[Skill工具: docs-management]
"查找关于{topic}的文档"

[Task工具: claude-code-guide](同一条消息 - 请使用此精确提示词)
"首先WebFetch https://code.claude.com/docs/en/claude_code_docs_map.md以查找
与{topic}相关的文档页面。然后WebFetch这些特定页面。仅在需要额外上下文时使用WebSearch。
请勿使用Skill工具(不可用)。返回包含源URL的关键发现。"
⚠️ 关键提示: claude-code-guide没有Skill工具访问权限。请始终提示它 明确使用WebSearch/WebFetch。如果您看到“No such tool: Skill”错误, 说明您的提示词有误。
此操作是自动的,无需等待用户请求。
如果您是子Agent:请在回复中说明主Agent还应查询
claude-code-guide

🚨 CRITICAL: Path Doubling Prevention - MANDATORY

🚨 关键要求:防止路径重复 - 强制遵守

ABSOLUTE PROHIBITION: NEVER use
cd
with
&&
in PowerShell when running scripts from this skill.
The Problem: If your current working directory is already inside the skill directory, using relative paths causes PowerShell to resolve paths relative to the current directory instead of the repository root, resulting in path doubling.
REQUIRED Solutions (choose one):
  1. ✅ ALWAYS use helper scripts (recommended - they handle path resolution automatically)
  2. ✅ Use absolute path resolution (if not using helper script)
  3. ✅ Use separate commands (never
    cd
    with
    &&
    )
NEVER DO THIS:
  • ❌ Chain
    cd
    with
    &&
    :
    cd <relative-path> && python <script>
    causes path doubling
  • ❌ Assume current directory
  • ❌ Use relative paths when current dir is inside skill directory
For all scripts: Always run from repository root using relative paths, OR use helper scripts that handle path resolution automatically.
绝对禁止:在PowerShell中运行本技能的脚本时,切勿将
cd
&&
一起使用。
问题原因: 如果当前工作目录已在技能目录内,使用相对路径会导致PowerShell相对于当前目录解析路径,而非仓库根目录,从而造成路径重复。
必须采用的解决方案(选择其一):
  1. ✅ 始终使用辅助脚本(推荐 - 它们会自动处理路径解析)
  2. ✅ 使用绝对路径解析(如果不使用辅助脚本)
  3. ✅ 使用单独的命令(绝不将
    cd
    &&
    一起使用)
绝对禁止以下操作:
  • ❌ 将
    cd
    &&
    链式使用:
    cd <相对路径> && python <脚本>
    会导致路径重复
  • ❌ 假设当前目录位置
  • ❌ 当当前目录在技能目录内时使用相对路径
对于所有脚本: 始终从仓库根目录使用相对路径运行,或者使用自动处理路径解析的辅助脚本。

🚨 CRITICAL: Large File Handling - MANDATORY SCRIPT USAGE

🚨 关键要求:大文件处理 - 强制使用脚本

⚠️ ABSOLUTE PROHIBITION: NEVER use read_file tool on the index.yaml file

⚠️ 绝对禁止:切勿对index.yaml文件使用read_file工具

The file exceeds 25,000 tokens and will ALWAYS fail. You MUST use scripts.
✅ REQUIRED: ALWAYS use manage_index.py scripts for ANY index.yaml access:
bash
python scripts/management/manage_index.py count
python scripts/management/manage_index.py list
python scripts/management/manage_index.py get <doc_id>
python scripts/management/manage_index.py verify
All scripts automatically handle large files via
index_manager.py
.
该文件超过25000个Token,使用read_file工具必然失败。您必须使用脚本。
✅ 要求:所有对index.yaml的访问必须使用manage_index.py脚本:
bash
python scripts/management/manage_index.py count
python scripts/management/manage_index.py list
python scripts/management/manage_index.py get <doc_id>
python scripts/management/manage_index.py verify
所有脚本都会通过
index_manager.py
自动处理大文件。

Available Slash Commands

可用的斜杠命令

This skill provides three slash commands for common workflows:
  • /claude-ecosystem:scrape-docs
    - Scrape all configured Claude documentation sources, then refresh index and validate
  • /claude-ecosystem:refresh-docs
    - Refresh the local index and metadata without scraping from remote sources
  • /claude-ecosystem:validate-docs
    - Validate the index and references for consistency and drift without scraping
本技能提供三个用于常见工作流的斜杠命令:
  • /claude-ecosystem:scrape-docs
    - 爬取所有已配置的Claude文档源,然后刷新索引并验证
  • /claude-ecosystem:refresh-docs
    - 刷新本地索引和元数据,无需从远程源爬取
  • /claude-ecosystem:validate-docs
    - 验证索引和引用的一致性与变更,无需爬取

Overview

概述

This skill provides automation tooling for documentation management. It manages:
  • Canonical storage (encapsulated in skill) - Single source of truth for official docs
  • Subsection extraction - Token-optimized extracts for skills (60-90% savings)
  • Drift detection - Hash-based validation against upstream sources
  • Sync workflows - Quarterly maintenance automation
  • Documentation discovery - Keyword-based search and doc_id resolution
  • Index management - Metadata, keywords, tags, aliases for resilient references
Core value: Prevents link rot, enables offline access, optimizes token costs, automates maintenance, and provides resilient doc_id-based references.
本技能提供文档管理的自动化工具,主要功能包括:
  • 标准存储(封装在技能内)- 官方文档的唯一可信来源
  • 子章节提取 - 针对技能优化的Token提取(节省60-90%的Token)
  • 变更检测 - 基于哈希验证与上游源的差异
  • 同步工作流 - 季度维护自动化
  • 文档发现 - 基于关键词的搜索与doc_id解析
  • 索引管理 - 元数据、关键词、标签、别名管理,实现可靠的引用
核心价值: 防止链接失效,支持离线访问,优化Token成本,自动化维护,并提供基于doc_id的可靠引用。

Quick Reference: Which Command to Use

快速参考:选择合适的命令

I want to...CommandExample
Find docs by keywords
search
search skills progressive
Find docs by natural language
query
query "how to create skills"
Get full document content
content
content code-claude-com-docs-en-skills
Get specific section
content --section
content <doc_id> --section "metadata"
Resolve doc_id to path
resolve
resolve code-claude-com-docs-en-skills
Find related docs
related
related code-claude-com-docs-en-skills
List docs by category
category
category api
List docs by tag
tag
tag skills
Key Workflow:
search
by keywords → Get
doc_id
from results →
content
by doc_id
Important distinctions:
  • search
    and
    query
    accept flexible keywords (no full doc_id needed)
  • content
    ,
    resolve
    , and
    related
    require full doc_id (e.g.,
    code-claude-com-docs-en-skills
    )
我想要...命令示例
按关键词查找文档
search
search skills progressive
按自然语言查找文档
query
query "how to create skills"
获取完整文档内容
content
content code-claude-com-docs-en-skills
获取特定章节
content --section
content <doc_id> --section "metadata"
将doc_id解析为路径
resolve
resolve code-claude-com-docs-en-skills
查找相关文档
related
related code-claude-com-docs-en-skills
按分类列出文档
category
category api
按标签列出文档
tag
tag skills
关键工作流:
search
关键词搜索 → 从结果中获取
doc_id
→ 通过doc_id使用
content
获取内容
重要区别:
  • search
    query
    接受灵活的关键词(无需完整doc_id)
  • content
    resolve
    related
    需要完整的doc_id(例如
    code-claude-com-docs-en-skills

When to Use This Skill

何时使用本技能

This skill should be used when:
  • Scraping documentation - Fetching docs from sitemaps or docs maps
  • Finding documentation - Searching for docs by keywords, category, or natural language
  • Resolving doc references - Converting doc_id to file paths
  • Managing index metadata - Adding keywords, tags, aliases, updating metadata
  • Rebuilding index - Regenerating index from filesystem (handles renames/moves)
本技能适用于以下场景:
  • 爬取文档 - 从站点地图或文档地图获取文档
  • 查找文档 - 通过关键词、分类或自然语言搜索文档
  • 解析文档引用 - 将doc_id转换为文件路径
  • 管理索引元数据 - 添加关键词、标签、别名,更新元数据
  • 重建索引 - 从文件系统重新生成索引

Hybrid Parallel Documentation Strategy

混合并行文档策略

CRITICAL: This section is the authoritative source for Claude Code documentation access patterns.
关键提示:本节是Claude Code文档访问模式的权威来源。

Architecture Constraint

架构限制

Skills cannot spawn subagents. Only the main conversation thread can use the Task tool.
This means:
  • When main agent loads this skill → Main agent must also invoke
    claude-code-guide
    in parallel
  • When subagent loads this skill → Subagent should note in response that main agent should invoke
    claude-code-guide
    for live coverage
  • When command invokes this skill → Same as main agent (commands run in main context)
技能无法生成子Agent。只有主对话线程可以使用Task工具。
这意味着:
  • 主Agent加载本技能时 → 主Agent必须同时并行调用
    claude-code-guide
  • 子Agent加载本技能时 → 子Agent应在回复中说明主Agent应调用
    claude-code-guide
    以获取实时内容
  • 命令调用本技能时 → 与主Agent情况相同(命令在主上下文运行)

Caller-Aware Guidance

调用方感知指南

If you are the main agent:
  • You MUST invoke both this skill AND
    claude-code-guide
    subagent in the SAME message
  • This is the only way to get comprehensive Claude Code documentation coverage
If you are a subagent:
  • You CANNOT invoke
    claude-code-guide
    yourself (architectural constraint)
  • Include in your response: "For comprehensive coverage, main agent should also query claude-code-guide subagent"
  • Proceed with local cache results
如果您是主Agent:
  • 必须在同一条消息中同时调用本技能和
    claude-code-guide
    子Agent
  • 这是获取全面Claude Code文档内容的唯一方式
如果您是子Agent:
  • 您无法自行调用
    claude-code-guide
    (架构限制)
  • 请在回复中包含:“为获取全面内容,主Agent还应查询claude-code-guide子Agent”
  • 继续使用本地缓存结果

Always-Parallel Pattern (Main Agent Only)

始终并行模式(仅主Agent)

⚠️ MANDATORY DEFAULT BEHAVIOR - NOT OPTIONAL:
When ANY Claude Code documentation query is detected, the main agent MUST automatically:
  1. Invoke
    docs-management
    skill (local cache)
  2. Spawn
    claude-code-guide
    subagent (live web) in the same message
This is automatic. The user does NOT need to ask for it.
⚠️ 强制默认行为 - 不可选:
当检测到任何Claude Code文档查询时,主Agent必须自动执行以下操作:
  1. 调用
    docs-management
    技能(本地缓存)
  2. 生成
    claude-code-guide
    子Agent(实时网页)在同一条消息中
此操作是自动的,用户无需主动请求。

Detection Triggers

检测触发条件

Use both sources automatically when user asks about:
  • Claude Code features (hooks, skills, memory, MCP, plugins, settings, etc.)
  • How to do something in Claude Code
  • Claude Code configuration or troubleshooting
  • Any topic in the Claude Code documentation
当用户询问以下内容时,自动使用两个来源:
  • Claude Code功能(hooks、skills、memory、MCP、plugins、settings等)
  • 如何在Claude Code中完成某项操作
  • Claude Code配置或故障排除
  • Claude Code文档中的任何主题

Same-Message Parallel Invocation

同消息并行调用

text
undefined
text
undefined

Main agent sends BOTH in a single message (AUTOMATIC):

主Agent在单条消息中发送两个调用(自动执行):

[Skill tool: docs-management] "Find documentation about {topic}"
[Task tool: claude-code-guide] (same message = parallel execution) "First WebFetch https://code.claude.com/docs/en/claude_code_docs_map.md to find relevant doc pages about {topic}. Then WebFetch those specific pages. Use WebSearch only if needed for additional context. Do NOT use Skill tool (not available). Return key findings with source URLs."

**IMPORTANT:** `claude-code-guide` is a built-in subagent with tools: `Glob, Grep, Read, WebFetch, WebSearch`.
It does NOT have the `Skill` tool - it's designed for **web search**, not local skill invocation.
Always prompt it to use WebSearch/WebFetch explicitly.
[Skill工具: docs-management] "查找关于{topic}的文档"
[Task工具: claude-code-guide](同一条消息 = 并行执行) "首先WebFetch https://code.claude.com/docs/en/claude_code_docs_map.md以查找 与{topic}相关的文档页面。然后WebFetch这些特定页面。仅在需要额外上下文时使用WebSearch。 请勿使用Skill工具(不可用)。返回包含源URL的关键发现。"

**重要提示:** `claude-code-guide`是内置子Agent,具备工具:`Glob, Grep, Read, WebFetch, WebSearch`。
它没有`Skill`工具 - 专为**网页搜索**设计,而非本地技能调用。请始终提示它明确使用WebSearch/WebFetch。

Synthesis Step

结果合成步骤

After both complete:
  • Combine results from both sources
  • Local cache provides category context and token efficiency
  • Live search provides currency and gap-filling
  • Note any discrepancies between sources
两个调用完成后:
  • 合并两个来源的结果
  • 本地缓存提供分类上下文与Token效率
  • 实时搜索提供最新内容与补充缺失信息
  • 标注两个来源之间的任何差异

Two Documentation Sources

两个文档来源

SourceInvoke ViaStrengths
docs-management
(this skill)
Skill
tool
Fast, token-efficient (60-90% savings), hierarchical categories, offline
claude-code-guide
Task
tool
Always current, web search, fetches live URLs
来源调用方式优势
docs-management
(本技能)
Skill
工具
快速、Token高效(节省60-90%)、分层分类、支持离线
claude-code-guide
Task
工具
内容始终最新、支持网页搜索、获取实时URL

Fallback Behavior

回退行为

  • Plugin not installed: Use
    claude-code-guide
    only
  • Live search unavailable: This skill provides complete local cache
  • Both sources disagree: Flag discrepancy, prefer official docs, investigate
  • 插件未安装:仅使用
    claude-code-guide
  • 实时搜索不可用:本技能提供完整的本地缓存
  • 两个来源内容不一致:标记差异,优先采用官方文档,进行调查

Automatic Behavior Summary

自动行为总结

User QueryWhat Happens (Automatic)
"How do hooks work?"Both sources invoked automatically
"What's the CLAUDE.md syntax?"Both sources invoked automatically
"Help me set up MCP"Both sources invoked automatically
Any Claude Code topicBoth sources invoked automatically
There is no manual trigger. This is default behavior for Claude Code documentation queries.
用户查询自动执行操作
"hooks如何工作?"自动调用两个来源
"CLAUDE.md语法是什么?"自动调用两个来源
"帮助我设置MCP"自动调用两个来源
任何Claude Code相关主题自动调用两个来源
无需手动触发。这是Claude Code文档查询的默认行为。

Three-Source Troubleshooting Pattern

三源故障排除模式

When troubleshooting errors, bugs, or unexpected behavior, use three sources in parallel:
SourceAgent/SkillPurpose
Official Docs
docs-management
skill
Correct usage, configuration
GitHub Issues
claude-code-issue-researcher
agent
Known bugs, workarounds
Live Web
claude-code-guide
subagent
Current discussions
Troubleshooting triggers (automatically detected by hook):
  • "error", "bug", "broken", "not working", "fails", "crash"
  • "debug", "troubleshoot", "workaround", "issue", "problem"
  • "doesn't work", "won't work", "can't", "isn't firing"
Example prompt for claude-code-issue-researcher:
text
Search GitHub issues in anthropics/claude-code for: [ERROR/PROBLEM DESCRIPTION].
Check both open and closed issues. Report issue numbers, status, and any workarounds.
当排查错误、Bug或异常行为时,并行使用三个来源
来源Agent/技能用途
官方文档
docs-management
技能
正确用法、配置说明
GitHub Issues
claude-code-issue-researcher
Agent
已知Bug、解决方案
实时网页
claude-code-guide
子Agent
当前讨论内容
故障排除触发词(由hook自动检测):
  • "error"、"bug"、"broken"、"not working"、"fails"、"crash"
  • "debug"、"troubleshoot"、"workaround"、"issue"、"problem"
  • "doesn't work"、"won't work"、"can't"、"isn't firing"
claude-code-issue-researcher的示例提示词:
text
在anthropics/claude-code的GitHub issues中搜索:[错误/问题描述]。
检查开放和已关闭的issues。报告issue编号、状态及任何解决方案。

Correct Subagent Pattern

正确的子Agent模式

When spawning docs-researcher (or any subagent that uses this skill), the main agent should ALSO spawn claude-code-guide in the same message for comprehensive coverage:
text
undefined
当生成docs-researcher(或任何使用本技能的子Agent)时,主Agent还应在同一条消息中生成claude-code-guide以获取全面内容:
text
undefined

Main agent spawns BOTH in a single message:

主Agent在单条消息中生成两个Agent:

[Task tool: docs-researcher subagent] "Research Claude Code memory/CLAUDE.md files"
[Task tool: claude-code-guide subagent] (same message = parallel) "Use WebSearch to find current Claude Code documentation about memory and CLAUDE.md files on code.claude.com. Return key findings with URLs."
[Task工具: docs-researcher子Agent] "研究Claude Code memory/CLAUDE.md文件"
[Task工具: claude-code-guide子Agent](同一条消息 = 并行) "使用WebSearch查找code.claude.com上关于memory和 CLAUDE.md文件的最新Claude Code文档。返回包含URL的关键发现。"

After both complete, synthesize results

两个Agent完成后,合成结果


**Why both?** The docs-researcher uses local cache (fast, token-efficient), while claude-code-guide searches live web (always current). Together they provide comprehensive coverage.

**为什么需要两者结合?** docs-researcher使用本地缓存(快速、Token高效),而claude-code-guide搜索实时网页(内容始终最新)。两者结合可提供全面的内容覆盖。

Hierarchical Categories (from docs_map.md)

分层分类(来自docs_map.md)

The index includes category hierarchy from the official Claude Code docs map:
CategoryTopics
Getting startedoverview, quickstart, common-workflows
Build with Claude Codesub-agents, plugins, skills, hooks, mcp, output-styles
Deploymentamazon-bedrock, google-vertex-ai, sandboxing
Administrationsetup, iam, security, costs
Configurationsettings, vs-code, jetbrains, memory
Referencecli-reference, slash-commands, hooks
Resourcestroubleshooting, legal-and-compliance
Categories are stored in
doc_map_category
field. Query by category:
python
resolver.get_by_category("Build with Claude Code")  # Returns all docs in category
resolver.list_categories()  # Returns all categories with counts
索引包含官方Claude Code文档地图中的分类层级:
分类主题
入门指南overview, quickstart, common-workflows
使用Claude Code构建sub-agents, plugins, skills, hooks, mcp, output-styles
部署amazon-bedrock, google-vertex-ai, sandboxing
管理setup, iam, security, costs
配置settings, vs-code, jetbrains, memory
参考cli-reference, slash-commands, hooks
资源troubleshooting, legal-and-compliance
分类存储在
doc_map_category
字段中,可按分类查询:
python
resolver.get_by_category("Build with Claude Code")  # 返回该分类下的所有文档
resolver.list_categories()  # 返回所有分类及文档数量

Category Enrichment

分类增强

After scraping, update categories from the official docs map:
bash
python scripts/core/enrich_categories.py           # Update categories
python scripts/core/enrich_categories.py --dry-run # Preview changes
爬取完成后,从官方文档地图更新分类:
bash
python scripts/core/enrich_categories.py           # 更新分类
python scripts/core/enrich_categories.py --dry-run # 预览变更

Workflow Execution Pattern

工作流执行模式

CRITICAL: This section defines HOW to execute operations in this skill.
关键提示:本节定义了如何在本技能中执行操作。

Delegation Strategy

委托策略

Default approach: Delegate to Task agent

默认方式:委托给Task Agent

For ALL scraping, validation, and index operations, delegate execution to a general-purpose Task agent.
How to invoke:
Use the Task tool with:
  • subagent_type
    : "general-purpose"
  • description
    : Short 3-5 word description
  • prompt
    : Full task description with execution instructions
对于所有爬取、验证和索引操作,委托给通用Task Agent执行。
调用方式:
使用Task工具,包含:
  • subagent_type
    : "general-purpose"
  • description
    : 3-5个词的简短描述
  • prompt
    : 完整的任务描述与执行说明

Execution Pattern

执行模式

Scripts run in FOREGROUND by default. Do NOT background them.
When Task agents execute scripts:
  • Run directly:
    python .claude/skills/docs-management/scripts/core/scrape_all_sources.py --parallel --skip-existing
  • Streaming logs: Scripts emit progress naturally via stdout
  • Wait for completion: Scripts exit when done with exit code
  • NEVER use
    run_in_background=true
    : Scripts are designed for foreground execution
  • NEVER poll output: Streaming logs appear automatically, no BashOutput polling needed
  • NEVER use background jobs: No
    &
    , no
    nohup
    , no background process management
脚本默认在前台运行,请勿后台运行。
当Task Agent执行脚本时:
  • 直接运行
    python .claude/skills/docs-management/scripts/core/scrape_all_sources.py --parallel --skip-existing
  • 流式日志:脚本通过stdout自然输出进度
  • 等待完成:脚本完成后退出并返回退出码
  • 切勿使用
    run_in_background=true
    :脚本设计为前台执行
  • 切勿轮询输出:流式日志会自动显示,无需BashOutput轮询
  • 切勿使用后台任务:不使用
    &
    nohup
    或后台进程管理

Anti-Pattern Detection

反模式检测

Red flags indicating incorrect execution:
🚩 Using
run_in_background=true
in Bash tool 🚩 Repeated BashOutput calls in a loop 🚩 Checking process status with
ps
or
pgrep
🚩 Manual polling of script output 🚩 Background job management (
&
,
nohup
,
jobs
) 🚩 Using BashOutput AFTER Task agent completes ← CRITICAL RED FLAG
If you recognize these patterns, STOP and correct immediately.
表明执行方式错误的危险信号:
🚩 在Bash工具中使用
run_in_background=true
🚩 循环重复调用BashOutput 🚩 使用
ps
pgrep
检查进程状态 🚩 手动轮询脚本输出 🚩 后台任务管理(
&
nohup
jobs
) 🚩 在Task Agent完成后使用BashOutput ← 关键危险信号
如果您发现这些模式,请立即停止并纠正。

After Task Agent Completes

Task Agent完成后

CRITICAL: When the Task agent reports "Done", READ its report and summarize to the user. DO NOT use BashOutput.
Correct workflow:
  1. Task agent reports "Done (X tool uses · Y tokens · Z time)"
  2. ✅ READ the agent's message containing its final report
  3. ✅ SUMMARIZE the agent's findings to the user
  4. ❌ NEVER use BashOutput to "check the real results"
  5. ❌ NEVER poll or verify what the agent already reported
关键提示:当Task Agent报告“Done”时,请阅读其报告并向用户总结。请勿使用BashOutput。
正确工作流:
  1. Task Agent报告“Done (X tool uses · Y tokens · Z time)”
  2. ✅ 阅读Agent消息中的最终报告
  3. ✅ 向用户总结Agent的发现
  4. ❌ 切勿使用BashOutput“检查真实结果”
  5. ❌ 切勿轮询或验证Agent已报告的内容

Error and Warning Reporting

错误与警告报告

CRITICAL: Report ALL errors, warnings, and issues - never suppress or ignore them.
When executing scripts via Task agents:
  • Report script errors: Exit codes, exceptions, error messages
  • Report warnings: Deprecation warnings, import issues, configuration problems
  • Report unexpected output: 404s, timeouts, validation failures
  • Include context: What was being executed when the error occurred
Red flags that indicate issues:
🚩 Non-zero exit code 🚩 Lines containing "ERROR", "FAILED", "Exception", "Traceback" 🚩 "WARNING" or "WARN" messages 🚩 "404 Not Found", "500 Internal Server Error"
关键提示:报告所有错误、警告和问题 - 切勿压制或忽略。
当通过Task Agent执行脚本时:
  • 报告脚本错误:退出码、异常、错误消息
  • 报告警告:弃用警告、导入问题、配置问题
  • 报告异常输出:404、超时、验证失败
  • 包含上下文:错误发生时正在执行的操作
表明存在问题的危险信号:
🚩 非零退出码 🚩 包含“ERROR”、“FAILED”、“Exception”、“Traceback”的行 🚩 “WARNING”或“WARN”消息 🚩 “404 Not Found”、“500 Internal Server Error”

Domain-Specific Reporting for Scraping

爬取的特定域报告

CRITICAL: When reporting scraping results, distinguish behavior by domain.
Domain-Specific .md URL Behavior:
  1. docs.claude.com and code.claude.com: These domains serve .md URLs successfully
  2. anthropic.com: These domains do NOT serve .md URLs (404 expected, configured with
    try_markdown: false
    )
Accurate Reporting:
Good (Domain-Specific): "docs.claude.com: 97 URLs using direct .md (97 skipped/unchanged). anthropic.com: 164 URLs using HTML conversion (158 skipped/unchanged)."
Bad (Misleading): "All .md URL attempts returned 404 (expected - these are HTML pages)" ← This is misleading because Claude domains successfully use .md URLs
关键提示:报告爬取结果时,请区分不同域的行为。
特定域的.md URL行为:
  1. docs.claude.comcode.claude.com:这些域成功提供.md URL
  2. anthropic.com:这些域不提供.md URL(预期会返回404,已配置
    try_markdown: false
准确报告:
良好(特定域):"docs.claude.com: 97个URL使用直接.md格式(97个已跳过/未更改)。anthropic.com: 164个URL使用HTML转换(158个已跳过/未更改)。"
不良(误导性):"所有.md URL尝试均返回404(预期 - 这些是HTML页面)" ← 这具有误导性,因为Claude域成功使用.md URL

Quick Start

快速开始

Refresh Index End-to-End (No Scraping)

端到端刷新索引(无需爬取)

Use this when you want to rebuild and validate the local index/metadata without scraping:
⚠️ IMPORTANT: Use Python 3.13 for validation - spaCy/Pydantic have compatibility issues with Python 3.14+
bash
undefined
当您想要重建并验证本地索引/元数据无需爬取时使用:
⚠️ 重要提示:验证需使用Python 3.13 - spaCy/Pydantic与Python 3.14+存在兼容性问题
bash
undefined

Use Python 3.13 for full compatibility with spaCy

使用Python 3.13以确保与spaCy完全兼容

py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py

Optional flags:

```bash
py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py

可选参数:

```bash

Check for missing files before rebuilding

重建前检查缺失文件

py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py --check-missing-files
py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py --check-missing-files

Detect drift (404s, missing files) after rebuilding

重建后检测变更(404、缺失文件)

py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py --check-drift
py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py --check-drift

Detect and automatically cleanup drift

检测并自动清理变更

py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py --check-drift --cleanup-drift

This script runs the full pipeline:

- ✅ Checks dependencies
- ✅ (Optional) Checks for missing files
- ✅ Rebuilds the index from the filesystem
- ✅ Extracts keywords & metadata for all documents
- ✅ Validates metadata coverage
- ✅ Generates a summary report
- ✅ (Optional) Detects and cleans up drift

Expected runtime: ~20-30 seconds for ~500 documents
py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py --check-drift --cleanup-drift

该脚本运行完整流程:

- ✅ 检查依赖
- ✅ (可选)检查缺失文件
- ✅ 从文件系统重建索引
- ✅ 提取所有文档的关键词和元数据
- ✅ 验证元数据覆盖
- ✅ 生成摘要报告
- ✅ (可选)检测并清理变更

预期运行时间:约20-30秒(处理约500个文档)

Scrape All Sources (Used by
/scrape-official-docs
)

爬取所有来源(
/scrape-official-docs
使用)

Use this when the user explicitly wants to hit the network and scrape docs:
当用户明确想要联网爬取文档时使用:

Python Version Requirement

Python版本要求

  • Python 3.14 works by default for scraping
  • Python 3.13 required for spaCy operations (keyword extraction, metadata extraction)
bash
undefined
  • Python 3.14默认适用于爬取
  • spaCy操作需使用Python 3.13(关键词提取、元数据提取)
bash
undefined

Step 1: Scrape documentation (Python 3.14+ works)

步骤1:爬取文档(Python 3.14+适用)

python .claude/skills/docs-management/scripts/core/scrape_all_sources.py
--parallel
--skip-existing
python .claude/skills/docs-management/scripts/core/scrape_all_sources.py
--parallel
--skip-existing

Step 2: IMMEDIATELY run validation after scraping completes

步骤2:爬取完成后立即运行验证

⚠️ Use Python 3.13 for validation (spaCy compatibility)

⚠️ 验证需使用Python 3.13(spaCy兼容性)

py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py
py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py

Step 3: Clean up aged-out Anthropic articles (reads max_age from sources.json)

步骤3:清理过期的Anthropic文章(从sources.json读取max_age)

python .claude/skills/docs-management/scripts/maintenance/cleanup_old_anthropic_docs.py --execute
undefined
python .claude/skills/docs-management/scripts/maintenance/cleanup_old_anthropic_docs.py --execute
undefined

Validation and Cleanup Are Required After Scraping

爬取后必须进行验证和清理

Since
--auto-validate
is now default: False (for speed), you MUST run validation and cleanup separately immediately after scraping.
Optional: Detect and cleanup drift after scraping:
bash
undefined
由于
--auto-validate
现在默认设置为False(为了速度),您必须在爬取完成后单独运行验证和清理
可选:爬取后检测并清理变更:
bash
undefined

Auto-cleanup workflow (detect and cleanup in one flag)

自动清理工作流(一个参数完成检测和清理)

python .claude/skills/docs-management/scripts/core/scrape_all_sources.py
--parallel
--skip-existing
--auto-cleanup
python .claude/skills/docs-management/scripts/core/scrape_all_sources.py
--parallel
--skip-existing
--auto-cleanup

Then validate (use Python 3.13)

然后验证(使用Python 3.13)

py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py
undefined
py -3.13 .claude/skills/docs-management/scripts/management/refresh_index.py
undefined

Find Documentation

查找文档

⚠️ CRITICAL: Global flags MUST come BEFORE the subcommand:
bash
undefined
⚠️ 关键提示:全局参数必须在子命令之前:
bash
undefined

✅ CORRECT - global flags before subcommand

✅ 正确 - 全局参数在子命令之前

python find_docs.py --json --limit 10 search skills frontmatter
python find_docs.py --json --limit 10 search skills frontmatter

❌ WRONG - global flags after subcommand (will fail with "unrecognized arguments")

❌ 错误 - 全局参数在子命令之后(会提示“unrecognized arguments”)

python find_docs.py search skills frontmatter --json

**Examples:**

```bash
python find_docs.py search skills frontmatter --json

**示例:**

```bash

Resolve doc_id to file path

将doc_id解析为文件路径

python .claude/skills/docs-management/scripts/core/find_docs.py resolve <doc_id>
python .claude/skills/docs-management/scripts/core/find_docs.py resolve <doc_id>

Search by keywords (default: 25 results)

按关键词搜索(默认:25个结果)

python .claude/skills/docs-management/scripts/core/find_docs.py search skills progressive-disclosure
python .claude/skills/docs-management/scripts/core/find_docs.py search skills progressive-disclosure

Search with custom limit (global options come before subcommand)

自定义结果数量(全局选项在子命令之前)

python .claude/skills/docs-management/scripts/core/find_docs.py --limit 10 search skills
python .claude/skills/docs-management/scripts/core/find_docs.py --limit 10 search skills

Search without limit (returns all matching results)

无限制搜索(返回所有匹配结果)

python .claude/skills/docs-management/scripts/core/find_docs.py --no-limit search skills
python .claude/skills/docs-management/scripts/core/find_docs.py --no-limit search skills

Search with minimum score threshold (filters low-relevance results)

设置最低分数阈值(过滤低相关性结果)

python .claude/skills/docs-management/scripts/core/find_docs.py --min-score 20 search skills
python .claude/skills/docs-management/scripts/core/find_docs.py --min-score 20 search skills

Natural language search

自然语言搜索

python .claude/skills/docs-management/scripts/core/find_docs.py query "how to create skills"
python .claude/skills/docs-management/scripts/core/find_docs.py query "how to create skills"

List by category

按分类列出

python .claude/skills/docs-management/scripts/core/find_docs.py category api
python .claude/skills/docs-management/scripts/core/find_docs.py category api

List by tag

按标签列出

python .claude/skills/docs-management/scripts/core/find_docs.py tag skills

**Search Accepts Flexible Keywords** (no full doc_ids needed):

- Single keyword: `search skills`
- Multiple keywords: `search skills progressive disclosure`
- Partial words work via token matching: `search skill` matches "skills"
- Singular/plural auto-handled: "skill" matches "skills"
- Stop words removed automatically from queries: "how", "to", "the", etc.

**Search Options:**

| Option | Default | Description |
| --- | --- | --- |
| `--limit N` | 25 | Maximum number of results to return |
| `--no-limit` | - | Return all matching results (no limit) |
| `--min-score N` | - | Only return results with relevance score >= N |
| `--fast` | - | Index-only search (skip content grep) |
| `--separate` | - | Show index matches and content matches separately |
| `--no-context` | - | Hide grep context lines in content matches |
| `--clear-cache` | - | Rebuild search cache before operation |
| `--category` | - | Filter results by category |
| `--tags` | - | Filter results by tags |
| `--json` | - | Output results as JSON |
| `--verbose` | - | Show relevance scores for debugging |

When results are truncated, output shows "showing X of Y total" to indicate more results are available.
python .claude/skills/docs-management/scripts/core/find_docs.py tag skills

**搜索接受灵活的关键词**(无需完整doc_id):

- 单个关键词:`search skills`
- 多个关键词:`search skills progressive disclosure`
- 部分单词通过令牌匹配:`search skill`匹配“skills”
- 自动处理单复数:“skill”匹配“skills”
- 自动移除查询中的停用词:“how”、“to”、“the”等

**搜索选项:**

| 选项 | 默认值 | 描述 |
| --- | --- | --- |
| `--limit N` | 25 | 返回的最大结果数 |
| `--no-limit` | - | 返回所有匹配结果(无限制) |
| `--min-score N` | - | 仅返回相关性分数≥N的结果 |
| `--fast` | - | 仅索引搜索(跳过内容grep) |
| `--separate` | - | 分别显示索引匹配和内容匹配结果 |
| `--no-context` | - | 隐藏内容匹配中的grep上下文行 |
| `--clear-cache` | - | 操作前重建搜索缓存 |
| `--category` | - | 按分类过滤结果 |
| `--tags` | - | 按标签过滤结果 |
| `--json` | - | 以JSON格式输出结果 |
| `--verbose` | - | 显示相关性分数用于调试 |

当结果被截断时,输出会显示“showing X of Y total”以表明还有更多结果。

Hybrid Search (Default Behavior)

混合搜索(默认行为)

By default,
search
performs both index and content search:
  1. Index search - Fast keyword matching against document metadata (title, description, keywords, tags)
  2. Content search - Grep through actual file contents for matches not in index
Result markers:
  • [SUBSECTION]
    - Match found in a specific document section (click to extract)
  • [CONTENT]
    - Match found in file content (not in metadata index)
  • No marker - Standard index match
Performance options:
  • Use
    --fast
    for index-only search (faster, but may miss content-only matches)
  • Use
    --separate
    to display index and content matches in separate sections
默认情况下,
search
同时执行索引和内容搜索
  1. 索引搜索 - 快速匹配文档元数据(标题、描述、关键词、标签)
  2. 内容搜索 - 在实际文件内容中grep查找索引中未包含的匹配项
结果标记:
  • [SUBSECTION]
    - 在特定文档章节中找到匹配项(点击可提取)
  • [CONTENT]
    - 在文件内容中找到匹配项(不在元数据索引中)
  • 无标记 - 标准索引匹配
性能选项:
  • 使用
    --fast
    进行仅索引搜索(速度更快,但可能遗漏仅在内容中存在的匹配项)
  • 使用
    --separate
    分别显示索引匹配和内容匹配结果

Search Scoring

搜索评分

Results are ranked by a multi-factor scoring system:
  • Title matches (highest weight, 14 points)
  • Description matches (10 points)
  • Keyword field matches (8-10 points, with variant detection)
  • Tag matches (5-7 points)
  • Coverage multipliers (1.5-2.0x for multi-term matches)
  • Domain weighting (Claude Code docs prioritized over general Anthropic docs)
Use
--verbose
to see scores for debugging relevance issues.
结果通过多因素评分系统排序:
  • 标题匹配(权重最高,14分)
  • 描述匹配(10分)
  • 关键词字段匹配(8-10分,支持变体检测)
  • 标签匹配(5-7分)
  • 覆盖乘数(多词匹配为1.5-2.0倍)
  • 域权重(Claude Code文档优先级高于普通Anthropic文档)
使用
--verbose
查看分数以调试相关性问题。

find_docs.py Command Reference

find_docs.py命令参考

CommandPurposeSubsection Support
resolve <doc_id>
Resolve doc_id to file path❌ No
content <doc_id>
Get document content✅ Yes (
--section
)
search <keywords>
Keyword search❌ No
query "<text>"
Natural language search❌ No
category <name>
List docs in category❌ No
tag <name>
List docs with tag❌ No
related <doc_id>
Find related documents❌ No
Related Documents Example:
bash
undefined
命令用途支持子章节
resolve <doc_id>
将doc_id解析为文件路径❌ 不支持
content <doc_id>
获取文档内容✅ 支持(
--section
search <keywords>
关键词搜索❌ 不支持
query "<text>"
自然语言搜索❌ 不支持
category <name>
列出分类下的文档❌ 不支持
tag <name>
列出带指定标签的文档❌ 不支持
related <doc_id>
查找相关文档❌ 不支持
相关文档示例:
bash
undefined

Find documents related to skills documentation

查找与skills文档相关的文档

python .claude/skills/docs-management/scripts/core/find_docs.py related code-claude-com-docs-en-skills
python .claude/skills/docs-management/scripts/core/find_docs.py related code-claude-com-docs-en-skills

Limit results

限制结果数量

python .claude/skills/docs-management/scripts/core/find_docs.py --limit 5 related code-claude-com-docs-en-skills

Related documents are scored by shared tags (3x weight) and shared keywords (2x weight).
python .claude/skills/docs-management/scripts/core/find_docs.py --limit 5 related code-claude-com-docs-en-skills

相关文档通过共享标签(3倍权重)和共享关键词(2倍权重)评分。

Subsection Extraction (Token-Optimized)

子章节提取(Token优化)

To extract a specific section from a document (60-90% token savings):
Option 1: Using find_docs.py content command:
bash
python scripts/core/find_docs.py content code-claude-com-docs-en-skills --section "Available metadata fields"
Option 2: Using get_subsection_content.py (dedicated script):
bash
python scripts/core/get_subsection_content.py code-claude-com-docs-en-skills \
  --section "Available metadata fields"
Discover Available Sections (
--list-sections
):
bash
undefined
从文档中提取特定章节(节省60-90%的Token):
选项1:使用find_docs.py content命令:
bash
python scripts/core/find_docs.py content code-claude-com-docs-en-skills --section "Available metadata fields"
选项2:使用专用脚本get_subsection_content.py:
bash
python scripts/core/get_subsection_content.py code-claude-com-docs-en-skills \
  --section "Available metadata fields"
查看可用章节(
--list-sections
):
bash
undefined

List all sections in a document

列出文档中的所有章节

python scripts/core/get_subsection_content.py code-claude-com-docs-en-skills --list-sections
python scripts/core/get_subsection_content.py code-claude-com-docs-en-skills --list-sections

Output shows hierarchical structure with heading levels

输出显示带标题层级的结构

# Agent Skills

# Agent Skills

## Create your first Skill

## Create your first Skill

## How Skills work

## How Skills work

### Where Skills live

### Where Skills live


**Fuzzy Section Matching:**

Section names support fuzzy matching - partial or word-overlap matches work:

```bash

**模糊章节匹配:**

章节名称支持模糊匹配 - 部分匹配或单词重叠匹配均可:

```bash

Exact: "Available metadata fields"

精确匹配: "Available metadata fields"

Fuzzy: "metadata fields" -> matches "Available metadata fields"

模糊匹配: "metadata fields" -> 匹配"Available metadata fields"

Fuzzy: "tool access" -> matches "Restrict tool access with allowed-tools"

模糊匹配: "tool access" -> 匹配"Restrict tool access with allowed-tools"

python scripts/core/get_subsection_content.py code-claude-com-docs-en-skills --section "metadata fields"
python scripts/core/get_subsection_content.py code-claude-com-docs-en-skills --section "metadata fields"

Output: Fuzzy match: 'metadata fields' -> 'Available metadata fields'

输出: Fuzzy match: 'metadata fields' -> 'Available metadata fields'


**Note:** The `resolve` command ONLY returns file paths. Use `content` to get actual document content with optional section extraction.

**注意:** `resolve`命令仅返回文件路径。请使用`content`命令获取实际文档内容并可选提取章节。

Configuration System

配置系统

The docs-management skill uses a unified configuration system with a single source of truth.
Configuration Files:
  • config/defaults.yaml
    - Central configuration file with all default values
  • config/config_registry.py
    - Canonical configuration system with environment variable support
  • references/sources.json
    - Documentation sources configuration (required for scraping)
Path Configuration:
All paths configured in
config/defaults.yaml
under the
paths
section.
Environment Variable Overrides:
All configuration values can be overridden using environment variables:
CLAUDE_DOCS_<SECTION>_<KEY>
Full details: references/technical-details.md#configuration
docs-management技能使用统一的配置系统,具有唯一可信来源。
配置文件:
  • config/defaults.yaml
    - 包含所有默认值的中央配置文件
  • config/config_registry.py
    - 标准配置系统,支持环境变量
  • references/sources.json
    - 文档源配置(爬取必需)
路径配置:
所有路径在
config/defaults.yaml
paths
部分配置。
环境变量覆盖:
所有配置值可通过环境变量覆盖:
CLAUDE_DOCS_<SECTION>_<KEY>
详细信息: references/technical-details.md#configuration

Dependencies & Environment

依赖与环境

Required:
pyyaml
,
requests
,
beautifulsoup4
,
markdownify
Optional (recommended):
spacy
,
yake
(for enhanced keyword extraction)
Quick setup:
bash
python .claude/skills/docs-management/scripts/setup/setup_dependencies.py --install-required
Auto-installation: The
extract-keywords
command automatically installs optional dependencies if missing.
Full details: references/technical-details.md#dependencies
必需依赖:
pyyaml
,
requests
,
beautifulsoup4
,
markdownify
可选(推荐):
spacy
,
yake
(用于增强关键词提取)
快速设置:
bash
python .claude/skills/docs-management/scripts/setup/setup_dependencies.py --install-required
自动安装:
extract-keywords
命令会自动安装缺失的可选依赖。
详细信息: references/technical-details.md#dependencies

Core Capabilities

核心功能

1. Scraping Documentation

1. 文档爬取

Fetch documentation from official sources and store in canonical storage. Features: sitemap/docs map parsing, HTML→Markdown conversion, direct .md URL fetching (30-40% token savings), automatic metadata tracking, domain-based folder organization.
Guide: references/capabilities/scraping-guide.md
从官方源获取文档并存储在标准存储中。功能包括:站点地图/文档地图解析、HTML→Markdown转换、直接.md URL获取(节省30-40%的Token)、自动元数据跟踪、基于域的文件夹组织。
指南: references/capabilities/scraping-guide.md

2. Extracting Subsections (Internal Use)

2. 子章节提取(内部使用)

Extract specific markdown sections for internal skill operations. Features: ATX-style heading structure parsing, section boundaries detection, provenance frontmatter, token economics (60-90% savings typical).
Guide: references/capabilities/extraction-guide.md
为内部技能操作提取特定Markdown章节。功能包括:ATX样式标题结构解析、章节边界检测、来源前置元数据、Token优化(通常节省60-90%的Token)。
指南: references/capabilities/extraction-guide.md

3. Change Detection

3. 变更检测

Detect new and removed documentation pages from sitemaps, and detect content changes via hash comparison. Features: new/removed page detection, content hash comparison, automatic stale marking, change reporting and audit logs.
Guide: references/capabilities/change-detection-guide.md
从站点地图检测新增和移除的文档页面,并通过哈希比较检测内容变更。功能包括:新增/移除页面检测、内容哈希比较、自动标记过期内容、变更报告和审计日志。
指南: references/capabilities/change-detection-guide.md

4. Finding and Resolving Documentation

4. 文档查找与解析

Discover and resolve documentation references using doc_id, keywords, or natural language queries. Features: doc_id resolution, keyword-based search, natural language query processing, subsection discovery and extraction, category and tag filtering, alias resolution.
使用doc_id、关键词或自然语言查询发现并解析文档引用。功能包括:doc_id解析、关键词搜索、自然语言查询处理、子章节发现与提取、分类和标签过滤、别名解析。

5. Index Management and Maintenance

5. 索引管理与维护

Maintain index metadata, keywords, tags, and rebuild index from filesystem. Scripts:
manage_index.py
,
rebuild_index.py
,
generate_report.py
,
verify_index.py
.
维护索引元数据、关键词、标签,并从文件系统重建索引。相关脚本:
manage_index.py
,
rebuild_index.py
,
generate_report.py
,
verify_index.py

6. Age-Based Cleanup

6. 基于时间的清理

Remove documentation that has aged out based on
published_at
dates. Anthropic sources (engineering, news, research) have a
max_age_days
threshold configured in
references/sources.json
. Articles older than this threshold are skipped during scraping; this cleanup removes any previously-scraped articles that have since aged out.
bash
undefined
根据
published_at
日期移除过期文档。Anthropic源(engineering、news、research)在
references/sources.json
中配置了
max_age_days
阈值。超过该阈值的文章在爬取时会被跳过;此清理操作会移除之前爬取的已过期文章。
bash
undefined

Clean up aged-out Anthropic articles (dry-run by default)

清理过期的Anthropic文章(默认试运行)

Reads max_age_days from sources.json automatically

自动从sources.json读取max_age_days

python scripts/maintenance/cleanup_old_anthropic_docs.py
python scripts/maintenance/cleanup_old_anthropic_docs.py

Execute cleanup (actually delete files)

执行清理(实际删除文件)

python scripts/maintenance/cleanup_old_anthropic_docs.py --execute
python scripts/maintenance/cleanup_old_anthropic_docs.py --execute

Override with custom age threshold if needed

(可选)使用自定义时间阈值

python scripts/maintenance/cleanup_old_anthropic_docs.py --max-age 90 --execute

This should be run after scraping and validation to ensure the canonical directory stays clean.
python scripts/maintenance/cleanup_old_anthropic_docs.py --max-age 90 --execute

此操作应在爬取和验证后运行,以确保标准目录保持整洁。

Workflows

工作流

Common maintenance and operational workflows for documentation management:
  • Adding New Documentation Source - Onboarding new docs from sitemaps or docs maps
  • Scraping Multiple Sources - Validation checkpoints to prevent wasted time/tokens
  • Token-Optimized Subsection Retrieval - Workflow for extracting subsections instead of full documents
Detailed Workflows: references/workflows.md
文档管理的常见维护和操作工作流:
  • 添加新文档源 - 从站点地图或文档地图接入新文档
  • 爬取多个源 - 验证检查点,避免浪费时间/Token
  • Token优化的子章节检索 - 提取子章节而非完整文档的工作流
详细工作流: references/workflows.md

Metadata & Keyword Audit Workflows

元数据与关键词审计工作流

Lightweight audit:
bash
py -3.13 .claude/skills/docs-management/scripts/validation/validate_index_vs_docs.py --summary-only
Tag configuration audit:
bash
py -3.13 .claude/skills/docs-management/scripts/validation/audit_tag_config.py --summary-only
Full details: references/workflows.md#metadata--keyword-audit
轻量审计:
bash
py -3.13 .claude/skills/docs-management/scripts/validation/validate_index_vs_docs.py --summary-only
标签配置审计:
bash
py -3.13 .claude/skills/docs-management/scripts/validation/audit_tag_config.py --summary-only
详细信息: references/workflows.md#metadata--keyword-audit

Platform-Specific Requirements

平台特定要求

Windows Users

Windows用户

MUST use PowerShell (recommended) or prefix Git Bash commands with
MSYS_NO_PATHCONV=1
Git Bash on Windows converts Unix paths to Windows paths, breaking filter patterns.
See: Troubleshooting Guide
必须使用PowerShell(推荐),或在Git Bash命令前添加
MSYS_NO_PATHCONV=1
Windows上的Git Bash会将Unix路径转换为Windows路径,破坏过滤模式。
参考: 故障排除指南

Troubleshooting

故障排除

spaCy Installation Issues

spaCy安装问题

Problem: spaCy installation fails with Python 3.14+.
Solution: The script automatically detects and uses Python 3.13 if available. No manual intervention needed!
If Python 3.13 not available: Install Python 3.13:
  • Windows:
    winget install --id Python.Python.3.13 -e --source winget
  • macOS:
    brew install python@3.13
  • Linux:
    sudo apt install python3.13
Full troubleshooting: references/troubleshooting.md
问题: 使用Python 3.14+时spaCy安装失败。
解决方案: 脚本会自动检测并使用可用的Python 3.13,无需手动干预!
如果Python 3.13不可用: 安装Python 3.13:
  • Windows:
    winget install --id Python.Python.3.13 -e --source winget
  • macOS:
    brew install python@3.13
  • Linux:
    sudo apt install python3.13
完整故障排除: references/troubleshooting.md

Public API

公共API

The docs-management skill provides a clean public API for external tools:
python
from official_docs_api import (
    find_document,
    resolve_doc_id,
    get_docs_by_tag,
    get_docs_by_category,
    search_by_keywords,
    detect_drift,
    cleanup_drift,
    refresh_index
)
Full API documentation: See Public API section in original SKILL.md
docs-management技能为外部工具提供简洁的公共API:
python
from official_docs_api import (
    find_document,
    resolve_doc_id,
    get_docs_by_tag,
    get_docs_by_category,
    search_by_keywords,
    detect_drift,
    cleanup_drift,
    refresh_index
)
完整API文档: 请参阅原始SKILL.md中的Public API部分

Plugin Maintenance

插件维护

For plugin-specific maintenance workflows (versioning, publishing updates, changelog):
See: references/plugin-maintenance.md
Quick reference:
  • Update workflow: Scrape → Validate → Review → Commit → Version bump → Push
  • Version bumps: Patch for doc refresh, Minor for new sources/features, Major for breaking changes
  • Testing: Run
    manage_index.py verify
    and test search before pushing
插件特定的维护工作流(版本控制、发布更新、变更日志):
参考: references/plugin-maintenance.md
快速参考:
  • 更新工作流:爬取 → 验证 → 审核 → 提交 → 版本升级 → 推送
  • 版本升级:文档更新使用Patch版本,新增源/功能使用Minor版本,重大变更使用Major版本
  • 测试:推送前运行
    manage_index.py verify
    并测试搜索功能

Development Mode

开发模式

When developing this plugin locally, you may want changes to go to your dev repo instead of the installed plugin location. This skill supports explicit dev/prod mode separation via environment variable.
当本地开发此插件时,您可能希望更改保存到开发仓库而非已安装的插件位置。本技能通过环境变量明确支持开发/生产模式分离。

How It Works

工作原理

By default, scripts write to wherever the plugin is installed (typically
~/.claude/plugins/marketplaces/...
). When
OFFICIAL_DOCS_DEV_ROOT
is set to a valid skill directory, all paths resolve to that location instead.
默认情况下,脚本写入插件安装位置(通常为
~/.claude/plugins/marketplaces/...
)。当
OFFICIAL_DOCS_DEV_ROOT
设置为有效的技能目录时,所有路径将解析到该位置。

Enabling Dev Mode

启用开发模式

One-time setup:
bash
undefined
一次性设置:
bash
undefined

Navigate to your dev repo skill directory

导航到您的开发仓库技能目录

cd /path/to/your/claude-code-plugins/plugins/claude-ecosystem/skills/docs-management
cd /path/to/your/claude-code-plugins/plugins/claude-ecosystem/skills/docs-management

Generate shell commands for your shell

为您的shell生成命令

python scripts/setup/enable_dev_mode.py

**PowerShell:**

```powershell
$env:OFFICIAL_DOCS_DEV_ROOT = "D:\repos\gh\claude-code-plugins\plugins\claude-ecosystem\skills\docs-management"
Bash/Zsh:
bash
export OFFICIAL_DOCS_DEV_ROOT="/path/to/claude-code-plugins/plugins/claude-ecosystem/skills/docs-management"
python scripts/setup/enable_dev_mode.py

**PowerShell:**

```powershell
$env:OFFICIAL_DOCS_DEV_ROOT = "D:\repos\gh\claude-code-plugins\plugins\claude-ecosystem\skills\docs-management"
Bash/Zsh:
bash
export OFFICIAL_DOCS_DEV_ROOT="/path/to/claude-code-plugins/plugins/claude-ecosystem/skills/docs-management"

Verifying Mode

验证模式

When you run any major script (scrape, refresh, rebuild), a mode banner will display:
Dev mode:
text
[DEV MODE] Using development skill directory:
  D:\repos\gh\claude-code-plugins\plugins\claude-ecosystem\skills\docs-management
  Set via: OFFICIAL_DOCS_DEV_ROOT
Canonical dir: D:\...\canonical
Prod mode:
text
[PROD MODE] Using installed skill directory
  (Set OFFICIAL_DOCS_DEV_ROOT to enable dev mode)
当您运行任何主要脚本(爬取、刷新、重建)时,会显示模式横幅:
开发模式:
text
[DEV MODE] 使用开发技能目录:
  D:\repos\gh\claude-code-plugins\plugins\claude-ecosystem\skills\docs-management
  设置来源: OFFICIAL_DOCS_DEV_ROOT
标准目录: D:\...\canonical
生产模式:
text
[PROD MODE] 使用已安装的技能目录
  (设置OFFICIAL_DOCS_DEV_ROOT以启用开发模式)

Development Workflow

开发工作流

  1. Set
    OFFICIAL_DOCS_DEV_ROOT
    in your terminal
  2. Run scripts - output goes to dev repo
  3. Track changes:
    git diff canonical/
  4. Commit and push when ready
  1. 在终端中设置
    OFFICIAL_DOCS_DEV_ROOT
  2. 运行脚本 - 输出保存到开发仓库
  3. 跟踪变更:
    git diff canonical/
  4. 准备就绪后提交并推送

Disabling Dev Mode

禁用开发模式

PowerShell:
powershell
Remove-Item Env:OFFICIAL_DOCS_DEV_ROOT
Bash/Zsh:
bash
unset OFFICIAL_DOCS_DEV_ROOT
PowerShell:
powershell
Remove-Item Env:OFFICIAL_DOCS_DEV_ROOT
Bash/Zsh:
bash
unset OFFICIAL_DOCS_DEV_ROOT

Related Documentation

相关文档

  • index.yaml (in canonical storage) - Complete registry of docs and extracts
  • references/parallelization-strategy.md - Parallelization decision trees
  • references/plugin-maintenance.md - Plugin update and publishing workflows
  • DEPENDENCIES.md - Script dependency graph and execution order
  • index.yaml(在标准存储中)- 完整的文档和提取内容注册表
  • references/parallelization-strategy.md - 并行化决策树
  • references/plugin-maintenance.md - 插件更新和发布工作流
  • DEPENDENCIES.md - 脚本依赖图和执行顺序

Version History

版本历史

  • v1.19.0 (2025-11-25): Determinism fixes and observability enhancements
  • v1.18.0 (2025-11-18): CRITICAL FIX: Enforce foreground execution pattern
  • v1.17.1 (2025-11-18): Fix Task tool invocation syntax
  • v1.17.0 (2025-11-18): Critical workflow execution guidance + error reporting
  • v1.16.0 (2025-11-17): Comprehensive search quality audit & fixes (100% pass rate)
  • v1.15.0 (2025-11-17): Critical bug fix + domain prioritization
  • v1.14.0 (2025-11-17): Comprehensive skill audit & validation (A+ grade)
Full history: See original SKILL.md
  • v1.19.0 (2025-11-25): 确定性修复与可观测性增强
  • v1.18.0 (2025-11-18): 关键修复:强制前台执行模式
  • v1.17.1 (2025-11-18): 修复Task工具调用语法
  • v1.17.0 (2025-11-18): 关键工作流执行指南 + 错误报告
  • v1.16.0 (2025-11-17): 全面搜索质量审计与修复(100%通过率)
  • v1.15.0 (2025-11-17): 关键Bug修复 + 域优先级
  • v1.14.0 (2025-11-17): 全面技能审计与验证(A级)
完整历史:请参阅原始SKILL.md

Last Updated

最后更新

Date: 2025-12-29 Model: claude-opus-4-5-20251101
Audit Result:EXCEPTIONAL PASS (A+) - Score: 50/50 (100%)
Audit Type: Type B (Meta-Skill - Delegation Pattern Compliance)
Status: Production-ready. Serves as the canonical reference implementation for Type B meta-skills.
日期: 2025-12-29 模型: claude-opus-4-5-20251101
审计结果:优秀通过(A+) - 得分: 50/50 (100%)
审计类型: Type B(元技能 - 委托模式合规性)
状态: 可用于生产环境。作为Type B元技能的标准参考实现。