m11-ecosystem by zhanghandong/rust-skills
npx skills add https://github.com/zhanghandong/rust-skills --skill m11-ecosystem包含 Shell 命令
此技能包含可能执行系统命令的 shell 命令指令(!命令``)。安装前请仔细审查。
!grep -A 100 '^\[dependencies\]' Cargo.toml 2>/dev/null | head -30 || echo "No Cargo.toml found"
第 2 层:设计选择
应该选择哪个 crate 来完成这项工作,以及应该如何集成它?
在添加依赖项之前:
| 需求 | 选择 | Crates |
|---|---|---|
| 序列化 | 基于派生 | serde, serde_json |
| 异步运行时 | tokio 或 async-std |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
| tokio(最流行) |
| HTTP 客户端 | 符合人体工程学 | reqwest |
| HTTP 服务器 | 现代化 | axum, actix-web |
| 数据库 | SQL 或 ORM | sqlx, diesel |
| CLI 解析 | 基于派生 | clap |
| 错误处理 | 应用 vs 库 | anyhow, thiserror |
| 日志记录 | 门面模式 | tracing, log |
在添加依赖项之前:
它是否维护良好?
它的范围是什么?
它如何集成?
追溯至领域约束(第 3 层):
"我应该使用哪个 HTTP 框架?"
↑ 询问:性能要求是什么?
↑ 检查:domain-web(延迟、吞吐量需求)
↑ 检查:团队专业知识(对框架的熟悉程度)
| 问题 | 追溯至 | 询问 |
|---|---|---|
| 框架选择 | domain-* | 哪些约束重要? |
| 库 vs 构建 | domain-* | 部署模型是什么? |
| API 设计 | domain-* | 消费者是谁? |
追溯至实现(第 1 层):
"集成外部 crate"
↓ m04-zero-cost: Trait 约束和泛型
↓ m06-error-handling: 错误类型兼容性
"FFI 集成"
↓ unsafe-checker: 安全性要求
↓ m12-lifecycle: 资源清理
| 集成方式 | Crate/工具 | 使用场景 |
|---|---|---|
| C/C++ → Rust | bindgen | 自动生成绑定 |
| Rust → C | cbindgen | 导出 C 头文件 |
| Python ↔ Rust | pyo3 | Python 扩展 |
| Node.js ↔ Rust | napi-rs | Node 插件 |
| WebAssembly | wasm-bindgen | 浏览器/WASI |
| 功能 | 用途 |
|---|---|
[features] | 可选功能 |
default = [...] | 默认功能 |
feature = "serde" | 条件依赖 |
[workspace] | 多 crate 项目 |
| 错误 | 原因 | 修复方法 |
|---|---|---|
| E0433 | 找不到 crate | 添加到 Cargo.toml |
| E0603 | 私有项 | 检查 crate 文档 |
| 功能未启用 | 可选功能 | 在 features 中启用 |
| 版本冲突 | 不兼容的依赖项 | cargo update 或固定版本 |
| 重复类型 | 不同的 crate 版本 | 在工作区中统一 |
| 标准 | 良好迹象 | 警告迹象 |
|---|---|---|
| 维护 | 近期有提交 | 多年不活跃 |
| 社区 | 活跃的问题/PR | 无响应 |
| 文档 | 示例、API 文档 | 文档极少 |
| 稳定性 | 语义化版本控制 | 频繁的破坏性变更 |
| 依赖项 | 最少、知名 | 繁重、冷门 |
| 反模式 | 为何不好 | 更好的做法 |
|---|---|---|
extern crate | 已过时(2018+) | 直接 use |
#[macro_use] | 全局污染 | 显式导入 |
通配符依赖 * | 不可预测 | 指定具体版本 |
| 依赖过多 | 供应链风险 | 评估必要性 |
| 打包所有依赖 | 维护负担 | 信任 crates.io |
| 何时 | 参见 |
|---|---|
| 错误类型设计 | m06-error-handling |
| Trait 集成 | m04-zero-cost |
| FFI 安全性 | unsafe-checker |
| 资源管理 | m12-lifecycle |
每周安装量
590
代码仓库
GitHub 星标数
912
首次出现
2026年1月20日
安全审计
安装于
opencode541
codex525
gemini-cli514
github-copilot503
amp456
kimi-cli451
Contains Shell Commands
This skill contains shell command directives (!command``) that may execute system commands. Review carefully before installing.
!grep -A 100 '^\[dependencies\]' Cargo.toml 2>/dev/null | head -30 || echo "No Cargo.toml found"
Layer 2: Design Choices
What's the right crate for this job, and how should it integrate?
Before adding dependencies:
| Need | Choice | Crates |
|---|---|---|
| Serialization | Derive-based | serde, serde_json |
| Async runtime | tokio or async-std | tokio (most popular) |
| HTTP client | Ergonomic | reqwest |
| HTTP server | Modern | axum, actix-web |
| Database | SQL or ORM | sqlx, diesel |
| CLI parsing | Derive-based | clap |
| Error handling | App vs lib | anyhow, thiserror |
| Logging | Facade | tracing, log |
Before adding a dependency:
Is it well-maintained?
What's the scope?
How does it integrate?
To domain constraints (Layer 3):
"Which HTTP framework should I use?"
↑ Ask: What are the performance requirements?
↑ Check: domain-web (latency, throughput needs)
↑ Check: Team expertise (familiarity with framework)
| Question | Trace To | Ask |
|---|---|---|
| Framework choice | domain-* | What constraints matter? |
| Library vs build | domain-* | What's the deployment model? |
| API design | domain-* | Who are the consumers? |
To implementation (Layer 1):
"Integrate external crate"
↓ m04-zero-cost: Trait bounds and generics
↓ m06-error-handling: Error type compatibility
"FFI integration"
↓ unsafe-checker: Safety requirements
↓ m12-lifecycle: Resource cleanup
| Integration | Crate/Tool | Use Case |
|---|---|---|
| C/C++ → Rust | bindgen | Auto-generate bindings |
| Rust → C | cbindgen | Export C headers |
| Python ↔ Rust | pyo3 | Python extensions |
| Node.js ↔ Rust | napi-rs | Node addons |
| WebAssembly | wasm-bindgen | Browser/WASI |
| Feature | Purpose |
|---|---|
[features] | Optional functionality |
default = [...] | Default features |
feature = "serde" | Conditional deps |
[workspace] | Multi-crate projects |
| Error | Cause | Fix |
|---|---|---|
| E0433 | Can't find crate | Add to Cargo.toml |
| E0603 | Private item | Check crate docs |
| Feature not enabled | Optional feature | Enable in features |
| Version conflict | Incompatible deps | cargo update or pin |
| Duplicate types | Different crate versions | Unify in workspace |
| Criterion | Good Sign | Warning Sign |
|---|---|---|
| Maintenance | Recent commits | Years inactive |
| Community | Active issues/PRs | No response |
| Documentation | Examples, API docs | Minimal docs |
| Stability | Semantic versioning | Frequent breaking |
| Dependencies | Minimal, well-known | Heavy, obscure |
| Anti-Pattern | Why Bad | Better |
|---|---|---|
extern crate | Outdated (2018+) | Just use |
#[macro_use] | Global pollution | Explicit import |
Wildcard deps * | Unpredictable | Specific versions |
| Too many deps | Supply chain risk | Evaluate necessity |
| Vendoring everything | Maintenance burden | Trust crates.io |
| When | See |
|---|---|
| Error type design | m06-error-handling |
| Trait integration | m04-zero-cost |
| FFI safety | unsafe-checker |
| Resource management | m12-lifecycle |
Weekly Installs
590
Repository
GitHub Stars
912
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode541
codex525
gemini-cli514
github-copilot503
amp456
kimi-cli451
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
103,800 周安装
OpenAPI 转 TypeScript 工具 - 自动生成 API 接口与类型守卫
563 周安装
数据库模式设计器 - 内置最佳实践,自动生成生产级SQL/NoSQL数据库架构
564 周安装
Rust Unsafe代码检查器 - 安全使用Unsafe Rust的完整指南与最佳实践
564 周安装
.NET并发编程模式指南:async/await、Channels、Akka.NET选择决策树
565 周安装
韩语语法检查器 - 基于国立国语院标准的拼写、空格、语法、标点错误检测与纠正
565 周安装
技能安全扫描器 - 检测Claude技能安全漏洞,防范提示注入与恶意代码
565 周安装