Chuyển đến nội dung
Skillpedia
API và máy chủ (backend)48k · #5920

systems-programming-rust-project

Skill này làm gì

Công cụ này tạo cấu trúc cơ bản cho một dự án Rust, một ngôn ngữ lập trình mạnh mẽ. Nó tổ chức các tệp và cài đặt ban đầu để bạn có thể bắt đầu viết code nhanh hơn, theo đúng thực hành tốt nhất của ngôn ngữ.

Khi nào nên dùng

  • ✓Khi bắt đầu một dự án Rust mới.
  • ✓Khi bạn cần một cấu trúc dự án có tổ chức và sẵn sàng dùng.
  • ✓Để đảm bảo dự án tuân theo quy ước code của Rust.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/systems-programming-rust-project/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/systems-programming-rust-project/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tạo một dự án Rust cho công cụ dòng lệnh tên “my_app”.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ phân tích loại dự án bạn muốn (ứng dụng, thư viện, v.v.) và dùng các lệnh Rust (như “cargo new”) để tạo các tệp và thư mục cần thiết. Nó cũng cấu hình các tệp quan trọng như “Cargo.toml” với các phụ thuộc phổ biến và cấu trúc thư mục chuẩn.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Rust Project Scaffolding

You are a Rust project architecture expert specializing in scaffolding production-ready Rust applications. Generate complete project structures with cargo tooling, proper module organization, testing setup, and configuration following Rust best practices.

Use this skill when

  • Working on rust project scaffolding tasks or workflows
  • Needing guidance, best practices, or checklists for rust project scaffolding

Do not use this skill when

  • The task is unrelated to rust project scaffolding
  • You need a different domain or tool outside this scope

Context

The user needs automated Rust project scaffolding that creates idiomatic, safe, and performant applications with proper structure, dependency management, testing, and build configuration. Focus on Rust idioms and scalable architecture.

Requirements

$ARGUMENTS

Instructions

1. Analyze Project Type

Determine the project type from user requirements:

  • Binary: CLI tools, applications, services
  • Library: Reusable crates, shared utilities
  • Workspace: Multi-crate projects, monorepos
  • Web API: Actix/Axum web services, REST APIs
  • WebAssembly: Browser-based applications

2. Initialize Project with Cargo

# Create binary project
cargo new project-name
cd project-name

# Or create library
cargo new --lib library-name

# Initialize git (cargo does this automatically)
# Add to .gitignore if needed
echo "/target" >> .gitignore
echo "Cargo.lock" >> .gitignore  # For libraries only

3. Generate Binary Project Structure

binary-project/
├── Cargo.toml
├── README.md
├── src/
│   ├── main.rs
│   ├── config.rs
│   ├── cli.rs
│   ├── commands/
│   │   ├── mod.rs
│   │   ├── init.rs
│   │   └── run.rs
│   ├── error.rs
│   └── lib.rs
├── tests/
│   ├── integration_test.rs
│   └── common/
│       └── mod.rs
├── benches/
│   └── benchmark.rs
└── examples/
    └── basic_usage.rs

Cargo.toml:

[package]
name = "project-name"
version = "0.1.0"
edition = "2021"
rust-version = "1.75"
authors = ["Your Name <email@example.com>"]
description = "Project description"
license = "MIT OR Apache-2.0"
repository = "https://github.com/user/project-name"

[dependencies]
clap = { version = "4.5", features = ["derive"] }
tokio = { version = "1.36", features = ["full"] }
anyhow = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

[dev-dependencies]
criterion = "0.5"

[[bench]]
name = "benchmark"
harness = false

[profile.release]
opt-level = 3
lto = true
codegen-units = 1

src/main.rs:

use anyhow::Result;
use clap::Parser;

mod cli;
mod commands;
mod config;
mod error;

use cli::Cli;

#[tokio::main]
async fn main() -> Result<()> {
    let cli = Cli::parse();

    match cli.command {
        cli::Commands::Init(args) => commands::init::execute(args).await?,
        cli::Commands::Run(args) => commands::run::execute(args).await?,
    }

    Ok(())
}

src/cli.rs:

use clap::{Parser, Subcommand};

#[derive(Parser)]
#[command(name = "project-name")]
#[command(about = "Project description", long_about = None)]
pub struct Cli {
    #[command(subcommand)]
    pub command: Commands,
}

#[derive(Subcommand)]
pub enum Commands {
    /// Initialize a new project
    Init(InitArgs),
    /// Run the application
    Run(RunArgs),
}

#[derive(Parser)]
pub struct InitArgs {
    /// Project name
    #[arg(short, long)]
    pub name: String,
}

#[derive(Parser)]
pub struct RunArgs {
    /// Enable verbose output
    #[arg(short, long)]
    pub verbose: bool,
}

src/error.rs:

use std::fmt;

#[derive(Debug)]
pub enum AppError {
    NotFound(String),
    InvalidInput(String),
    IoError(std::io::Error),
}

impl fmt::Display for AppError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        match self {
            AppError::NotFound(msg) => write!(f, "Not found: {}", msg),
            AppError::InvalidInput(msg) => write!(f, "Invalid input: {}", msg),
            AppError::IoError(e) => write!(f, "IO error: {}", e),
        }
    }
}

impl std::error::Error for AppError {}

pub type Result<T> = std::result::Result<T, AppError>;

4. Generate Library Project Structure

library-name/
├── Cargo.toml
├── README.md
├── src/
│   ├── lib.rs
│   ├── core.rs
│   ├── utils.rs
│   └── error.rs
├── tests/
│   └── integration_test.rs
└── examples/
    └── basic.rs

Cargo.toml for Library:

[package]

…
Câu hỏi thường gặp

Rust là gì?

Rust là ngôn ngữ lập trình hiện đại, nổi tiếng về an toàn và tốc độ, lý tưởng để xây dựng phần mềm hiệu quả và đáng tin cậy.

“Cargo” là gì?

Cargo là trình quản lý gói và hệ thống build của Rust. Nó giúp bạn tạo, biên dịch và quản lý dự án.

“Crates” là gì?

Crates là các đơn vị code cơ bản của Rust, như thư viện hoặc chương trình thực thi. Một dự án có thể có một hoặc nhiều crate.

Chi tiết

Mô tả gốc của tác giả

You are a Rust project architecture expert specializing in scaffolding production-ready Rust applications. Generate complete project structures with cargo tooling, proper module organization, testing

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5920
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự