core-dynamic-skills

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Dynamic Skills Manager

动态技能管理器

Version: 2.1.0 | Last Updated: 2025-01-27
Orchestrates on-demand generation of crate-specific skills based on project dependencies.
版本: 2.1.0 | 最后更新: 2025-01-27
根据项目依赖按需编排生成特定crate的技能。

Concept

概念

Dynamic skills are:
  • Generated locally at
    ~/.claude/skills/
  • Based on Cargo.toml dependencies
  • Created using llms.txt from docs.rs
  • Versioned and updatable
  • Not committed to the rust-skills repository
动态技能具备以下特性:
  • 在本地
    ~/.claude/skills/
    目录生成
  • 基于Cargo.toml依赖项
  • 利用docs.rs的llms.txt创建
  • 可版本化和更新
  • 不会提交到rust-skills仓库

Trigger Scenarios

触发场景

Prompt-on-Open

打开时提示

When entering a directory with Cargo.toml:
  1. Detect Cargo.toml (single or workspace)
  2. Parse dependencies list
  3. Check which crates are missing skills
  4. If missing: "Found X dependencies without skills. Sync now?"
  5. If confirmed: run
    /sync-crate-skills
进入包含Cargo.toml的目录时:
  1. 检测Cargo.toml(单个项目或工作区)
  2. 解析依赖列表
  3. 检查哪些crate缺少技能
  4. 若存在缺失:“发现X个无对应技能的依赖项。是否立即同步?”
  5. 若确认:运行
    /sync-crate-skills

Manual Commands

手动命令

  • /sync-crate-skills
    - Sync all dependencies
  • /clean-crate-skills [crate]
    - Remove skills
  • /update-crate-skill <crate>
    - Update specific skill
  • /sync-crate-skills
    - 同步所有依赖项
  • /clean-crate-skills [crate]
    - 删除技能
  • /update-crate-skill <crate>
    - 更新特定技能

Execution Mode Detection

执行模式检测

CRITICAL: Check if agent and command infrastructure is available.
Try to read:
../../agents/
directory Check if
/create-llms-for-skills
and
/create-skills-via-llms
commands work.

关键:检查agent和命令基础设施是否可用。
尝试读取:
../../agents/
目录 检查
/create-llms-for-skills
/create-skills-via-llms
命令是否可正常工作。

Agent Mode (Plugin Install)

Agent模式(插件安装)

When full plugin infrastructure is available:
当完整插件基础设施可用时:

Architecture

架构

Cargo.toml
Parse dependencies
For each crate:
  ├─ Check ~/.claude/skills/{crate}/
  ├─ If missing: Check actionbook for llms.txt
  │     ├─ Found: /create-skills-via-llms
  │     └─ Not found: /create-llms-for-skills first
  └─ Load skill
Cargo.toml
解析依赖项
针对每个crate:
  ├─ 检查~/.claude/skills/{crate}/
  ├─ 若缺失:检查actionbook中的llms.txt
  │     ├─ 找到:执行/create-skills-via-llms
  │     └─ 未找到:先执行/create-llms-for-skills
  └─ 加载技能

Workflow Priority

工作流优先级

  1. actionbook MCP - Check for pre-generated llms.txt
  2. /create-llms-for-skills - Generate llms.txt from docs.rs
  3. /create-skills-via-llms - Create skills from llms.txt
  1. actionbook MCP - 检查预生成的llms.txt
  2. /create-llms-for-skills - 从docs.rs生成llms.txt
  3. /create-skills-via-llms - 基于llms.txt创建技能

Sync Command

同步命令

bash
/sync-crate-skills [--force]
  1. Parse Cargo.toml for dependencies
  2. For each dependency:
    • Check if skill exists at
      ~/.claude/skills/{crate}/
    • If missing (or --force): generate skill
  3. Report results

bash
/sync-crate-skills [--force]
  1. 解析Cargo.toml获取依赖项
  2. 针对每个依赖项:
    • 检查技能是否存在于
      ~/.claude/skills/{crate}/
    • 若缺失(或使用--force参数):生成技能
  3. 报告结果

Inline Mode (Skills-only Install)

内联模式(仅技能安装)

When agent/command infrastructure is NOT available, execute manually:
当agent/命令基础设施不可用时,手动执行:

Step 1: Parse Cargo.toml

步骤1:解析Cargo.toml

bash
undefined
bash
undefined

Read dependencies

读取依赖项

cat Cargo.toml | grep -A 100 '[dependencies]' | grep -E '^[a-zA-Z]'

Or use Read tool to parse Cargo.toml and extract:
- `[dependencies]` section
- `[dev-dependencies]` section (optional)
- Workspace members (if workspace project)
cat Cargo.toml | grep -A 100 '[dependencies]' | grep -E '^[a-zA-Z]'

或使用读取工具解析Cargo.toml并提取:
- `[dependencies]`章节
- `[dev-dependencies]`章节(可选)
- 工作区成员(若为工作区项目)

Step 2: Check Existing Skills

步骤2:检查现有技能

bash
undefined
bash
undefined

List existing skills

列出已有技能

ls ~/.claude/skills/

