rust-router by zhanghandong/rust-skills
npx skills add https://github.com/zhanghandong/rust-skills --skill rust-router版本: 2.0.0 | 最后更新: 2025-01-22
v2.0: 上下文优化 - 详细示例已移至子文件
不要直接回答。首先追溯认知层级。
Layer 3: 领域约束 (WHY)
├── 业务规则,法规要求
├── domain-fintech, domain-web, domain-cli, 等
└── "为什么这样设计?"
Layer 2: 设计选择 (WHAT)
├── 架构模式,DDD 概念
├── m09-m15 技能
└── "我应该使用什么模式?"
Layer 1: 语言机制 (HOW)
├── 所有权,借用,生命周期,trait
├── m01-m07 技能
└── "如何在 Rust 中实现这个?"
| 用户信号 | 入口层级 | 方向 | 首选技能 |
|---|---|---|---|
| E0xxx 错误 | 层级 1 | 向上追溯 ↑ | m01-m07 |
| 编译错误 | 层级 1 | 向上追溯 ↑ |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| 下方错误表 |
| "如何设计..." | 层级 2 | 检查 L3,然后向下 ↓ | m09-domain |
| "构建 [领域] 应用" | 层级 3 | 向下追溯 ↓ | domain-* |
| "最佳实践..." | 层级 2 | 双向 | m09-m15 |
| 性能问题 | 层级 1 → 2 | 先上后下 | m10-performance |
当存在领域关键词时,你必须加载两个技能:
| 领域关键词 | L1 技能 | L3 技能 |
|---|---|---|
| Web API, HTTP, axum, handler | m07-concurrency | domain-web |
| 交易, 支付, trading, payment | m01-ownership | domain-fintech |
| CLI, terminal, clap | m07-concurrency | domain-cli |
| kubernetes, grpc, microservice | m07-concurrency | domain-cloud-native |
| embedded, no_std, MCU | m02-resource | domain-embedded |
在回答之前,检查是否需要协商:
| 查询包含 | 操作 |
|---|---|
| "比较", "对比", "compare", "vs", "versus" | 必须使用协商 |
| "最佳实践", "best practice" | 必须使用协商 |
| 领域 + 错误 (例如:"交易系统 E0382") | 必须使用协商 |
| 模糊范围 (例如:"tokio 性能") | 应该使用协商 |
当需要协商时,包含:
## 协商分析
**查询类型:** [比较性 | 跨领域 | 综合性 | 模糊性]
**协商:** 已启用
### 来源: [代理/技能名称]
**置信度:** 高 | 中 | 低 | 不确定
**差距:** [缺失的内容]
## 综合答案
[答案]
**总体置信度:** [级别]
**已披露的差距:** [用户应知的差距]
详细协议见:
patterns/negotiation.md
当创建新的 Rust 项目或 Cargo.toml 文件时,总是使用:
[package]
edition = "2024" # 总是使用最新的稳定版次
rust-version = "1.85"
[lints.rust]
unsafe_code = "warn"
[lints.clippy]
all = "warn"
pedantic = "warn"
| 模式 | 路由至 |
|---|---|
| move, borrow, lifetime, E0382, E0597 | m01-ownership |
| Box, Rc, Arc, RefCell, Cell | m02-resource |
| mut, interior mutability, E0499, E0502, E0596 | m03-mutability |
| generic, trait, inline, monomorphization | m04-zero-cost |
| type state, phantom, newtype | m05-type-driven |
| Result, Error, panic, ?, anyhow, thiserror | m06-error-handling |
| Send, Sync, thread, async, channel | m07-concurrency |
| unsafe, FFI, extern, raw pointer, transmute | unsafe-checker |
| 模式 | 路由至 |
|---|---|
| domain model, business logic | m09-domain |
| performance, optimization, benchmark | m10-performance |
| integration, interop, bindings | m11-ecosystem |
| resource lifecycle, RAII, Drop | m12-lifecycle |
| domain error, recovery strategy | m13-domain-error |
| mental model, how to think | m14-mental-model |
| anti-pattern, common mistake, pitfall | m15-anti-pattern |
| 领域关键词 | 路由至 |
|---|---|
| fintech, trading, decimal, currency | domain-fintech |
| ml, tensor, model, inference | domain-ml |
| kubernetes, docker, grpc, microservice | domain-cloud-native |
| embedded, sensor, mqtt, iot | domain-iot |
| web server, HTTP, REST, axum, actix | domain-web |
| CLI, command line, clap, terminal | domain-cli |
| no_std, microcontroller, firmware | domain-embedded |
| 错误代码 | 路由至 | 常见原因 |
|---|---|---|
| E0382 | m01-ownership | 使用了已移动的值 |
| E0597 | m01-ownership | 生命周期太短 |
| E0506 | m01-ownership | 无法分配给借用值 |
| E0507 | m01-ownership | 无法从借用值中移出 |
| E0515 | m01-ownership | 返回局部引用 |
| E0716 | m01-ownership | 临时值被丢弃 |
| E0106 | m01-ownership | 缺少生命周期说明符 |
| E0596 | m03-mutability | 无法可变借用 |
| E0499 | m03-mutability | 多次可变借用 |
| E0502 | m03-mutability | 借用冲突 |
| E0277 | m04/m07 | trait 约束不满足 |
| E0308 | m04-zero-cost | 类型不匹配 |
| E0599 | m04-zero-cost | 未找到方法 |
| E0038 | m04-zero-cost | trait 非对象安全 |
| E0433 | m11-ecosystem | 找不到 crate/模块 |
| 模式 | 路由至 | 操作 |
|---|---|---|
| latest version, what's new | rust-learner | 使用代理 |
| API, docs, documentation | docs-researcher | 使用代理 |
| code style, naming, clippy | coding-guidelines | 阅读技能 |
| unsafe code, FFI | unsafe-checker | 阅读技能 |
| code review | os-checker | 参见 integrations/os-checker.md |
| 关键词 | 解决方案 |
|---|---|
unsafe | unsafe-checker (比 m11 更具体) |
error | m06 用于通用错误,m13 用于领域特定错误 |
RAII | m12 用于设计,m01 用于实现 |
crate | rust-learner 用于版本,m11 用于集成 |
tokio | tokio- * 用于 API,m07 用于概念 |
优先级层次结构:
1. 错误代码 (E0xxx) → 直接查找,最高优先级
2. 协商触发词 (compare, vs, best practice) → 启用协商
3. 领域关键词 + 错误 → 加载领域和错误两个技能
4. 特定 crate 关键词 → 如果存在,路由到 crate 特定技能
5. 通用概念关键词 → 路由到元问题技能
| 文件 | 内容 |
|---|---|
patterns/negotiation.md | 协商协议详情 |
examples/workflow.md | 工作流示例 |
integrations/os-checker.md | OS-Checker 集成 |
每周安装量
608
仓库
GitHub 星标数
912
首次出现
Jan 20, 2026
安全审计
安装于
opencode557
codex545
gemini-cli533
github-copilot519
amp475
kimi-cli471
Version: 2.0.0 | Last Updated: 2025-01-22
v2.0: Context optimized - detailed examples moved to sub-files
Don't answer directly. Trace through the cognitive layers first.
Layer 3: Domain Constraints (WHY)
├── Business rules, regulatory requirements
├── domain-fintech, domain-web, domain-cli, etc.
└── "Why is it designed this way?"
Layer 2: Design Choices (WHAT)
├── Architecture patterns, DDD concepts
├── m09-m15 skills
└── "What pattern should I use?"
Layer 1: Language Mechanics (HOW)
├── Ownership, borrowing, lifetimes, traits
├── m01-m07 skills
└── "How do I implement this in Rust?"
| User Signal | Entry Layer | Direction | First Skill |
|---|---|---|---|
| E0xxx error | Layer 1 | Trace UP ↑ | m01-m07 |
| Compile error | Layer 1 | Trace UP ↑ | Error table below |
| "How to design..." | Layer 2 | Check L3, then DOWN ↓ | m09-domain |
| "Building [domain] app" | Layer 3 | Trace DOWN ↓ | domain-* |
| "Best practice..." | Layer 2 | Both directions | m09-m15 |
| Performance issue | Layer 1 → 2 | UP then DOWN | m10-performance |
When domain keywords are present, you MUST load BOTH skills:
| Domain Keywords | L1 Skill | L3 Skill |
|---|---|---|
| Web API, HTTP, axum, handler | m07-concurrency | domain-web |
| 交易, 支付, trading, payment | m01-ownership | domain-fintech |
| CLI, terminal, clap | m07-concurrency | domain-cli |
| kubernetes, grpc, microservice | m07-concurrency | domain-cloud-native |
| embedded, no_std, MCU | m02-resource | domain-embedded |
BEFORE answering, check if negotiation is required:
| Query Contains | Action |
|---|---|
| "比较", "对比", "compare", "vs", "versus" | MUST use negotiation |
| "最佳实践", "best practice" | MUST use negotiation |
| Domain + error (e.g., "交易系统 E0382") | MUST use negotiation |
| Ambiguous scope (e.g., "tokio 性能") | SHOULD use negotiation |
When negotiation is required, include:
## Negotiation Analysis
**Query Type:** [Comparative | Cross-domain | Synthesis | Ambiguous]
**Negotiation:** Enabled
### Source: [Agent/Skill Name]
**Confidence:** HIGH | MEDIUM | LOW | UNCERTAIN
**Gaps:** [What's missing]
## Synthesized Answer
[Answer]
**Overall Confidence:** [Level]
**Disclosed Gaps:** [Gaps user should know]
详细协议见:
patterns/negotiation.md
When creating new Rust projects or Cargo.toml files, ALWAYS use:
[package]
edition = "2024" # ALWAYS use latest stable edition
rust-version = "1.85"
[lints.rust]
unsafe_code = "warn"
[lints.clippy]
all = "warn"
pedantic = "warn"
| Pattern | Route To |
|---|---|
| move, borrow, lifetime, E0382, E0597 | m01-ownership |
| Box, Rc, Arc, RefCell, Cell | m02-resource |
| mut, interior mutability, E0499, E0502, E0596 | m03-mutability |
| generic, trait, inline, monomorphization | m04-zero-cost |
| type state, phantom, newtype | m05-type-driven |
| Result, Error, panic, ?, anyhow, thiserror | m06-error-handling |
| Send, Sync, thread, async, channel | m07-concurrency |
| unsafe, FFI, extern, raw pointer, transmute | unsafe-checker |
| Pattern | Route To |
|---|---|
| domain model, business logic | m09-domain |
| performance, optimization, benchmark | m10-performance |
| integration, interop, bindings | m11-ecosystem |
| resource lifecycle, RAII, Drop | m12-lifecycle |
| domain error, recovery strategy | m13-domain-error |
| mental model, how to think | m14-mental-model |
| anti-pattern, common mistake, pitfall | m15-anti-pattern |
| Domain Keywords | Route To |
|---|---|
| fintech, trading, decimal, currency | domain-fintech |
| ml, tensor, model, inference | domain-ml |
| kubernetes, docker, grpc, microservice | domain-cloud-native |
| embedded, sensor, mqtt, iot | domain-iot |
| web server, HTTP, REST, axum, actix | domain-web |
| CLI, command line, clap, terminal | domain-cli |
| no_std, microcontroller, firmware | domain-embedded |
| Error Code | Route To | Common Cause |
|---|---|---|
| E0382 | m01-ownership | Use of moved value |
| E0597 | m01-ownership | Lifetime too short |
| E0506 | m01-ownership | Cannot assign to borrowed |
| E0507 | m01-ownership | Cannot move out of borrowed |
| E0515 | m01-ownership | Return local reference |
| E0716 | m01-ownership | Temporary value dropped |
| E0106 | m01-ownership | Missing lifetime specifier |
| E0596 | m03-mutability | Cannot borrow as mutable |
| E0499 | m03-mutability | Multiple mutable borrows |
| E0502 |
| Pattern | Route To | Action |
|---|---|---|
| latest version, what's new | rust-learner | Use agents |
| API, docs, documentation | docs-researcher | Use agent |
| code style, naming, clippy | coding-guidelines | Read skill |
| unsafe code, FFI | unsafe-checker | Read skill |
| code review | os-checker | See integrations/os-checker.md |
| Keyword | Resolution |
|---|---|
unsafe | unsafe-checker (more specific than m11) |
error | m06 for general, m13 for domain-specific |
RAII | m12 for design, m01 for implementation |
crate | rust-learner for version, m11 for integration |
tokio | tokio- * for API, for concepts |
Priority Hierarchy:
1. Error codes (E0xxx) → Direct lookup, highest priority
2. Negotiation triggers (compare, vs, best practice) → Enable negotiation
3. Domain keywords + error → Load BOTH domain + error skills
4. Specific crate keywords → Route to crate-specific skill if exists
5. General concept keywords → Route to meta-question skill
| File | Content |
|---|---|
patterns/negotiation.md | Negotiation protocol details |
examples/workflow.md | Workflow examples |
integrations/os-checker.md | OS-Checker integration |
Weekly Installs
608
Repository
GitHub Stars
912
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubFailSocketPassSnykPass
Installed on
opencode557
codex545
gemini-cli533
github-copilot519
amp475
kimi-cli471
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
| m03-mutability |
| Borrow conflict |
| E0277 | m04/m07 | Trait bound not satisfied |
| E0308 | m04-zero-cost | Type mismatch |
| E0599 | m04-zero-cost | No method found |
| E0038 | m04-zero-cost | Trait not object-safe |
| E0433 | m11-ecosystem | Cannot find crate/module |