[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-cd83c6f7-3e27-416d-b5ee-780c3a580863":3,"$fLo0uCgnjI8iRGDyVkmQKrMOYHwLXQ_-z9e7e_bjrItg":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"cd83c6f7-3e27-416d-b5ee-780c3a580863","systems-programming-rust-project","您是Rust项目架构专家，专注于构建生产就绪的Rust应用程序的脚手架。使用cargo工具生成完整的项目结构，合理的模块组织，测试","cat_life_career","mod_other","sickn33,other","---\nname: systems-programming-rust-project\ndescription: \"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\"\nrisk: unknown\nsource: community\ndate_added: \"2026-02-27\"\n---\n\n# Rust Project Scaffolding\n\nYou 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.\n\n## Use this skill when\n\n- Working on rust project scaffolding tasks or workflows\n- Needing guidance, best practices, or checklists for rust project scaffolding\n\n## Do not use this skill when\n\n- The task is unrelated to rust project scaffolding\n- You need a different domain or tool outside this scope\n\n## Context\n\nThe 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.\n\n## Requirements\n\n$ARGUMENTS\n\n## Instructions\n\n### 1. Analyze Project Type\n\nDetermine the project type from user requirements:\n- **Binary**: CLI tools, applications, services\n- **Library**: Reusable crates, shared utilities\n- **Workspace**: Multi-crate projects, monorepos\n- **Web API**: Actix\u002FAxum web services, REST APIs\n- **WebAssembly**: Browser-based applications\n\n### 2. Initialize Project with Cargo\n\n```bash\n# Create binary project\ncargo new project-name\ncd project-name\n\n# Or create library\ncargo new --lib library-name\n\n# Initialize git (cargo does this automatically)\n# Add to .gitignore if needed\necho \"\u002Ftarget\" >> .gitignore\necho \"Cargo.lock\" >> .gitignore  # For libraries only\n```\n\n### 3. Generate Binary Project Structure\n\n```\nbinary-project\u002F\n├── Cargo.toml\n├── README.md\n├── src\u002F\n│   ├── main.rs\n│   ├── config.rs\n│   ├── cli.rs\n│   ├── commands\u002F\n│   │   ├── mod.rs\n│   │   ├── init.rs\n│   │   └── run.rs\n│   ├── error.rs\n│   └── lib.rs\n├── tests\u002F\n│   ├── integration_test.rs\n│   └── common\u002F\n│       └── mod.rs\n├── benches\u002F\n│   └── benchmark.rs\n└── examples\u002F\n    └── basic_usage.rs\n```\n\n**Cargo.toml**:\n```toml\n[package]\nname = \"project-name\"\nversion = \"0.1.0\"\nedition = \"2021\"\nrust-version = \"1.75\"\nauthors = [\"Your Name \u003Cemail@example.com>\"]\ndescription = \"Project description\"\nlicense = \"MIT OR Apache-2.0\"\nrepository = \"https:\u002F\u002Fgithub.com\u002Fuser\u002Fproject-name\"\n\n[dependencies]\nclap = { version = \"4.5\", features = [\"derive\"] }\ntokio = { version = \"1.36\", features = [\"full\"] }\nanyhow = \"1.0\"\nserde = { version = \"1.0\", features = [\"derive\"] }\nserde_json = \"1.0\"\n\n[dev-dependencies]\ncriterion = \"0.5\"\n\n[[bench]]\nname = \"benchmark\"\nharness = false\n\n[profile.release]\nopt-level = 3\nlto = true\ncodegen-units = 1\n```\n\n**src\u002Fmain.rs**:\n```rust\nuse anyhow::Result;\nuse clap::Parser;\n\nmod cli;\nmod commands;\nmod config;\nmod error;\n\nuse cli::Cli;\n\n#[tokio::main]\nasync fn main() -> Result\u003C()> {\n    let cli = Cli::parse();\n\n    match cli.command {\n        cli::Commands::Init(args) => commands::init::execute(args).await?,\n        cli::Commands::Run(args) => commands::run::execute(args).await?,\n    }\n\n    Ok(())\n}\n```\n\n**src\u002Fcli.rs**:\n```rust\nuse clap::{Parser, Subcommand};\n\n#[derive(Parser)]\n#[command(name = \"project-name\")]\n#[command(about = \"Project description\", long_about = None)]\npub struct Cli {\n    #[command(subcommand)]\n    pub command: Commands,\n}\n\n#[derive(Subcommand)]\npub enum Commands {\n    \u002F\u002F\u002F Initialize a new project\n    Init(InitArgs),\n    \u002F\u002F\u002F Run the application\n    Run(RunArgs),\n}\n\n#[derive(Parser)]\npub struct InitArgs {\n    \u002F\u002F\u002F Project name\n    #[arg(short, long)]\n    pub name: String,\n}\n\n#[derive(Parser)]\npub struct RunArgs {\n    \u002F\u002F\u002F Enable verbose output\n    #[arg(short, long)]\n    pub verbose: bool,\n}\n```\n\n**src\u002Ferror.rs**:\n```rust\nuse std::fmt;\n\n#[derive(Debug)]\npub enum AppError {\n    NotFound(String),\n    InvalidInput(String),\n    IoError(std::io::Error),\n}\n\nimpl fmt::Display for AppError {\n    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {\n        match self {\n            AppError::NotFound(msg) => write!(f, \"Not found: {}\", msg),\n            AppError::InvalidInput(msg) => write!(f, \"Invalid input: {}\", msg),\n            AppError::IoError(e) => write!(f, \"IO error: {}\", e),\n        }\n    }\n}\n\nimpl std::error::Error for AppError {}\n\npub type Result\u003CT> = std::result::Result\u003CT, AppError>;\n```\n\n### 4. Generate Library Project Structure\n\n```\nlibrary-name\u002F\n├── Cargo.toml\n├── README.md\n├── src\u002F\n│   ├── lib.rs\n│   ├── core.rs\n│   ├── utils.rs\n│   └── error.rs\n├── tests\u002F\n│   └── integration_test.rs\n└── examples\u002F\n    └── basic.rs\n```\n\n**Cargo.toml for Library**:\n```toml\n[package]\nname = \"library-name\"\nversion = \"0.1.0\"\nedition = \"2021\"\nrust-version = \"1.75\"\n\n[dependencies]\n# Keep minimal for libraries\n\n[dev-dependencies]\ntokio-test = \"0.4\"\n\n[lib]\nname = \"library_name\"\npath = \"src\u002Flib.rs\"\n```\n\n**src\u002Flib.rs**:\n```rust\n\u002F\u002F! Library documentation\n\u002F\u002F!\n\u002F\u002F! # Examples\n\u002F\u002F!\n\u002F\u002F! ```\n\u002F\u002F! use library_name::core::CoreType;\n\u002F\u002F!\n\u002F\u002F! let instance = CoreType::new();\n\u002F\u002F! ```\n\npub mod core;\npub mod error;\npub mod utils;\n\npub use core::CoreType;\npub use error::{Error, Result};\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn it_works() {\n        assert_eq!(2 + 2, 4);\n    }\n}\n```\n\n### 5. Generate Workspace Structure\n\n```\nworkspace\u002F\n├── Cargo.toml\n├── .gitignore\n├── crates\u002F\n│   ├── api\u002F\n│   │   ├── Cargo.toml\n│   │   └── src\u002F\n│   │       └── lib.rs\n│   ├── core\u002F\n│   │   ├── Cargo.toml\n│   │   └── src\u002F\n│   │       └── lib.rs\n│   └── cli\u002F\n│       ├── Cargo.toml\n│       └── src\u002F\n│           └── main.rs\n└── tests\u002F\n    └── integration_test.rs\n```\n\n**Cargo.toml (workspace root)**:\n```toml\n[workspace]\nmembers = [\n    \"crates\u002Fapi\",\n    \"crates\u002Fcore\",\n    \"crates\u002Fcli\",\n]\nresolver = \"2\"\n\n[workspace.package]\nversion = \"0.1.0\"\nedition = \"2021\"\nrust-version = \"1.75\"\nauthors = [\"Your Name \u003Cemail@example.com>\"]\nlicense = \"MIT OR Apache-2.0\"\n\n[workspace.dependencies]\ntokio = { version = \"1.36\", features = [\"full\"] }\nserde = { version = \"1.0\", features = [\"derive\"] }\n\n[profile.release]\nopt-level = 3\nlto = true\n```\n\n### 6. Generate Web API Structure (Axum)\n\n```\nweb-api\u002F\n├── Cargo.toml\n├── src\u002F\n│   ├── main.rs\n│   ├── routes\u002F\n│   │   ├── mod.rs\n│   │   ├── users.rs\n│   │   └── health.rs\n│   ├── handlers\u002F\n│   │   ├── mod.rs\n│   │   └── user_handler.rs\n│   ├── models\u002F\n│   │   ├── mod.rs\n│   │   └── user.rs\n│   ├── services\u002F\n│   │   ├── mod.rs\n│   │   └── user_service.rs\n│   ├── middleware\u002F\n│   │   ├── mod.rs\n│   │   └── auth.rs\n│   └── error.rs\n└── tests\u002F\n    └── api_tests.rs\n```\n\n**Cargo.toml for Web API**:\n```toml\n[package]\nname = \"web-api\"\nversion = \"0.1.0\"\nedition = \"2021\"\n\n[dependencies]\naxum = \"0.7\"\ntokio = { version = \"1.36\", features = [\"full\"] }\ntower = \"0.4\"\ntower-http = { version = \"0.5\", features = [\"trace\", \"cors\"] }\nserde = { version = \"1.0\", features = [\"derive\"] }\nserde_json = \"1.0\"\nsqlx = { version = \"0.7\", features = [\"runtime-tokio-native-tls\", \"postgres\"] }\ntracing = \"0.1\"\ntracing-subscriber = \"0.3\"\n```\n\n**src\u002Fmain.rs (Axum)**:\n```rust\nuse axum::{Router, routing::get};\nuse tower_http::cors::CorsLayer;\nuse std::net::SocketAddr;\n\nmod routes;\nmod handlers;\nmod models;\nmod services;\nmod error;\n\n#[tokio::main]\nasync fn main() {\n    tracing_subscriber::fmt::init();\n\n    let app = Router::new()\n        .route(\"\u002Fhealth\", get(routes::health::health_check))\n        .nest(\"\u002Fapi\u002Fusers\", routes::users::router())\n        .layer(CorsLayer::permissive());\n\n    let addr = SocketAddr::from(([0, 0, 0, 0], 3000));\n    tracing::info!(\"Listening on {}\", addr);\n\n    let listener = tokio::net::TcpListener::bind(addr).await.unwrap();\n    axum::serve(listener, app).await.unwrap();\n}\n```\n\n### 7. Configure Development Tools\n\n**Makefile**:\n```makefile\n.PHONY: build test lint fmt run clean bench\n\nbuild:\n\tcargo build\n\ntest:\n\tcargo test\n\nlint:\n\tcargo clippy -- -D warnings\n\nfmt:\n\tcargo fmt --check\n\nrun:\n\tcargo run\n\nclean:\n\tcargo clean\n\nbench:\n\tcargo bench\n```\n\n**rustfmt.toml**:\n```toml\nedition = \"2021\"\nmax_width = 100\ntab_spaces = 4\nuse_small_heuristics = \"Max\"\n```\n\n**clippy.toml**:\n```toml\ncognitive-complexity-threshold = 30\n```\n\n## Output Format\n\n1. **Project Structure**: Complete directory tree with idiomatic Rust organization\n2. **Configuration**: Cargo.toml with dependencies and build settings\n3. **Entry Point**: main.rs or lib.rs with proper documentation\n4. **Tests**: Unit and integration test structure\n5. **Documentation**: README and code documentation\n6. **Development Tools**: Makefile, clippy\u002Frustfmt configs\n\nFocus on creating idiomatic Rust projects with strong type safety, proper error handling, and comprehensive testing setup.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,93,2049,"2026-05-16 13:42:54",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"其他","other","mdi-page-next-outline","其他类型Skill",5,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"职场发展","career","mdi-briefcase-outline","面试准备、简历优化、职业规划",4,575,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"2bd88c31-35e6-463d-b148-896c2a2d7562","1.0.0","systems-programming-rust-project.zip",3485,"uploads\u002Fskills\u002Fcd83c6f7-3e27-416d-b5ee-780c3a580863\u002Fsystems-programming-rust-project.zip","96792bb16b32d8f32cebd3736dc841be6fa7c5e67311e1aa5b0cfe99b0d30669","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":9672}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]