Compare with dependencies to find missing skills.
ls ~/.claude/skills/

与依赖项对比,找出缺失的技能。

Step 3: Generate Missing Skills

步骤3:生成缺失的技能

For each missing crate:
bash
undefined
针对每个缺失的crate:
bash
undefined

1. Fetch crate documentation

1. 获取crate文档

agent-browser open "https://docs.rs/{crate}/latest/{crate}/" agent-browser get text ".docblock"
agent-browser open "https://docs.rs/{crate}/latest/{crate}/" agent-browser get text ".docblock"

Save content

保存内容

2. Create skill directory

2. 创建技能目录

mkdir -p ~/.claude/skills/{crate} mkdir -p ~/.claude/skills/{crate}/references
mkdir -p ~/.claude/skills/{crate} mkdir -p ~/.claude/skills/{crate}/references

3. Create SKILL.md

3. 创建SKILL.md

Use template from rust-skill-creator inline mode

使用rust-skill-creator内联模式的模板

4. Create reference files for key modules

4. 为关键模块创建参考文件

agent-browser open "https://docs.rs/{crate}/latest/{crate}/{module}/" agent-browser get text ".docblock"
agent-browser open "https://docs.rs/{crate}/latest/{crate}/{module}/" agent-browser get text ".docblock"

Save to ~/.claude/skills/{crate}/references/{module}.md

保存到~/.claude/skills/{crate}/references/{module}.md

agent-browser close

**WebFetch fallback:**
WebFetch("https://docs.rs/{crate}/latest/{crate}/", "Extract API documentation overview, key types, and usage examples")
undefined
agent-browser close

**WebFetch备选方案:**
WebFetch("https://docs.rs/{crate}/latest/{crate}/", "提取API文档概述、关键类型和使用示例")
undefined

Step 4: Workspace Support

步骤4:工作区支持

For Cargo workspace projects:
bash
undefined
针对Cargo工作区项目:
bash
undefined

1. Parse root Cargo.toml for workspace members

1. 解析根目录Cargo.toml获取工作区成员

cat Cargo.toml | grep -A 10 '[workspace]'
cat Cargo.toml | grep -A 10 '[workspace]'

2. For each member, parse their Cargo.toml

2. 针对每个成员,解析其Cargo.toml

for member in members; do cat ${member}/Cargo.toml | grep -A 100 '[dependencies]' done
for member in members; do cat ${member}/Cargo.toml | grep -A 100 '[dependencies]' done

3. Aggregate and deduplicate dependencies

3. 聚合并去重依赖项

4. Generate skills for missing crates

4. 为缺失的crate生成技能

undefined
undefined

Clean Command (Inline)

清理命令(内联模式)

bash
undefined
bash
undefined

Clean specific crate

清理特定crate

rm -rf ~/.claude/skills/{crate_name}
rm -rf ~/.claude/skills/{crate_name}

Clean all generated skills

清理所有生成的技能

rm -rf ~/.claude/skills/*
undefined
rm -rf ~/.claude/skills/*
undefined

Update Command (Inline)

更新命令(内联模式)

bash
undefined
bash
undefined

Remove old skill

删除旧技能

rm -rf ~/.claude/skills/{crate_name}
rm -rf ~/.claude/skills/{crate_name}

Re-generate (same as sync for single crate)

重新生成(与单个crate的同步操作相同)

Follow Step 3 above for the specific crate

按照上述步骤3针对特定crate执行


---

---

Local Skills Directory

本地技能目录

~/.claude/skills/
├── tokio/
│   ├── SKILL.md
│   └── references/
├── serde/
│   ├── SKILL.md
│   └── references/
└── axum/
    ├── SKILL.md
    └── references/

~/.claude/skills/
├── tokio/
│   ├── SKILL.md
│   └── references/
├── serde/
│   ├── SKILL.md
│   └── references/
└── axum/
    ├── SKILL.md
    └── references/

Related Commands

相关命令

  • /sync-crate-skills
    - Main sync command
  • /clean-crate-skills
    - Cleanup command
  • /update-crate-skill
    - Update command
  • /create-llms-for-skills
    - Generate llms.txt (Agent Mode only)
  • /create-skills-via-llms
    - Create skills from llms.txt (Agent Mode only)
  • /sync-crate-skills
    - 主同步命令
  • /clean-crate-skills
    - 清理命令
  • /update-crate-skill
    - 更新命令
  • /create-llms-for-skills
    - 生成llms.txt(仅Agent模式)
  • /create-skills-via-llms
    - 基于llms.txt创建技能(仅Agent模式)

Error Handling

错误处理

ErrorCauseSolution
Commands not foundSkills-only installUse inline mode
Cargo.toml not foundNot in Rust projectNavigate to project root
docs.rs unavailableNetwork issueRetry or skip crate
Permission deniedDirectory issueCheck ~/.claude/skills/ permissions
错误原因解决方案
命令未找到仅安装了技能使用内联模式
未找到Cargo.toml不在Rust项目目录导航到项目根目录
docs.rs不可用网络问题重试或跳过该crate
权限被拒绝目录问题检查~/.claude/skills/的权限