关于 rust-skill-creator
从 crate、Rust 标准库或用户提供的文档 URL 创建文档技能。相关命令可用时采用命令流程,否则按手动流程生成技能文件。
主要功能
- 01为 Rust crate 创建技能
- 02为标准库 API 创建技能
- 03支持自定义文档 URL
- 04生成 SKILL.md 和参考文件
- 05支持命令或手动流程
适用场景
- 01为 tokio 等 crate 创建技能
- 02为 Rust 标准库类型创建技能
- 03将文档 URL 转为技能
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ actionbook/ rust-skills --skill rust-skill-creator安装后在 Claude Code 中输入/rust-skill-creator确认已加载。
详细介绍
Rust 技能创建器
版本: 2.1.0 | 最后更新: 2025-01-27
为 Rust crate 和标准库文档创建动态技能。
适用场景
此技能用于处理以下技能创建请求:
- 第三方 crate(tokio、serde、axum 等)
- Rust 标准库(std::sync、std::marker 等)
- 任何 Rust 文档 URL
执行模式检测
重要:检查相关命令/技能是否可用。
此技能依赖:
/create-llms-for-skills命令/create-skills-via-llms命令
Agent 模式(插件安装)
当上述命令可用时(完整插件安装):
工作流
1. 确定目标
| 用户请求 | 目标类型 | URL 格式 |
|---|---|---|
| "create tokio skill" | 第三方 crate | docs.rs/tokio/latest/tokio/ |
| "create Send trait skill" | 标准库 | doc.rust-lang.org/std/marker/trait.Send.html |
| "create skill from URL" + URL | 自定义 URL | 用户提供的 URL |
2. 执行命令
使用 /create-llms-for-skills 命令:
/create-llms-for-skills <url> [requirements]
示例:
# For third-party crate
/create-llms-for-skills https://docs.rs/tokio/latest/tokio/
# For std library
/create-llms-for-skills https://doc.rust-lang.org/std/marker/trait.Send.html
# With specific requirements
/create-llms-for-skills https://docs.rs/axum/latest/axum/ "Focus on routing and extractors"
3. 后续创建技能
生成 llms.txt 后,使用:
/create-skills-via-llms <crate_name> <llms_path> [version]
内联模式(仅安装技能)
当上述命令不可用时,手动创建技能:
步骤 1:确定目标并构建 URL
| 目标 | URL 模板 |
|---|---|
| Crate 概览 | https://docs.rs/{crate}/latest/{crate}/ |
| Crate 模块 | https://docs.rs/{crate}/latest/{crate}/{module}/ |
| 标准库 trait | https://doc.rust-lang.org/std/{module}/trait.{Name}.html |
| 标准库 struct | https://doc.rust-lang.org/std/{module}/struct.{Name}.html |
| 标准库模块 | https://doc.rust-lang.org/std/{module}/index.html |
步骤 2:获取文档
# Using agent-browser CLI
agent-browser open "<documentation_url>"
agent-browser get text ".docblock"
agent-browser close
或使用 WebFetch 作为备用方案:
WebFetch("<documentation_url>", "Extract API documentation including types, functions, and examples")
步骤 3:创建技能目录
mkdir -p ~/.claude/skills/{crate_name}
mkdir -p ~/.claude/skills/{crate_name}/references
步骤 4:生成 SKILL.md
使用此模板创建 ~/.claude/skills/{crate_name}/SKILL.md:
---
name: {crate_name}
description: "Documentation for {crate_name} crate. Keywords: {keywords}"
---
# {Crate Name}
> **Version:** {version} | **Source:** docs.rs
## Overview
{Brief description from documentation}
## Key Types
### {Type1}
{Description and usage}
### {Type2}
{Description and usage}
## Common Patterns
{Usage patterns extracted from documentation}
## Examples
```rust
{Example code from documentation}
文档
./references/overview.md- 主要概览./references/{module}.md- 模块文档
链接
### Step 5: Generate Reference Files
For each major module or type, create a reference file:
```bash
# Fetch and save module documentation
agent-browser open "https://docs.rs/{crate}/latest/{crate}/{module}/"
agent-browser get text ".docblock" > ~/.claude/skills/{crate_name}/references/{module}.md
agent-browser close
步骤 6:验证技能
# Check skill structure
ls -la ~/.claude/skills/{crate_name}/
cat ~/.claude/skills/{crate_name}/SKILL.md
URL 构建辅助
| 目标 | URL 模板 |
|---|---|
| Crate 概览 | https://docs.rs/{crate}/latest/{crate}/ |
| Crate 模块 | https://docs.rs/{crate}/latest/{crate}/{module}/ |
| 标准库 trait | https://doc.rust-lang.org/std/{module}/trait.{Name}.html |
| 标准库 struct | https://doc.rust-lang.org/std/{module}/struct.{Name}.html |
| 标准库模块 | https://doc.rust-lang.org/std/{module}/index.html |
常见标准库路径
| 项目 | 路径 |
|---|---|
| Send、Sync、Copy、Clone | std/marker/trait.{Name}.html |
| Arc、Mutex、RwLock | std/sync/struct.{Name}.html |
| Rc、Weak | std/rc/struct.{Name}.html |
| RefCell、Cell | std/cell/struct.{Name}.html |
| Box | std/boxed/struct.Box.html |
| Vec | std/vec/struct.Vec.html |
| String | std/string/struct.String.html |
| Option | std/option/enum.Option.html |
| Result | std/result/enum.Result.html |
交互示例
示例 1:创建 Crate 技能(Agent 模式)
User: "Create a dynamic skill for tokio"
Claude:
1. Identify: Third-party crate "tokio"
2. Execute: /create-llms-for-skills https://docs.rs/tokio/latest/tokio/
3. Wait for llms.txt generation
4. Execute: /create-skills-via-llms tokio ~/tmp/{timestamp}-tokio-llms.txt
示例 2:创建 Crate 技能(内联模式)
User: "Create a dynamic skill for tokio"
Claude:
1. Identify: Third-party crate "tokio"
2. Fetch: agent-browser open "https://docs.rs/tokio/latest/tokio/"
3. Extract documentation
4. Create: ~/.claude/skills/tokio/SKILL.md
5. Create: ~/.claude/skills/tokio/references/
6. Save reference files for key modules (sync, task, runtime, etc.)
示例 3:创建标准库技能
User: "Create a skill for Send and Sync traits"
Claude:
1. Identify: Std library traits
2. (Agent Mode) Execute: /create-llms-for-skills https://doc.rust-lang.org/std/marker/trait.Send.html https://doc.rust-lang.org/std/marker/trait.Sync.html
(Inline Mode) Fetch each URL, create skill manually
3. Complete skill creation
禁止事项
- 创建 Rust 相关技能时使用
best-skill-creator - 未经验证就猜测文档 URL
- 跳过获取文档的步骤
输出位置
所有生成的技能都保存在:~/.claude/skills/
错误处理
| 错误 | 原因 | 解决方案 |
|---|---|---|
| 未找到命令 | 仅安装了技能 | 使用内联模式 |
| 未找到 URL | crate/module 无效 | 确认 crate 存在于 crates.io |
| 文档为空 | API 已更改 | 使用替代选择器 |
| 权限被拒绝 | 目录问题 | 检查 ~/.claude/skills/ 权限 |
评论
支持 Markdown