スキル一覧に戻る
gar-ai

rust-project-setup

by gar-ai

1🍴 0📅 2025年12月31日
GitHubで見るManusで実行

SKILL.md


name: rust-project-setup description: Initialize Rust projects with proper structure, essential crates, and Cargo.toml configuration. Use when starting new Rust binaries or libraries.

Rust Project Setup

Initialize Rust projects with production-ready structure and dependencies.

Project Initialization

cargo new project_name          # Binary
cargo new --lib project_name    # Library
src/
├── lib.rs / main.rs
├── module/
│   ├── mod.rs
│   └── submodule.rs
├── error.rs                    # Error types
├── config.rs                   # Configuration
tests/                          # Integration tests
examples/                       # Runnable examples
benches/                        # Benchmarks

Essential Crates by Category

Async Runtime

tokio = { version = "1", features = ["full"] }

Serialization

serde = { version = "1", features = ["derive"] }
serde_json = "1"

Error Handling

thiserror = "1"      # Libraries
anyhow = "1"         # Applications

Database

sqlx = { version = "0.7", features = ["runtime-tokio", "postgres", "native-tls"] }

HTTP/Web

axum = "0.7"
reqwest = { version = "0.11", features = ["json"] }

CLI

clap = { version = "4", features = ["derive"] }

Observability

tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }

Utilities

dotenvy = "0.15"     # Environment variables
num_cpus = "1"       # CPU detection
parking_lot = "0.12" # Fast locks
bytes = "1"          # Zero-copy buffers

Production Cargo.toml Template

[package]
name = "my-service"
version = "0.1.0"
edition = "2021"
rust-version = "1.70"

[dependencies]
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
thiserror = "1"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
dotenvy = "0.15"

[dev-dependencies]
tokio-test = "0.4"

[profile.release]
opt-level = 3
lto = true
codegen-units = 1
strip = true
panic = 'abort'

[lints.rust]
unsafe_code = "forbid"

[lints.clippy]
all = "warn"
pedantic = "warn"
unwrap_used = "deny"
expect_used = "deny"

Guidelines

  • Use edition = "2021" for latest features
  • Specify rust-version for MSRV
  • Enable release optimizations for production
  • Use workspace for monorepos
  • Pin major versions, allow minor updates

Examples

See hercules-local-algo/Cargo.toml for production configuration.

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です