skills/m11-ecosystem/SKILL.md
Use when integrating crates or ecosystem questions. Keywords: E0425, E0433, E0603, crate, cargo, dependency, feature flag, workspace, which crate to use, using external C libraries, creating Python extensions, PyO3, wasm, WebAssembly, bindgen, cbindgen, napi-rs, cannot find, private, crate recommendation, best crate for, Cargo.toml, features, crate 推荐, 依赖管理, 特性标志, 工作空间, Python 绑定
npx skillsauth add actionbook/rust-skills m11-ecosystemInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
!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 |
development
CRITICAL: Use for ALL Rust questions including errors, design, and coding. HIGHEST PRIORITY for: 比较, 对比, compare, vs, versus, 区别, difference, 最佳实践, best practice, tokio vs, async-std vs, 比较 tokio, 比较 async, Triggers on: Rust, cargo, rustc, crate, Cargo.toml, 意图分析, 问题分析, 语义分析, analyze intent, question analysis, compile error, borrow error, lifetime error, ownership error, type error, trait error, value moved, cannot borrow, does not live long enough, mismatched types, not satisfied, E0382, E0597, E0277, E0308, E0499, E0502, E0596, async, await, Send, Sync, tokio, concurrency, error handling, 编译错误, compile error, 所有权, ownership, 借用, borrow, 生命周期, lifetime, 类型错误, type error, 异步, async, 并发, concurrency, 错误处理, error handling, 问题, problem, question, 怎么用, how to use, 如何, how to, 为什么, why, 什么是, what is, 帮我写, help me write, 实现, implement, 解释, explain
development
Internal maintenance support for checking and fixing generated Rust skill documentation references. Use only when explicitly invoked by /fix-skill-docs.
development
Internal command support for dynamic Rust crate skill management. Use only when explicitly invoked by /sync-crate-skills, /clean-crate-skills, or /update-crate-skill.
tools
Internal support skill for agent-browser CLI workflows used by rust-learner, docs-researcher, and crate-researcher. Use only when browser automation is explicitly required.