core-fix-skill-docs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseFix Skill Documentation
修复技能文档
Version: 2.1.0 | Last Updated: 2025-01-27
Check and fix missing reference files in dynamic skills.
版本: 2.1.0 | 最后更新: 2025-01-27
检查并修复动态技能中缺失的引用文件。
Usage
使用方法
/fix-skill-docs [crate_name] [--check-only] [--remove-invalid]Arguments:
- : Specific crate to check (optional, defaults to all)
crate_name - : Only report issues, don't fix
--check-only - : Remove invalid references instead of creating files
--remove-invalid
/fix-skill-docs [crate_name] [--check-only] [--remove-invalid]参数:
- : 要检查的特定crate(可选,默认检查全部)
crate_name - : 仅报告问题,不进行修复
--check-only - : 删除无效引用而非创建文件
--remove-invalid
Execution Mode Detection
执行模式检测
CRITICAL: Check if agent infrastructure is available.
This skill can run in two modes:
- Agent Mode: Uses background agents for documentation fetching
- Inline Mode: Executes directly using agent-browser CLI or WebFetch
重要提示:检查Agent基础设施是否可用。
该技能可在两种模式下运行:
- Agent模式: 使用后台Agent获取文档
- 内联模式: 直接通过agent-browser CLI或WebFetch执行
Agent Mode (Plugin Install)
Agent模式(插件安装)
When agent infrastructure is available, use background agents for fetching:
当Agent基础设施可用时,使用后台Agent进行获取:
Instructions
操作步骤
1. Scan Skills Directory
1. 扫描技能目录
bash
undefinedbash
undefinedIf crate_name provided
如果提供了crate_name
skill_dir=~/.claude/skills/{crate_name}
skill_dir=~/.claude/skills/{crate_name}
Otherwise scan all
否则扫描所有技能
for dir in ~/.claude/skills/*/; do
# Process each skill
done
undefinedfor dir in ~/.claude/skills/*/; do
# 处理每个技能
done
undefined2. Parse SKILL.md for References
2. 解析SKILL.md中的引用
Extract referenced files from Documentation section:
markdown
undefined从文档部分提取引用的文件:
markdown
undefinedDocumentation
文档
- - Description
./references/file1.md
undefined- - 描述
./references/file1.md
undefined3. Check File Existence
3. 检查文件是否存在
bash
if [ ! -f "{skill_dir}/references/{filename}" ]; then
echo "MISSING: {filename}"
fibash
if [ ! -f "{skill_dir}/references/{filename}" ]; then
echo "缺失: {filename}"
fi4. Report Status
4. 报告状态
=== {crate_name} ===
SKILL.md: OK
references/:
- sync.md: OK
- runtime.md: MISSING
Action needed: 1 file missing=== {crate_name} ===
SKILL.md: 正常
references/:
- sync.md: 正常
- runtime.md: 缺失
需要执行操作: 1个文件缺失5. Fix Missing Files (Agent Mode)
5. 修复缺失文件(Agent模式)
Launch background agent to fetch documentation:
Task(
subagent_type: "general-purpose",
run_in_background: true,
prompt: "Fetch documentation for {crate_name}/{module} from docs.rs.
Use agent-browser CLI to navigate to https://docs.rs/{crate_name}/latest/{crate_name}/{module}/
Extract the main documentation and save to ~/.claude/skills/{crate_name}/references/{module}.md"
)启动后台Agent获取文档:
Task(
subagent_type: "general-purpose",
run_in_background: true,
prompt: "从docs.rs获取{crate_name}/{module}的文档。
使用agent-browser CLI导航至https://docs.rs/{crate_name}/latest/{crate_name}/{module}/
提取主要文档内容并保存至~/.claude/skills/{crate_name}/references/{module}.md"
)Inline Mode (Skills-only Install)
内联模式(仅技能安装)
When agent infrastructure is NOT available, execute directly:
当Agent基础设施不可用时,直接执行:
Step 1: Scan Skills Directory
步骤1:扫描技能目录
bash
undefinedbash
undefinedList all skills
列出所有技能
ls ~/.claude/skills/
ls ~/.claude/skills/
Or check specific skill
或检查特定技能
ls ~/.claude/skills/{crate_name}/
undefinedls ~/.claude/skills/{crate_name}/
undefinedStep 2: Parse SKILL.md for References
步骤2:解析SKILL.md中的引用
Read SKILL.md and extract all patterns:
./references/*.mdbash
undefined读取SKILL.md并提取所有模式:
./references/*.mdbash
undefinedUsing Read tool
使用Read工具
Read("~/.claude/skills/{crate_name}/SKILL.md")
Read("~/.claude/skills/{crate_name}/SKILL.md")
Look for lines like:
查找如下格式的行:
- ./references/sync.md
- Sync primitives
./references/sync.md- ./references/sync.md
- 同步原语
./references/sync.md- ./references/runtime.md
- Runtime configuration
./references/runtime.md- ./references/runtime.md
- 运行时配置
./references/runtime.mdundefinedundefinedStep 3: Check File Existence
步骤3:检查文件是否存在
bash
undefinedbash
undefinedCheck each referenced file
检查每个引用文件
for ref in references; do
if [ ! -f "~/.claude/skills/{crate_name}/references/${ref}.md" ]; then
echo "MISSING: ${ref}.md"
fi
done
undefinedfor ref in references; do
if [ ! -f "~/.claude/skills/{crate_name}/references/${ref}.md" ]; then
echo "缺失: ${ref}.md"
fi
done
undefinedStep 4: Report Status
步骤4:报告状态
Output format:
=== {crate_name} ===
SKILL.md: OK
references/:
- sync.md: OK
- runtime.md: MISSING
Action needed: 1 file missing输出格式:
=== {crate_name} ===
SKILL.md: 正常
references/:
- sync.md: 正常
- runtime.md: 缺失
需要执行操作: 1个文件缺失Step 5: Fix Missing Files (Inline)
步骤5:修复缺失文件(内联模式)
For each missing file:
Using agent-browser CLI:
bash
agent-browser open "https://docs.rs/{crate_name}/latest/{crate_name}/{module}/"
agent-browser get text ".docblock"针对每个缺失文件:
使用agent-browser CLI:
bash
agent-browser open "https://docs.rs/{crate_name}/latest/{crate_name}/{module}/"
agent-browser get text ".docblock"Save output to ~/.claude/skills/{crate_name}/references/{module}.md
将输出保存至~/.claude/skills/{crate_name}/references/{module}.md
agent-browser close
**Using WebFetch fallback:**WebFetch("https://docs.rs/{crate_name}/latest/{crate_name}/{module}/",
"Extract the main documentation content for this module")
Then write the content:
```bash
Write("~/.claude/skills/{crate_name}/references/{module}.md", <fetched_content>)agent-browser close
**使用WebFetch备选方案:**WebFetch("https://docs.rs/{crate_name}/latest/{crate_name}/{module}/",
"提取该模块的主要文档内容")
然后写入内容:
```bash
Write("~/.claude/skills/{crate_name}/references/{module}.md", <fetched_content>)Step 6: Update SKILL.md (if --remove-invalid)
步骤6:更新SKILL.md(如果使用--remove-invalid)
If flag is set and file cannot be fetched:
--remove-invalidbash
undefined如果设置了标志且无法获取文件:
--remove-invalidbash
undefinedRead current SKILL.md
读取当前SKILL.md
Read("~/.claude/skills/{crate_name}/SKILL.md")
Read("~/.claude/skills/{crate_name}/SKILL.md")
Remove the invalid reference line
删除无效引用行
Edit("~/.claude/skills/{crate_name}/SKILL.md",
old_string="- - Description",
new_string="")
./references/{invalid_file}.md
---Edit("~/.claude/skills/{crate_name}/SKILL.md",
old_string="- - 描述",
new_string="")
./references/{invalid_file}.md
---Tool Priority
工具优先级
- agent-browser CLI - Primary tool for fetching documentation
- WebFetch - Fallback if agent-browser unavailable
- Edit SKILL.md - For removing invalid references (--remove-invalid only)
- agent-browser CLI - 获取文档的主要工具
- WebFetch - 当agent-browser不可用时的备选方案
- 编辑SKILL.md - 仅在使用--remove-invalid时用于删除无效引用
Examples
示例
Check All Skills (--check-only)
检查所有技能(--check-only)
bash
/fix-skill-docs --check-onlybash
/fix-skill-docs --check-onlyOutput:
输出:
=== tokio ===
SKILL.md: OK
references/:
- sync.md: OK
- runtime.md: MISSING
- task.md: OK
=== serde ===
SKILL.md: OK
references/:
- derive.md: OK
Summary: 1 file missing in 1 skill
undefined=== tokio ===
SKILL.md: 正常
references/:
- sync.md: 正常
- runtime.md: 缺失
- task.md: 正常
=== serde ===
SKILL.md: 正常
references/:
- derive.md: 正常
摘要: 1个技能中存在1个缺失文件
undefinedFix Specific Crate
修复特定Crate
bash
/fix-skill-docs tokiobash
/fix-skill-docs tokioFetches missing runtime.md from docs.rs
从docs.rs获取缺失的runtime.md
Reports success
报告成功
undefinedundefinedRemove Invalid References
删除无效引用
bash
/fix-skill-docs tokio --remove-invalidbash
/fix-skill-docs tokio --remove-invalidIf runtime.md cannot be fetched:
如果无法获取runtime.md:
Removes reference from SKILL.md instead
从SKILL.md中移除该引用
---
---Error Handling
错误处理
| Error | Cause | Solution |
|---|---|---|
| Agent not available | Skills-only install | Use inline mode |
| Skills directory empty | No skills installed | Run /sync-crate-skills first |
| docs.rs unavailable | Network issue | Retry or use --remove-invalid |
| Permission denied | Directory issue | Check ~/.claude/skills/ permissions |
| Invalid SKILL.md format | Corrupted skill | Re-generate skill |
| 错误 | 原因 | 解决方案 |
|---|---|---|
| Agent不可用 | 仅安装了技能 | 使用内联模式 |
| 技能目录为空 | 未安装任何技能 | 先运行/sync-crate-skills |
| docs.rs不可用 | 网络问题 | 重试或使用--remove-invalid |
| 权限被拒绝 | 目录问题 | 检查~/.claude/skills/的权限 |
| SKILL.md格式无效 | 技能已损坏 | 重新生成技能 |