Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →

zhanghandong/rust-skills

38 skills30.6k installs50.7k starsGitHub

Install

npx skills add https://github.com/zhanghandong/rust-skills

Skills in this repo

1M15 Anti PatternUse when reviewing code for anti-patterns. Keywords: anti-pattern, common mistake, pitfall, code smell, bad practice, code review, is this an anti-pattern, better way to do this, common mistake to avoid, why is this bad, idiomatic way, beginner mistake, fighting borrow checker, clone everywhere, unwrap in production, should I refactor, 反模式, 常见错误, 代码异味, 最佳实践, 地道写法 --- name: m15-anti-pattern description: "Use when reviewing code for anti-patterns. Keywords: anti-pattern, common mistake, pitfall, code smell, bad practice, code review, is this an anti-pattern, better way to do this, common mistake to avoid, why is this bad, idiomatic way, beginner mistake, fighting borrow checker, clone everywhere, unwrap in production, should I refactor, 反模式, 常见错误, 代码异味, 最佳实践, 地道写法" user-invocable: false --- # Anti-Patterns > **Layer 2: Design Choices** ## Core Question **Is this pattern hiding a design problem?** When reviewing code: - Is this solving the symptom or the cause? - Is there a more idiomatic approach?5.7kinstalls2Coding Guidelinescoding-guidelines is a Rust-focused skill from zhanghandong/rust-skills that maps common Clippy lints to concrete fixes agents should apply while authoring code. The reference table covers error handling (unwrap_used), performance (needless_clone, linkedlist, large_stack_arrays), async pitfalls (await_holding_lock), style (wildcard_imports, too_many_arguments), and unsafe requirements (missing_safety_doc, undocumented_unsafe_blocks, transmute_ptr_to_ptr). Developers reach for it when they want generated Rust to match community norms instead of fighting Clippy in review. It pairs with the unsafe-checker skill for deeper unsafe audits.1.3kinstalls3M10 Performancem10-performance is a Rust performance optimization guide from zhanghandong/rust-skills that teaches a profiling-first workflow before rewriting code. The skill documents concrete commands for cargo flamegraph CPU traces, cargo-instruments on macOS, heaptrack on Linux, cargo bench with Criterion, and valgrind --tool=cachegrind for cache behavior. It includes Criterion benchmark scaffolding with criterion_group and criterion_main so developers can compare parse_v1 versus parse_v2 implementations on repeated inputs. Developers reach for m10-performance when a Rust binary or library is functionally correct but too slow, memory-heavy, or cache-unfriendly, and they need a repeatable measurement loop instead of guessing at optimizations.911installs4M07 Concurrencym07-concurrency is a Layer 1 language mechanics skill from zhanghandong/rust-skills marked CRITICAL for concurrency and async work in Rust. The skill triggers on compiler errors like E0277 Send and Sync violations, cannot be sent between threads messages, and keywords including spawn, mpsc, Mutex, RwLock, Atomic, tokio, Future, deadlock, and race condition. Before choosing primitives, m07-concurrency forces developers to answer whether work is CPU-bound or I/O-bound and what sharing model applies. Error tables map E0277 Send failures to design questions instead of blind trait bound fixes. Developers reach for m07-concurrency when Rust concurrency code fails to compile or deadlocks appear in threaded, channel-based, or tokio async codebases.858installs5M06 Error Handlingm06-error-handling is a zhanghandong/rust-skills module that separates library error design from application error handling in Rust. The skill prescribes five library principles: define specific error types instead of anyhow, implement std::error::Error, expose matchable variants, chain source errors, and keep types Send + Sync for async. Worked examples use thiserror-derived enums such as DatabaseError with ConnectionFailed and query variants. Developers reach for m06-error-handling when shipping Rust crates or services where opaque errors frustrate downstream callers or async runtimes.840installs6Rust Refactor Helperrust-refactor-helper is a Claude Code skill from zhanghandong/rust-skills that performs safe Rust refactoring with comprehensive LSP impact analysis before applying edits. Invoke it via `/rust-refactor-helper <action> <target> [--dry-run]` for actions including rename, extract-fn, inline, and move across modules. Allowed tools are LSP, Read, Glob, Grep, and Edit. Developers reach for it when renaming symbols like parse_config to load_config, extracting selections into functions, or moving items between modules without breaking references. The --dry-run flag previews impact before any file change.836installs7M01 Ownershipm01-ownership is a Rust learning skill that explains ownership rules through side-by-side comparisons with C++ and Go. It contrasts Rust move semantics, where `let b = a` invalidates `a`, with C++ `std::move` behavior and Go garbage collection, and shows when explicit `clone()` is required versus implicit copies. The skill uses compile-error examples, memory-management tables, and concurrent-code scenarios so developers coming from C++ or Go can reason about borrow checker errors instead of fighting them. Reach for it when ownership, lifetimes, or move/copy behavior block progress on Rust backend or CLI code.822installs8M04 Zero Costm04-zero-cost is a Rust language mechanics skill from zhanghandong/rust-skills focused on zero-cost abstractions and the core question of compile-time versus runtime polymorphism. Before picking generics or trait objects, the skill prompts whether the concrete type is known at compile time, whether a heterogeneous collection is required, and what performance priority applies. It maps common compiler errors—including E0277 trait bound not satisfied, E0308 type mismatches, and E0599 missing methods—to design questions instead of shallow error explanations. Triggers cover generics, traits, impl Trait, dyn, where clauses, monomorphization, static dispatch, and dynamic dispatch keywords in English and Chinese. Developers reach for m04-zero-cost when Rust fights back on trait bounds and they need a decision framework for static versus dynamic dispatch without abandoning zero-cost guarantees.803installs9M05 Type Drivenm05-type-driven is a Rust-focused Claude Code skill from zhanghandong/rust-skills that applies type-driven design to make invalid states unrepresentable at compile time. The skill walks through when to reach for newtypes, marker traits, builder patterns, zero-sized types, and sealed traits instead of runtime checks, with triggers covering type state, compile-time validation, and related Chinese keyword phrases. It sits in Layer 1: Language Mechanics and reframes common errors as design questions about what the type system can prove. Developers reach for m05-type-driven when refactoring primitives into domain types, hardening APIs against misuse, or encoding lifecycle states in Rust structs and traits.800installs10M02 Resourcem02-resource is a Rust language-mechanics skill from zhanghandong/rust-skills that helps developers choose the right ownership pattern before writing code that manages heap memory or shared state. It maps common compiler errors to design questions about single versus shared ownership, single-threaded versus multi-threaded access, and reference-cycle risk. The skill triggers on Box, Rc, Arc, Weak, RefCell, Cell, RAII, Drop, and common comparison questions such as Box versus Rc or Arc versus Rc. Developers reach for m02-resource when Rust borrow-checker errors or ownership ambiguity block progress on backend services, CLI tools, or concurrent Rust code.795installs11M03 Mutabilitym03-mutability is Layer 1 language mechanics guidance from zhanghandong/rust-skills for Rust mutability design. It triggers on compiler errors E0596, E0499, and E0502, plus phrases like cannot borrow as mutable, already borrowed as immutable, interior mutability, Cell, RefCell, Mutex, and RwLock. The skill reframes each error as a design question—who should mutate this data and is mutation essential—before recommending interior mutability patterns. Developers reach for m03-mutability when rustc blocks a build and adding mut or RefCell feels like a guess rather than an intentional ownership model.784installs12M12 Lifecyclem12-lifecycle is Layer 2 Design Choices in zhanghandong/rust-skills for Rust resource lifecycle decisions. The skill poses the core question—when should a resource be created, used, and cleaned up—and walks through scope, cleanup ownership, and error-path behavior before implementation. Coverage includes RAII and Drop, lazy initialization with OnceCell, Lazy, once_cell, and OnceLock, connection pool design, scope guards, transaction and session management, and cleanup-on-error patterns. Developers reach for m12-lifecycle when designing backend Rust services where incorrect lifecycle choices cause leaks, double-free risks, or pool exhaustion. The skill is user-invocable false, intended for agent-triggered design guidance via keywords like RAII, connection pool, and guard pattern.780installs13M14 Mental Modelm14-mental-model is Layer 2 of the zhanghandong rust-skills collection, focused on how to think about Rust concepts rather than syntax alone. The skill maps eight core models—ownership as a unique key, move as key handover, &T as read-only lending, &mut T as exclusive editing, lifetimes as valid scope tickets, Box as heap remote control, Rc as shared ownership, and Arc as thread-safe Rc—with stack-and-heap ASCII diagrams. It contrasts shifts from Java, C#, C++, Python, Go, and JavaScript, listing five common compiler errors (E0382, E0502, E0499, E0106, E0507) with wrong versus correct mental models. A thinking prompt asks who owns data, what guarantee Rust enforces, and what the compiler error means, with trace-up links to m01–m07 skills. Reach for m14-mental-model when developers coming from GC languages hit borrow-checker confusion before diving into implementation skills like m01-ownership.764installs14M09 Domainm09-domain is a Layer 2 design skill from zhanghandong/rust-skills that answers whether a concept is an Entity or Value Object, which invariants must hold, and where aggregate boundaries belong in Rust. It triggers on domain model, DDD, entity, value object, aggregate, repository pattern, business rules, validation, and invariant keywords in English and Chinese. The skill pairs domain concepts with Rust patterns and ownership implications in a reference table before implementation. Backend Rust developers use m09-domain when translating business rules into types, validation, and repository interfaces instead of jumping straight to structs and SQL.762installs15M11 Ecosystemm11-ecosystem is a Layer 2 design-choice skill in the zhanghandong/rust-skills collection for Rust ecosystem integration. It auto-injects the current `[dependencies]` block from Cargo.toml so the agent sees live project context before answering. The skill targets unresolved-import errors such as E0425, E0433, and E0603, feature-flag selection, workspace layout, and bindings for PyO3, WebAssembly, bindgen, cbindgen, and napi-rs. Developers reach for m11-ecosystem when Cargo.toml edits stall on which crate to pick, how to enable features, or how to bridge external C libraries and Python extensions. It is user-invocable false, so agents should load it when dependency or crate-selection keywords appear in Rust build threads.760installs16M13 Domain Errorm13-domain-error is Layer 2 design guidance in zhanghandong/rust-skills for Rust domain error handling. It asks who must handle each error and how recovery should work before defining error types, categorizing failures by audience and recoverability across user-facing, transient, and internal classes. A quick-reference table maps 5 recovery patterns—Retry with exponential backoff, Fallback defaults, Circuit Breaker via failsafe-rs, Timeout with tokio::time::timeout, and Bulkhead isolation—to concrete Rust implementations. The skill includes thiserror-based AppError hierarchies with is_retryable helpers and tokio_retry ExponentialBackoff examples. Developers reach for m13-domain-error when designing error codes, graceful degradation, or resilience patterns in production Rust APIs.752installs17Rust Trait Explorerrust-trait-explorer is a Rust code navigation skill from zhanghandong/rust-skills that uses LSP go-to-implementation alongside Read, Glob, and Grep to discover trait relationships in a codebase. Invoked via /rust-trait-explorer with a trait or struct name, the skill finds all implementors of a trait like Handler or lists every trait a struct satisfies. Developers reach for rust-trait-explorer when exploring generic bounds, debugging trait object hierarchies, or onboarding to an unfamiliar Rust service. The skill triggers on commands like find implementations, who implements, and bilingual queries for trait implementation discovery.750installs18Rust Code NavigatorRust Code Navigator is a Rust navigation skill from zhanghandong/rust-skills that leverages LSP, Read, and Glob tools to explore large Rust codebases efficiently. It triggers on /rust-code-navigator, go to definition, find references, and multilingual phrases including 跳转定义 and 查找引用. Usage follows /rust-code-navigator parse_config or /rust-code-navigator MyStruct in src/lib.rs:42 to navigate from a specific location. LSP operations include Go to Definition for locating symbol definitions and additional reference and type queries documented in the skill. Developers reach for Rust Code Navigator when AI agents struggle with manual file grepping in multi-crate Rust repos and need precise symbol-level navigation comparable to IDE LSP workflows.742installs19Unsafe Checkerunsafe-checker is an agent skill from zhanghandong/rust-skills that auto-audits Rust unsafe blocks using a 70-rule checklist generated from rules/. Rules span General Principles (3 rules), Safety Abstraction (11 rules), and additional sections covering panic memory safety, uninitialized memory exposure, and alias pitfalls. Each rule has an ID, level (P/G), and title such as general-01 Do Not Abuse Unsafe to Escape Compiler Safety Checks. Developers reach for it before merging FFI, performance-critical, or systems Rust that uses unsafe, ensuring authors verified safety invariants rather than bypassing the borrow checker blindly. The skill suits teams that want structured review output referencing concrete rule IDs instead of ad-hoc unsafe commentary.741installs20Domain Clidomain-cli is a Rust skills pack entry that activates on Cargo.toml globs and applies Layer 3 domain constraints when building command-line tools. The skill maps ergonomic rules—clear help text, layered configuration where CLI flags beat environment variables and config files, meaningful exit codes, and polished terminal output—to concrete Rust crates such as clap derive macros, ratatui or crossterm for TUIs, indicatif progress bars, and shell completion generators. Developers reach for domain-cli when scaffolding or refactoring a Rust CLI so subcommands, config loading, and error messaging stay consistent across a codebase. It is not a code generator; it steers design decisions and implementation patterns so new binaries match established CLI conventions without reinventing argument parsing or config precedence on every project.725installs21Rust Symbol Analyzerrust-symbol-analyzer is a Claude Code skill from zhanghandong/rust-skills that analyzes Rust project structure through LSP symbol queries. Invoked as `/rust-symbol-analyzer [file.rs] [--type struct|trait|fn|mod]`, it can scan an entire workspace, a single file such as `src/lib.rs`, or filter by symbol type including struct, trait, fn, and mod. Allowed tools are LSP, Read, and Glob. Triggers include `/symbols`, project structure, list structs, list traits, list functions, and related Chinese phrases for symbol analysis. Developers reach for rust-symbol-analyzer when onboarding to an unfamiliar crate graph or auditing public API surface before refactors. The skill returns structured symbol inventories, not edited source files or automated refactors.718installs22Rust Call Graphrust-call-graph is a rust-skills slash command that builds function call graphs using LSP call hierarchy instead of manual source tracing. Invoke `/rust-call-graph <function_name>` with optional `--depth N` (default 3) and `--direction in|out|both` to list callers, callees, or both. The skill triggers on phrases like call hierarchy, who calls, what calls, and related Chinese query terms. Developers reach for rust-call-graph when refactoring Rust services, auditing unsafe call paths, or onboarding to unfamiliar crates. Allowed tools are LSP, Read, and Glob, so results stay tied to the language server view of the workspace rather than static text search alone.713installs23Rust Routerrust-router is a Claude Code skill from zhanghandong/rust-skills marked highest priority for all Rust questions including errors, design comparisons, and coding tasks. The skill intercepts queries about cargo, rustc, ownership, borrow checker errors, lifetime issues, async Send/Sync, tokio versus async-std comparisons, and compile error codes E0382, E0597, E0277, E0308, E0499, E0502, and E0596 before routing them through intent analysis and structured reasoning. Developers reach for rust-router when generic LLM answers produce incorrect lifetime fixes, wrong async runtime advice, or shallow trait bound explanations. The skill performs semantic intent analysis in English and Chinese, then applies domain-specific Rust cognitive patterns rather than jumping to code patches. rust-router acts as a meta-routing layer ensuring borrow checker, concurrency, and API design questions receive framework-guided answers consistent with Rust best practices.710installs24Rust Deps Visualizerrust-deps-visualizer is a terminal-first Claude Code skill that turns a Rust crate's Cargo dependency graph into ASCII tree output directly from the agent session. Developers invoke `/rust-deps-visualizer` with optional `--depth N` (default depth 3) and `--features` to surface feature-flag branches alongside crate versions. The skill uses Bash, Read, and Glob to inspect the project and print hierarchical trees showing crates like tokio, serde, and nested transitive dependencies. Reach for rust-deps-visualizer when onboarding to an unfamiliar workspace, debugging version conflicts, or presenting dependency structure in code review without installing graphviz or web dashboards.702installs25Rust LearnerRust Learner is a Rust-focused agent skill (version 2.1.0) that queries official Rust and crate sources during development. It handles version queries for Rust stable, nightly, and edition 2021/2024 releases, plus crates.io and docs.rs lookups for crate features, dependencies, and API documentation. Allowed tools include Bash, Read, Glob, Task, and actionbook MCP integrations for live fetches. Developers reach for Rust Learner when choosing crate versions, running cargo add or cargo update decisions, or verifying what changed in a Rust 1.x release—avoiding stale training-data answers about fast-moving Rust ecosystems.698installs26Rust Skill Creatorrust-skill-creator version 2.1.0 creates dynamic agent skills for Rust third-party crates and standard library modules sourced from docs.rs documentation. Developers pass a crate name or std module path as an argument hint, and the skill forks a general-purpose agent to extract accurate API references for tokio, serde, axum, and other dependencies. The skill activates on requests to create Rust skills, crate skills, or std skills in English or Chinese keywords. Teams reach for rust-skill-creator when agents repeatedly invent incorrect method signatures and need a documentation-grounded skill artifact instead of manual prompt engineering.684installs27Domain Webdomain-web is a Layer 3 domain-constraints skill in the zhanghandong/rust-skills stack for Rust web services, triggered on `**/Cargo.toml` paths. It maps domain rules—stateless HTTP, concurrency, middleware ordering, authentication—to Rust-specific design choices using axum, actix, warp, rocket, tower, hyper, and reqwest patterns. Developers reach for domain-web when designing handlers, extractors, Arc-backed shared state, JWT/session auth, CORS, rate limiting, and tower tracing middleware. The skill keeps web APIs stateless, concurrent, and testable by pushing globals into extractors and structured middleware stacks.665installs28Meta Cognition Parallelmeta-cognition-parallel is version 0.2.0 experimental skill from zhanghandong/rust-skills that launches three parallel analyzers—language mechanics, design choices, and domain constraints—then synthesizes their output into one Rust recommendation. Triggered by /meta-parallel, 三层分析, parallel analysis, or 并行元认知, the skill replaces sequential reasoning with concurrent layer evaluation for complex Rust questions. Developers reach for meta-cognition-parallel when facing nuanced Rust architecture or API design tradeoffs that benefit from multi-perspective analysis before writing code.645installs29Rust Dailyrust-daily is version 2.1.0 skill from zhanghandong/rust-skills that fetches Rust community updates without leaving an agent workflow. It triggers on rust news, rust daily, rust weekly, TWIR, rust blog, and related Chinese-language Rust news queries. Data sources span Reddit r/rust, This Week in Rust, blog.rust-lang.org, Inside Rust, and rustfoundation.org news, blog, and events. Developers pass a time_range argument of day, week, or month, defaulting to week, and run under fork context with the Explore agent. rust-daily last updated 2025-01-27 and supports categorized filtering across ecosystem, official, and foundation channels. Reach for rust-daily when evaluating Rust adoption, tracking release discourse, or preparing standups that need curated community links instead of manually checking multiple Rust news sites.644installs30Domain Embeddeddomain-embedded is a Layer 3 domain-constraints skill in the rust-skills collection for no_std embedded Rust on microcontrollers and bare-metal boards. It auto-injects project context from Cargo.toml and .cargo/config.toml, then maps domain rules—interrupt safety, DMA timing, peripheral ownership, and RTIC or Embassy patterns—to concrete Rust design choices developers must follow. The skill covers embedded-hal, PAC/HAL layering, cortex-m, and common toolchains for ARM and RISC-V MCUs including ESP32, STM32, and nRF families. Developers reach for domain-embedded when firmware must compile without heap surprises, when ISR handlers risk data races, or when HAL borrow rules block GPIO, SPI, I2C, or UART bring-up. It is invoked on embedded/no_std tasks rather than general application Rust.639installs31Domain Cloud Nativedomain-cloud-native is Layer 3 domain constraints in the rust-skills stack for cloud-native Rust services. A constraint table links domain rules—12-Factor config from env, observability with metrics and traces, liveness/readiness health checks, graceful shutdown—to Rust design choices like environment-based config, tracing plus OpenTelemetry, dedicated health endpoints, and clean termination handling. Keywords span kubernetes, docker, grpc, tonic, microservice, service mesh, and observability. Developers reach for domain-cloud-native when scaffolding Rust microservices destined for k8s with production-grade telemetry and health probe endpoints.609installs32Domain Fintechdomain-fintech is a Layer 3 domain-constraints skill in zhanghandong/rust-skills for fintech backends covering trading, currency, transactions, ledgers, payments, and exchange-rate logic. The skill maps domain rules to Rust design: immutable audit trails via Arc<T> without mutation, rust_decimal instead of f64, clear ownership for transaction boundaries, and structured tracing for compliance logging. Developers reach for domain-fintech when implementing money-handling crates where rounding, reproducibility, and complete audit logs are non-negotiable. Keywords span 金融, 交易系统, 货币, and 支付 for multilingual retrieval alongside English fintech terms.594installs33Domain MlDomain ML is a Layer 3 domain-constraints skill from zhanghandong/rust-skills for building ML and AI applications in Rust. It activates on keywords including machine learning, tensor, model inference, neural networks, deep learning, ndarray, tch-rs, burn, and candle. The skill maps domain rules to Rust design implications: large data requires zero-copy and streaming, GPU acceleration maps to candle and tch-rs, model portability uses ONNX, and batch processing prioritizes throughput with batched inference. Developers reach for Domain ML when writing Rust inference or training code and need framework-specific memory, GPU, and portability patterns rather than Python-centric ML guidance.586installs34Domain Iotdomain-iot is a Layer 3 Domain Constraints skill from zhanghandong/rust-skills for building IoT applications in Rust. It maps domain rules—unreliable networks, power limits, small footprints, encrypted comms, and self-healing reliability—to concrete Rust design choices such as offline-first local buffering, sleep modes with minimal allocation, no_std where needed, TLS and signed firmware, and watchdog recovery. Keywords span MQTT, telemetry, actuators, smart home, gateways, and edge computing in English and Chinese. Developers invoke domain-iot when writing firmware or edge services where every allocation and wake cycle matters on constrained connected hardware.581installs35Core Dynamic Skillscore-dynamic-skills is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.57installs36Core Actionbookcore-actionbook is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.56installs37Core Agent Browsercore-agent-browser is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.55installs38Core Fix Skill Docscore-fix-skill-docs is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.55installs

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.