关于 rust-learner
面向 Agent 的 Rust 信息查询技能,可检索 crate 版本、API 文档、版本更新和 Clippy lint;根据环境使用专门 Agent 或内联流程。
主要功能
- 01查询 crate 版本
- 02查找 Rust 发布特性
- 03查阅标准库文档
- 04查阅第三方 crate 文档
- 05查询 Clippy lint
适用场景
- 01核实 crate 最新版本
- 02了解 Rust 版本更新
- 03查找 Rust API 文档
- 04查询 Clippy lint
安装
复制下面的命令,在终端中运行。
$
npx skills add https:/ / github.com/ actionbook/ rust-skills --skill rust-learner安装后在 Claude Code 中输入/rust-learner确认已加载。
详细介绍
Rust Learner
版本: 2.1.0 | 最后更新: 2025-01-27
你擅长获取 Rust 和 crate 信息。帮助用户:
- 版本查询:获取最新的 Rust/crate 版本
- API 文档:从 docs.rs 获取文档
- 变更日志:从 releases.rs 获取 Rust 版本的功能信息
用于获取 Rust/crate 信息的主要技能。
执行模式检测
重要:首先检查 Agent 文件是否可用,以确定执行模式。
尝试读取与你的查询类型对应的 Agent 文件。执行模式取决于文件是否存在:
| 查询类型 | Agent 文件路径 |
|---|---|
| Crate 信息/版本 | ../../agents/crate-researcher.md |
| Rust 版本功能 | ../../agents/rust-changelog.md |
| 标准库文档 | ../../agents/std-docs-researcher.md |
| 第三方 crate 文档 | ../../agents/docs-researcher.md |
| Clippy lint | ../../agents/clippy-researcher.md |
Agent 模式(插件安装)
当 ../../agents/ 中存在 Agent 文件时:
工作流
- 读取相应的 Agent 文件(相对于此技能)
- 使用
run_in_background: true启动 Task - 继续其他工作或等待任务完成
- 向用户总结结果
Task(
subagent_type: "general-purpose",
run_in_background: true,
prompt: <read from ../../agents/*.md file>
)
Agent 路由表
| 查询类型 | Agent 文件 | 来源 |
|---|---|---|
| Rust 版本功能 | ../../agents/rust-changelog.md | releases.rs |
| Crate 信息/版本 | ../../agents/crate-researcher.md | lib.rs、crates.io |
| 标准库文档(Send、Sync、Arc 等) | ../../agents/std-docs-researcher.md | doc.rust-lang.org |
| 第三方 crate 文档(tokio、serde 等) | ../../agents/docs-researcher.md | docs.rs |
| Clippy lint | ../../agents/clippy-researcher.md | rust-clippy 文档 |
Agent 模式示例
Crate 版本查询:
User: "tokio latest version"
Claude:
1. Read ../../agents/crate-researcher.md
2. Task(subagent_type: "general-purpose", run_in_background: true, prompt: <agent content>)
3. Wait for agent
4. Summarize results
Rust 变更日志查询:
User: "What's new in Rust 1.85?"
Claude:
1. Read ../../agents/rust-changelog.md
2. Task(subagent_type: "general-purpose", run_in_background: true, prompt: <agent content>)
3. Wait for agent
4. Summarize features
内联模式(仅安装技能)
当 Agent 文件不可用时,请按以下步骤直接执行:
Crate 信息查询
1. actionbook: mcp__actionbook__search_actions("lib.rs crate info")
2. Get action details: mcp__actionbook__get_action_by_id(<action_id>)
3. agent-browser CLI (or WebFetch fallback):
- open "https://lib.rs/crates/{crate_name}"
- get text using selector from actionbook
- close
4. Parse and format output
输出格式:
## {Crate Name}
**Version:** {latest}
**Description:** {description}
**Features:**
- `feature1`: description
**Links:**
- [docs.rs](https://docs.rs/{crate}) | [crates.io](https://crates.io/crates/{crate}) | [repo]({repo_url})
Rust 版本查询
1. actionbook: mcp__actionbook__search_actions("releases.rs rust changelog")
2. Get action details for selectors
3. agent-browser CLI (or WebFetch fallback):
- open "https://releases.rs/docs/1.{version}.0/"
- get text using selector from actionbook
- close
4. Parse and format output
输出格式:
## Rust 1.{version}
**Release Date:** {date}
### Language Features
- Feature 1: description
- Feature 2: description
### Library Changes
- std::module: new API
### Stabilized APIs
- `api_name`: description
标准库文档(std::*, Send、Sync、Arc 等)
1. Construct URL: "https://doc.rust-lang.org/std/{path}/"
- Traits: std/{module}/trait.{Name}.html
- Structs: std/{module}/struct.{Name}.html
- Modules: std/{module}/index.html
2. agent-browser CLI (or WebFetch fallback):
- open <url>
- get text "main .docblock"
- close
3. Parse and format output
常见标准库路径:
| 项目 | 路径 |
|---|---|
| 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 |
输出格式:
## std::{path}::{Name}
**Signature:**
```rust
{signature}
描述: {description}
示例:
{example_code}
### Third-Party Crate Docs (tokio, serde, etc.)
- 构造 URL:"https://docs.rs/{crate}/latest/{crate}/{path}"
- agent-browser CLI(或使用 WebFetch 作为后备方案):
- 打开
- 获取文本 ".docblock"
- 关闭
- 解析并格式化输出
**Output Format:**
```markdown
## {crate}::{path}
**Signature:**
```rust
{signature}
描述: {description}
示例:
{example_code}
### Clippy Lints
- agent-browser CLI(或使用 WebFetch 作为后备方案):
- 打开 "https://rust-lang.github.io/rust-clippy/stable/"
- 在页面中搜索 lint 名称
- 获取匹配 lint 的文本 ".lint-doc"
- 关闭
- 解析并格式化输出
**Output Format:**
```markdown
## Clippy Lint: {lint_name}
**Level:** {warn|deny|allow}
**Category:** {category}
**Description:**
{what_it_checks}
**Example (Bad):**
```rust
{bad_code}
示例(正确):
{good_code}
---
## Tool Chain Priority
Both modes use the same tool chain order:
1. **actionbook MCP** - Get pre-computed selectors first
- `mcp__actionbook__search_actions("site_name")` → get action ID
- `mcp__actionbook__get_action_by_id(id)` → get URL + selectors
2. **agent-browser CLI** - Primary execution tool
```bash
agent-browser open <url>
agent-browser get text <selector_from_actionbook>
agent-browser close
- WebFetch——仅在 agent-browser 不可用时作为最后手段
后备原则(重要)
actionbook → agent-browser → WebFetch (only if agent-browser unavailable)
不要:
- 因为 agent-browser 较慢就跳过它
- agent-browser 可用时,将 WebFetch 用作首选
- 未先尝试 agent-browser 就等待 WebFetch
已弃用的模式
| 已弃用 | 改用 | 原因 |
|---|---|---|
| 使用 WebSearch 查询 crate 信息 | Task + Agent 或内联模式 | 结构化数据 |
| 直接使用 WebFetch | actionbook + agent-browser | 预先计算的选择器 |
| 猜测版本号 | 始终从来源获取 | 防止错误信息 |
错误处理
| 错误 | 原因 | 解决方案 |
|---|---|---|
| 未找到 Agent 文件 | 仅安装了技能 | 使用内联模式 |
| actionbook 不可用 | 未配置 MCP | 改用 WebFetch |
| 未找到 agent-browser | 未安装 CLI | 改用 WebFetch |
| Agent 超时 | 网站响应缓慢或无法访问 | 重试或告知用户 |
| 结果为空 | 选择器不匹配 | 报告问题并使用 WebFetch 作为后备方案 |
主动触发
出现以下情况时,此技能会自动触发:
- 提及任何 Rust crate 名称(tokio、serde、axum、sqlx 等)
- 询问“最新”“新”“版本”或“更新日志”
- 请求 API 文档
- 询问依赖项或功能
不要使用 WebSearch 查询 Rust crate 信息。请改用 Agent 或内联模式。
评论
支持 Markdown