rust-coding-skill
Guides Claude in writing idiomatic, efficient, well-structured Rust code using proper data modeling, traits, impl organization, macros, and build-speed best practices.
Install
mkdir -p .claude/skills/rust-coding-skill && curl -L -o skill.zip "https://mcp.directory/api/skills/download/313" && unzip -o skill.zip -d .claude/skills/rust-coding-skill && rm skill.zipInstalls to .claude/skills/rust-coding-skill
About this skill
Rust Coding Skill
Instructions
-
Fully understand the user request:
Determine whether the task involves designing data structures, implementing traits, writing macros, modeling domain logic, or organizing modules.
Identify key constraints such as mutability needs, ownership flow, async context, interior mutability, or concurrency boundaries. -
Plan data structures with precision:
- Choose between
struct,enum, ornewtypebased on domain needs. - Consider ownership of each field:
- Use
&strvsString, slices vs vectors,Arc<T>when sharing, orCow<'a, T>for flexible ownership.
- Use
- Model invariants explicitly using types (e.g.,
NonZeroU32,Duration, custom enums). - Prefer
enumfor state machines instead of boolean flags or loosely related fields.
- Choose between
-
Write idiomatic Rust implementations:
- Place
implblocks immediately below the struct/enum they modify. - Group related methods together: constructors, getters, mutation methods, domain logic, helpers.
- Provide clear constructors (
new,with_capacity, builders) where appropriate. - Use trait implementations (
Display,Debug,From,Into,TryFrom) to simplify conversions. - Prefer returning
Result<T, E>instead of panicking. - Keep functions short to help lifetime inference and clarity.
- Place
-
Apply rigorous documentation and code-style best practices:
- Use
///doc comments for structs, enums, fields, and methods. - Use
//!for module-level documentation when explaining design or architecture. - Include examples in docs where valuable.
- Run
cargo fmtandcargo clippy --all-targets --all-featuresto maintain consistency. - Reserve blank lines between logically separate methods and sections.
- Use
-
Use macros effectively but responsibly:
- Apply
derivemacros (Debug,Clone,Serialize,Deserialize, etc.) to reduce boilerplate. - Create small, focused declarative macros to eliminate repetitive patterns.
- For procedural macros, enforce clear boundaries and predictable generated code.
- Apply
-
Optimize build speed when relevant:
- On Linux, configure
.cargo/config.tomlto use themoldlinker when appropriate. - Use
sccacheto cache compiled artifacts during development. - Minimize unnecessary dependencies and feature flags.
- Prefer
cargo checkduring rapid iteration overcargo build. - Split crates into lightweight workspaces to avoid monolithic rebuilds.
- Use
cargo profilesettings for tuned dev/release defaults.
- On Linux, configure
-
Encourage maintainable module and project structure:
- Organize code into modules reflecting ownership and domain boundaries.
- Use
pub(crate)instead ofpubwhen possible; expose only what needs exposing. - Keep APIs small and expressive; avoid leaking internal types.
- Use meaningful file and module names aligned with functionality.
-
Provide explanations and alternatives:
For every code design, explain why a certain pattern is chosen and propose alternatives when relevant, such as:- builder pattern vs simple constructor
- enum-based state machine vs multiple booleans
- shared ownership via
Arc<T>vs message passing channels - slice-based APIs for performance vs owned collections for convenience
- deriving traits vs manual implementations for custom logic
-
Maintain clarity, safety, and idiomatic style at all times:
Prioritize predictable ownership flow, correct lifetimes, and ergonomic APIs that reflect common Rust patterns.
You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.