Rust programming patterns and ownership concepts
- version
- 1.0.0
- GitHub stars
- 26
Add marketplace
/plugin marketplace add miles990/claude-software-skillsRun it inside Claude Code once, then install the plugin below.
Install
/plugin install rust@claude-software-skillsRun it inside Claude Code after adding the marketplace.
Files
Discovered from sourceRust
Overview
Rust programming patterns including ownership, lifetimes, traits, and async programming.
Ownership and Borrowing
Basic Ownership
fn main() {
// Ownership transfer (move)
let s1 = String::from("hello");
let s2 = s1; // s1 is moved to s2
// println!("{}", s1); // Error: s1 is no longer valid
// Clone for deep copy
let s3 = String::from("hello");
let s4 = s3.clone();
println!("{} {}", s3, s4); // Both valid
// Copy types (stack-only data)
let x = 5;
let y = x; // Copy, not move
println!("{} {}", x, y); // Both valid
}
// Ownership and functions
fn takes_ownership(s: String) {
println!("{}", s);
} // s is dropped here
fn makes_copy(x: i32) {
println!("{}", x);
} // x goes out of scope, nothing special
fn gives_ownership() -> String {
String::from("hello")
}
fn takes_and_gives_back(s: String) -> String {
s
}
Borrowing
// Immutable borrow
fn calculate_length(s: &String) -> usize {
s.len()
} // s goes out of scope but doesn't drop the value
// Mutable borrow
fn append_world(s: &mut String) {
s.push_str(" world");
}
fn main() {
let s = String::from("hello");
// Multiple immutable borrows OK
let r1 = &s;
let r2 = &s;
println!("{} {}", r1, r2);
// Mutable borrow (only one at a time)
let mut s2 = String::from("hello");
let r3 = &mut s2;
r3.push_str(" world");
println!("{}", r3);
// Cannot have mutable and immutable at same time
let mut s3 = String::from("hello");
let r4 = &s3;
// let r5 = &mut s3; // Error!
println!("{}", r4);
}
Lifetimes
// Explicit lifetime annotations
fn longest<'a>(x: &'a str, y: &'a str) -> &'a str {
if x.len() > y.len() { x } else { y }
}
// Struct with lifetime
struct Excerpt<'a> {
part: &'a str,
}
impl<'a> Excerpt<'a> {
fn level(&self) -> i32 {
3
}
fn announce_and_return(&self, announcement: &str) -> &str {
println!("Attention: {}", announcement);
self.part
}
}
// Multiple lifetimes
fn complex<'a, 'b>(x: &'a str, y: &'b str) -> &'a str
where
'b: 'a, // 'b outlives 'a
{
x
}
// Static lifetime
fn static_string() -> &'static str {
"I live forever"
}
Structs and Enums
Structs
#[derive(Debug, Clone, PartialEq)]
struct User {
id: u64,
email: String,
name: String,
active: bool,
}
impl User {
// Associated function (constructor)
fn new(email: String, name: String) -> Self {
Self {
id: generate_id(),
email,
name,
active: true,
}
}
// Method
fn deactivate(&mut self) {
self.active = false;
}
// Method returning reference
fn email(&self) -> &str {
&self.email
}
}
// Tuple struct
struct Color(u8, u8, u8);
struct Point(f64, f64, f64);
// Unit struct
struct AlwaysEqual;
Enums
// Basic enum
enum Direction {
North,
South,
East,
West,
}
// Enum with data
enum Message {
Quit,
Move { x: i32, y: i32 },
Write(String),
ChangeColor(u8, u8, u8),
}
impl Message {
fn process(&self) {
match self {
Message::Quit => println!("Quit"),
Message::Move { x, y } => println!("Move to ({}, {})", x, y),
Message::Write(text) => println!("Write: {}", text),
Message::ChangeColor(r, g, b) => println!("Color: ({}, {}, {})", r, g, b),
}
}
}
// Result and Option
fn divide(a: f64, b: f64) -> Result<f64, String> {
if b == 0.0 {
Err(String::from("Division by zero"))
} else {
Ok(a / b)
}
}
fn find_user(id: u64) -> Option<User> {
// ...
None
}
Traits
// Trait definition
trait Summary {
fn summarize(&self) -> String;
// Default implementation
fn summarize_author(&self) -> String {
String::from("(unknown author)")
}
}
// Implement trait
impl Summary for User {
fn summarize(&self) -> String {
format!("{} ({})", self.name, self.email)
}
}
// Trait bounds
fn notify<T: Summary>(item: &T) {
println!("Breaking news: {}", item.summarize());
}
// Multiple trait bounds
fn notify_multiple<T: Summary + Clone>(item: &T) {
let cloned = item.clone();
println!("{}", cloned.summarize());
}
// where clause
fn some_function<T, U>(t: &T, u: &U) -> i32
where
T: Summary + Clone,
U: Clone + std::fmt::Debug,
{
// ...
0
}
// Return trait
fn create_summarizable() -> impl Summary {
User::new(
String::from("test@example.com"),
String::from("Test"),
)
}
// Trait objects (dynamic dispatch)
fn process_summaries(items: &[&dyn Summary]) {
for item in items {
println!("{}", item.summarize());
}
}
Error Handling
use std::fs::File;
use std::io::{self, Read};
use thiserror::Error;
// Custom error with thiserror
#[derive(Error, Debug)]
pub enum AppError {
#[error("IO error: {0}")]
Io(#[from] io::Error),
#[error("Parse error: {0}")]
Parse(#[from] std::num::ParseIntError),
#[error("Not found: {0}")]
NotFound(String),
#[error("Validation error: {field} - {message}")]
Validation { field: String, message: String },
}
// Using Result
fn read_file(path: &str) -> Result<String, AppError> {
let mut file = File::open(path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
Ok(contents)
}
// ? operator chains
fn read_username_from_file() -> Result<String, io::Error> {
let mut username = String::new();
File::open("username.txt")?.read_to_string(&mut username)?;
Ok(username)
}
// Option handling
fn find_and_process(id: u64) -> Option<String> {
let user = find_user(id)?;
let data = process_user(&user)?;
Some(data)
}
// Combinators
fn get_user_email(id: u64) -> Option<String> {
find_user(id)
.map(|user| user.email)
.filter(|email| !email.is_empty())
}
fn parse_and_double(s: &str) -> Result<i32, std::num::ParseIntError> {
s.parse::<i32>().map(|n| n * 2)
}
Async Programming
use tokio;
use futures::future;
// Async function
async fn fetch_data(url: &str) -> Result<String, reqwest::Error> {
let response = reqwest::get(url).await?;
let body = response.text().await?;
Ok(body)
}
// Concurrent execution
async fn fetch_all(urls: Vec<&str>) -> Vec<Result<String, reqwest::Error>> {
let futures: Vec<_> = urls.iter().map(|url| fetch_data(url)).collect();
future::join_all(futures).await
}
// Select (race)
use tokio::select;
use tokio::time::{sleep, Duration};
async fn fetch_with_timeout(url: &str) -> Result<String, &'static str> {
select! {
result = fetch_data(url) => result.map_err(|_| "fetch error"),
_ = sleep(Duration::from_secs(5)) => Err("timeout"),
}
}
// Spawn tasks
async fn process_items(items: Vec<String>) {
let handles: Vec<_> = items
.into_iter()
.map(|item| {
tokio::spawn(async move {
process_item(&item).await
})
})
.collect();
for handle in handles {
if let Err(e) = handle.await {
eprintln!("Task failed: {}", e);
}
}
}
// Streams
use futures::stream::{self, StreamExt};
async fn process_stream() {
let numbers = stream::iter(vec![1, 2, 3, 4, 5]);
numbers
.map(|n| async move { n * 2 })
.buffer_unordered(3)
.for_each(|n| async move {
println!("{}", n);
})
.await;
}
// Channels
use tokio::sync::mpsc;
async fn channel_example() {
let (tx, mut rx) = mpsc::channel(32);
tokio::spawn(async move {
for i in 0..10 {
tx.send(i).await.unwrap();
}
});
while let Some(value) = rx.recv().await {
println!("Received: {}", value);
}
}
Collections and Iterators
use std::collections::{HashMap, HashSet, VecDeque};
// Vec operations
let mut vec = vec![1, 2, 3];
vec.push(4);
vec.extend([5, 6, 7]);
let first = vec.first();
let last = vec.pop();
// HashMap
let mut map: HashMap<String, i32> = HashMap::new();
map.insert(String::from("key"), 42);
map.entry(String::from("key2")).or_insert(0);
// Iterator methods
let numbers = vec![1, 2, 3, 4, 5];
let doubled: Vec<_> = numbers.iter().map(|x| x * 2).collect();
let sum: i32 = numbers.iter().sum();
let evens: Vec<_> = numbers.iter().filter(|x| *x % 2 == 0).collect();
let found = numbers.iter().find(|&&x| x > 3);
let all_positive = numbers.iter().all(|x| *x > 0);
// Chaining
let result: i32 = numbers
.iter()
.filter(|x| *x % 2 == 0)
.map(|x| x * 2)
.sum();
// Custom iterator
struct Counter {
count: u32,
max: u32,
}
impl Iterator for Counter {
type Item = u32;
fn next(&mut self) -> Option<Self::Item> {
if self.count < self.max {
self.count += 1;
Some(self.count)
} else {
None
}
}
}
Smart Pointers
use std::rc::Rc;
use std::cell::RefCell;
use std::sync::{Arc, Mutex};
// Box - heap allocation
let boxed = Box::new(5);
let list = Box::new(Node {
value: 1,
next: Some(Box::new(Node { value: 2, next: None })),
});
// Rc - reference counting
let a = Rc::new(5);
let b = Rc::clone(&a);
let c = Rc::clone(&a);
println!("count: {}", Rc::strong_count(&a)); // 3
// RefCell - interior mutability
let cell = RefCell::new(5);
*cell.borrow_mut() += 1;
println!("{}", cell.borrow()); // 6
// Rc<RefCell<T>> - shared mutable state
let shared = Rc::new(RefCell::new(vec![1, 2, 3]));
let shared2 = Rc::clone(&shared);
shared.borrow_mut().push(4);
shared2.borrow_mut().push(5);
// Arc - thread-safe Rc
let arc = Arc::new(5);
let arc2 = Arc::clone(&arc);
// Arc<Mutex<T>> - shared mutable state across threads
let counter = Arc::new(Mutex::new(0));
let handles: Vec<_> = (0..10)
.map(|_| {
let counter = Arc::clone(&counter);
std::thread::spawn(move || {
let mut num = counter.lock().unwrap();
*num += 1;
})
})
.collect();
for handle in handles {
handle.join().unwrap();
}
Related Skills
- [[system-design]] - Systems programming
- [[desktop-apps]] - Tauri applications
- [[performance-optimization]] - Low-level optimization
From the miles990/claude-software-skills README
Claude Software Skills
55 modular software development skills for Claude Code - from architecture to deployment
┌─────────────────────────────────────────────────────────────────┐
│ Claude Software Skills │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Software │ │ Software │ │ Development │ │
│ │ Design │ │ Engineering │ │ Stacks │ │
│ │ 6 │ │ 8 │ │ 8 │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Tools & │ │ Domain │ │ Programming │ │
│ │ Integrations │ │ Applications │ │ Languages │ │
│ │ 9 │ │ 12 │ │ 12 │ │
│ └──────────────┘ └──────────────┘ └──────────────┘ │
│ │
│ AI 自動識別任務 → 載入對應領域知識 │
└─────────────────────────────────────────────────────────────────┘
Features
- MCP Compatible - Works with Claude Code, Cursor, and other MCP clients
- Semantic Search - Claude automatically finds relevant skills for your task
- Cross-Domain Integration - Skills work together seamlessly
- Best Practices Built-In - Each skill includes patterns and anti-patterns
- Modular Architecture - Use only what you need
- Sharp Edges - Proactive warnings about common pitfalls with detection patterns
- Validations - Executable code quality rules with regex/ast patterns
- Collaboration - Skills declare relationships for smart delegation and context passing
Installation
Plugin Marketplace (Recommended)
# 1. Add marketplace (GitHub format: owner/repo)
/plugin marketplace add miles990/claude-software-skills
# 2. Open plugin management interface, view available plugins in Discover tab
/plugin
# 3. Install specific skills (choose what you need)
/plugin install frontend@claude-software-skills
/plugin install backend@claude-software-skills
/plugin install api-design@claude-software-skills
# Or mention skill name in conversation, Claude will auto-load
Supported GitHub formats:
# Short format (recommended)
/plugin marketplace add miles990/claude-software-skills
# HTTPS URL
/plugin marketplace add https://github.com/miles990/claude-software-skills.git
# Specify branch or tag
/plugin marketplace add miles990/claude-software-skills#main
Plugin commands:
| Command | Description |
|---|---|
/plugin | Open interactive plugin management interface |
/plugin install <name>@<marketplace> | Install specific plugin |
/plugin disable <name>@<marketplace> | Temporarily disable plugin |
/plugin uninstall <name>@<marketplace> | Completely remove plugin |
Available Skills
Software Design (6 skills)
| Skill | Description |
|---|---|
architecture-patterns | Software architecture patterns and best practices |
design-patterns | Classic and modern software design patterns |
api-design | RESTful, GraphQL, gRPC, and API best practices |
system-design | Scalability, availability, and distributed systems design |
data-design | Data modeling, schema design, and data architecture |
ux-principles | User experience design principles for developers |
Software Engineering (8 skills)
| Skill | Description |
|---|---|
code-quality | Clean code principles, SOLID, and code review practices |
testing-strategies | Unit, integration, E2E testing and TDD practices |
devops-cicd | CI/CD pipelines, infrastructure as code, and deployment |
performance-optimization | Profiling, optimization techniques, and best practices |
security-practices | OWASP Top 10, authentication, and secure coding |
reliability-engineering | SRE principles, observability, and incident management |
documentation | Technical writing, API docs, and documentation best practices |
internationalization | i18n/l10n architecture design and multi-language support |
Development Stacks (8 skills)
| Skill | Description |
|---|---|
frontend | Modern frontend with React, Vue, and web technologies |
backend | Backend with Node.js, Express, NestJS, and server patterns |
mobile | Mobile with React Native, Flutter, and native patterns |
database | Database design, SQL, NoSQL, and data management |
cloud-platforms | AWS, GCP, Azure services and cloud-native development |
ai-ml-integration | AI/ML APIs, LLM integration, and intelligent apps |
realtime-systems | WebSocket, real-time communication, event-driven |
edge-iot | Edge computing, IoT protocols, and embedded systems |
Tools & Integrations (9 skills)
| Skill | Description |
|---|---|
git-workflows | Git version control, branching, and collaboration |
project-management | Agile, Scrum, Kanban, and issue tracking |
development-environment | IDE setup, dev containers, and local development |
monitoring-logging | Application monitoring, logging, and alerting |
api-tools | API testing, documentation, and development tools |
automation-scripts | Build automation, task runners, and scripting |
auto-dev-setup | Auto-Dev workflow for Human-in-the-Loop automation |
claude-code-plugin | Claude Code Plugin development and marketplace management |
claude-code-sdk | Claude Code SDK for AI-powered applications |
Domain Applications (12 skills)
| Skill | Description |
|---|---|
application-patterns | Common application development patterns |
e-commerce | E-commerce platforms, payments, shopping cart |
saas-platforms | SaaS architecture, multi-tenancy, subscriptions |
content-platforms | CMS, blogging platforms, content management |
communication-systems | Email, notifications, messaging systems |
developer-tools | CLI tools, SDKs, developer experience |
game-development | Game development patterns and architectures |
flame | Flame Engine 2D game development for Flutter |
flame-core | Flame Engine core - components, input, collision |
flame-systems | Flame Engine 14 game systems |
flame-templates | Game templates - RPG, Platformer, Roguelike |
desktop-apps | Desktop apps with Electron and Tauri |
Programming Languages (12 skills)
| Skill | Description |
|---|---|
javascript-typescript | Modern JavaScript and TypeScript patterns |
python | Python programming patterns and best practices |
go | Go programming patterns and idioms |
rust | Rust patterns and ownership concepts |
java-kotlin | Java and Kotlin programming patterns |
csharp-dotnet | C# and .NET development patterns |
cpp | Modern C++ programming patterns and idioms |
ruby | Ruby programming patterns and idioms |
php | Modern PHP programming patterns |
swift | Swift patterns for iOS and macOS |
shell-bash | Shell scripting and Bash programming |
sql | SQL patterns for database querying and design |
Other Installation Methods
Clone to Skills Directory
# Clone to your skills directory
git clone https://github.com/miles990/claude-software-skills.git ~/.claude/skills/software-skills
Claude will automatically discover and use the skills when relevant to your tasks.
With MCP Server
This repository is compatible with claude-skills-mcp:
# Install the MCP server
pip install claude-skills-mcp
# Add this repository as a skill source
# The server will load skills from ~/.claude/skills/
Cursor IDE
Add to your Cursor MCP settings:
{
"mcpServers": {
"software-skills": {
"command": "npx",
"args": ["-y", "claude-skills-mcp"],
"env": {
"SKILLS_PATH": "/path/to/claude-software-skills"
}
}
}
}
Manual Reference
Simply clone and reference the SKILL.md files in your prompts:
git clone https://github.com/miles990/claude-software-skills.git
Auto-Dev: Automated Development Workflow
One-click setup for GitHub Actions automated development workflow, let Claude help you complete development tasks.
Quick Setup
Using API Key:
curl -fsSL https://raw.githubusercontent.com/miles990/claude-software-skills/main/scripts/setup-auto-dev-apikey.sh | bash
Using Claude Max (OAuth):
curl -fsSL https://raw.githubusercontent.com/miles990/claude-software-skills/main/scripts/setup-auto-dev-max.sh | bash
Post-Installation Setup
| Version | Setup Method |
|---|---|
| API Key | Get Key from console.anthropic.com, set in GitHub Secrets ANTHROPIC_API_KEY |
| Claude Max | Run claude /install-github-app for auto OAuth Token setup |
Usage
- Issue Trigger: Create Issue → Add
auto-devlabel - Comment Trigger: Comment
@claude [instruction]on any Issue/PR
Detailed docs: AUTO-DEV.md
Usage Examples
User: Help me design a microservices architecture for an e-commerce platform
Claude: [Automatically uses architecture-patterns + e-commerce + api-design skills]
User: Review this Python code for performance issues
Claude: [Automatically uses python + performance-optimization + code-quality skills]
User: Set up CI/CD for a React + Node.js monorepo
Claude: [Automatically uses devops-cicd + frontend + backend + git-workflows skills]
Directory Structure
claude-software-skills/
├── .claude-plugin/ # Plugin configuration
│ └── marketplace.json # Lists all 55 skills as individual plugins
├── .github/
│ └── workflows/ # CI/CD automation
├── software-design/ # Architecture & design skills
├── software-engineering/ # Development practices
├── development-stacks/ # Tech stack skills
├── tools-integrations/ # Developer tools
├── domain-applications/ # Domain-specific patterns
├── programming-languages/ # Language-specific skills
├── docs/
│ ├── SKILL-TEMPLATE.md # Template for new skills
│ └── software-skills.md
├── CONTRIBUTING.md
├── LICENSE
└── README.md
How It Works
Each skill module contains a SKILL.md file with:
- Metadata - Name, description, tags for semantic search
- Key Concepts - Core knowledge and terminology
- Best Practices - Recommended approaches with examples
- Common Pitfalls - What to avoid and why
- Patterns & Anti-patterns - Do's and don'ts with code
- Tools & Resources - Recommended tools and references
- Decision Guide - When to use this skill
When you describe a task, Claude:
- Searches for relevant skills using semantic matching
- Loads the appropriate SKILL.md files
- Applies the knowledge to your specific context
- Follows best practices while avoiding common pitfalls
Contributing
We welcome contributions! Please see CONTRIBUTING.md for guidelines.
Adding a New Skill
- Create a directory under the appropriate category
- Add a
SKILL.mdfollowing our template - Include practical examples and best practices
- Submit a pull request
License
MIT License - See LICENSE for details.
Related Projects
- claude-domain-skills - Non-technical domain skills
- claude-skills-mcp - MCP server for skill discovery
Built for developers, by developers, with Claude
Details
- Marketplace
- miles990/claude-software-skills
- Source
- programming-languages/rust
- Category
- Community
- Listed since
- Apr 6, 2026
More from miles990/claude-software-skills
All 56- saas-platformsv1.0.0
- security-practicesv1.0.0
- shell-bashv1.0.0
- sqlv1.0.0
- swiftv1.0.0
- system-designv1.0.0
- testing-strategiesv1.0.0
- ux-principlesv1.0.0
- ai-ml-integrationv1.0.0
- analyze-repov1.0.0
- api-designv1.0.0
- api-toolsv1.0.0
- application-patternsv1.0.0
- architecture-patternsv1.0.0
- auto-dev-setupv1.0.0
- automation-scriptsv1.0.0
- backendv1.0.0
- claude-code-pluginv1.0.0
- claude-code-sdkv1.0.0
- cloud-platformsv1.0.0
- code-qualityv1.0.0
- communication-systemsv1.0.0
- content-platformsv1.0.0
- cppv1.0.0
Similar to rust
rubymiles990/claude-software-skills26 starsRuby programming patterns and idioms
gomiles990/claude-software-skills26 starsGo programming patterns and idioms
jutsu-rustTheBushidoCollective/han201 starsAdvanced Rust skills for ownership, error handling, and async programming.
systems-programmingwshobson/agents42.8K starsSystems programming with Rust, Go, C, and C++ for performance-critical and low-level development
idalib-rust-skillsidalib-rs/idalib356 stars
open-sourceposit-dev/skills567 starsCollection of skills for open-source R and Python package developers
