From new-rust-project
Scaffold a new Rust project. Use when the user wants to create a new Rust project, crate, or workspace. Asks about project type, Nix integration, error handling, dependencies, CI, and license, then generates all files.
How this skill is triggered — by the user, by Claude, or both
Slash command
/new-rust-project:new-rust-projectThis skill is limited to the following tools:
The summary Claude sees in its skill listing — used to decide when to auto-load this skill
You are scaffolding a new Rust project. Follow these steps exactly.
You are scaffolding a new Rust project. Follow these steps exactly.
Ask the following questions sequentially using AskUserQuestion. Do not ask all at once.
Ask for the project name. Default: $ARGUMENTS if provided, otherwise the current directory name.
Validate: must be lowercase ASCII letters, digits, and hyphens only. Must start with a letter.
Options:
crates/ directorysrc/main.rssrc/lib.rsDefault: Workspace
If workspace is chosen, ask a follow-up:
Suggest <name>-core and <name>-cli as defaults. Allow the user to customize.
Each crate name must follow the same naming rules as the project name.
Ask which crates should be libraries vs binaries (default: all libraries except *-cli which is binary).
Ask for a one-line description for Cargo.toml and README.md.
Options:
Default: Full flake.nix
If flake is chosen, there should be a .envrc file containing "use flake".
If simple Nix is chosen, there should be a .envrc file containing "use nix".
Options:
src/error.rs with Error enum and Result<T> aliassrc/error.rs generatedDefault: thiserror
The following are always included (do not ask):
serde (+ serde_json) — serializationtracing — structured diagnosticsOptions to ask about:
Options:
Options:
If multiple licenses are selected, provide multiple aptly named license files.
Default: Current system user.
Print a summary of all choices in a clear table/list format. Ask the user to confirm before generating files.
Generate all files based on the user's answers. Use the reference templates in references/ as the basis for each file. Read each relevant reference file and adapt its template content using the user's answers.
| File | Reference | Notes |
|---|---|---|
Cargo.toml | cargo-workspace.md or cargo-single.md | Depends on project type |
rust-toolchain.toml | (inline) | Always: channel = "stable" |
justfile | justfile.md | Adapt recipes based on testing extras |
.gitignore | gitignore.md | Include Cargo.lock for libraries only |
CLAUDE.md | claude-md.md | Adapt to project structure |
.claude/settings.json | claude-settings.md | Adapt allowed tools based on Nix choice |
README.md | (inline) | Title, description, badges |
| Condition | File | Reference |
|---|---|---|
| Workspace | crates/<name>/Cargo.toml | cargo-crate.md |
| Workspace | crates/<name>/src/lib.rs or main.rs | (inline) |
| Binary | src/main.rs | (inline) |
| Library | src/lib.rs | (inline) |
| thiserror chosen | src/error.rs (single crate) or crates/<core>/src/error.rs (workspace) | error-rs.md |
| Nix: full flake | flake.nix | flake-crate2nix.md |
| Nix: full flake | nix/devshell.nix | flake-crate2nix.md |
| Nix: full flake | nix/rust-overlay.nix | flake-crate2nix.md |
| Nix: full flake | nix/package-overlay.nix | flake-crate2nix.md |
| Nix: full flake | .envrc | "use flake" |
| Nix: simple | shell.nix | shell-nix-simple.md |
| Nix: simple | .envrc | "use nix" |
| CI: GitHub Actions | .github/workflows/rust.yml | ci-github-actions.md |
| License: MIT | LICENSE | Generate MIT text |
| License: Apache-2.0 | LICENSE | Generate Apache text |
| License: LGPL-2.0 | LICENSE | Generate LGPL text |
rust-toolchain.toml:
[toolchain]
channel = "stable"
components = ["rustfmt", "clippy"]
src/main.rs:
fn main() {
println!("Hello, world!");
}
src/lib.rs:
//! {{description}}
README.md:
# {{project-name}}
{{description}}
After generating all files, offer to:
git init but don't create any commitsnix flake lock to create flake.lockCargo.toml file uses edition = "2024"Cargo.toml in sub-crates except for names, versionsunused_must_use = "deny" and clippy unwrap_used = "deny"[workspace.dependencies]rust-toolchain.toml is always generated (even without Nix) for reproducibilitymkdir -pnpx claudepluginhub sshine/create-rust-project --plugin new-rust-projectScaffolds new Rust projects with best practices for Cargo.toml, linting (clippy, rustfmt), CI pipelines, and workspace organization.
Scaffolds production-ready Rust projects using Cargo with proper module organization, testing setup, and best practices for binaries, libraries, workspaces, web APIs, and WebAssembly.
Enforces strict Rust standards including FAIL FAST error handling, workspace architecture, dependency management with version scripts, and patterns for code reviews, projects, and compilation fixes.