rust-code-style
Write idiomatic, well-structured Rust for Wassette — single-responsibility design, anyhow error handling, Arc/Mutex for shared state, and the required formatting and linting with cargo +nightly fmt, cargo clippy, and cargo machete. Use when adding or refactoring Rust code in this repository.
- License 许可
- MIT
- 最近更新
- 2026-11-03
- Stars
- ★ 977
- Forks
- 78
01 前言 Front Matter
- name
- rust-code-style
- description
- Write idiomatic, well-structured Rust for Wassette — single-responsibility design, anyhow error handling, Arc/Mutex for shared state, and the required formatting and linting with cargo +nightly fmt, cargo clippy, and cargo machete. Use when adding or refactoring Rust code in this repository.
- allowed-tools
- Bash, Read, Write, Edit, Glob, Grep
03 SKILL.md 正文
rust-code-style skill
Apply Wassette's Rust conventions when writing or refactoring .rs files.
Best practices
- Single responsibility: each function and struct has one clear purpose.
- DRY: extract shared logic into reusable functions or modules.
- Descriptive naming: name functions, variables, and types for readability.
- Unit tests: cover every public function and its edge cases.
- Keep it simple: prefer straightforward solutions over clever complexity.
- Dependencies: manage them carefully in
Cargo.toml; avoid unnecessary ones that bloat the project. - Error handling: use
anyhowto add context and stack traces. - Traits and generics: use traits for shared behavior and generics for reusable, type-safe, extensible APIs.
- Thread safety: use stdlib primitives like
ArcandMutexfor shared state. - Performance: choose appropriate data types, e.g.
&stroverStringwhen possible.
Formatting and linting
Always run before committing:
cargo +nightly fmt # Format (nightly toolchain required)
cargo clippy --workspace # Lint; resolve every warning
cargo machete # Check for unused dependencies
Write code that passes cargo clippy without warnings.
Copyright headers
Every .rs file must start with the Microsoft copyright header. See the
copyright-headers skill for the exact format and the automated script.
04 同仓库更多 Skills
pull-request
Write concise, focused pull request descriptions for Wassette — at most three sentences on the what and why, with an explicit note on any breaking public-API change and how users adapt. Use when opening or editing a Wassette pull request.
mcp-inspector-testing
Validate Wassette changes end-to-end by running the MCP server with just and driving it with the MCP Inspector CLI over Streamable HTTP — listing tools, resources, and prompts, and calling tools. Use before committing server changes or when debugging tool exposure and behavior.
documentation
Build, serve, and write Wassette's mdBook documentation under docs/ — concise, code-first prose, the multi-version URL layout, and navigation in SUMMARY.md. Use when editing docs/ pages or previewing the documentation site.
copyright-headers
Ensure every Rust (.rs) file in Wassette starts with the required Microsoft copyright header, using the idempotent scripts/copyright.sh helper. Use when adding new Rust files or when a copyright-header check fails.
build-and-test
Build the Wassette workspace and run its test suite with the just recipes — debug and release builds, example and test components, and the combined unit plus documentation tests. Use when compiling Wassette, building example components, or running and debugging tests.