Scaffold rust
Cross-platform dotfiles managed by Chezmoi with Homebrew/apt and per-language version managers. One-command bootstrap for macOS and Linux with Neovim, Tmux, Zsh, and AI agent skills.
npx -y skills add urmzd/dotfiles --skill scaffold-rustAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Scaffold a complete Rust project with CI/CD, release pipeline, and sr.yaml. Uses cargo as the native build system. Loads on top of scaffold-project (run that first for cross-language standard files). Use when creating a new Rust CLI, library, or workspace, or when the user mentions "new Rust project", "cargo init", or "Rust scaffold". Do NOT use for Go, Python, Node, or Terraform projects; use the matching scaffold-<lang> skill.
SKILL.md
8.5 KB, ~2.1k tokens by cl100k_base, as published. Nobody here has run it
Scaffold Rust Project
Generate a production-ready Rust project following established CI/CD patterns. Read the scaffold-project skill first for standard files (README, AGENTS.md, LICENSE, CONTRIBUTING.md, llms.txt).
When to Use
- Creating a new Rust CLI tool, library, or workspace
- Adding CI/CD to an existing Rust project missing workflows
- Standardizing a Rust project to match org conventions
Generated Files
.github/workflows/ci.yml
name: CI
on:
pull_request:
branches: [main]
workflow_call:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo check --workspace
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --workspace -- -D warnings
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --all -- --check
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --workspace
.github/workflows/release.yml
name: Release
on:
push:
branches: [main]
workflow_dispatch:
concurrency:
group: release
cancel-in-progress: false
jobs:
ci:
if: github.actor != 'sr[bot]'
uses: ./.github/workflows/ci.yml
release:
needs: ci
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Generate app token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.SR_RELEASER_APP_ID }}
private-key: ${{ secrets.SR_RELEASER_PRIVATE_KEY }}
repositories: ${{ github.event.repository.name }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- uses: urmzd/sr@v8
id: sr
with:
github-token: ${{ steps.app-token.outputs.token }}
outputs:
released: ${{ steps.sr.outputs.released }}
tag: ${{ steps.sr.outputs.tag }}
version: ${{ steps.sr.outputs.version }}
build:
needs: release
if: needs.release.outputs.released == 'true'
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
runner: ubuntu-latest
cross: false
- target: aarch64-unknown-linux-gnu
runner: ubuntu-latest
cross: true
- target: x86_64-unknown-linux-musl
runner: ubuntu-latest
cross: false
- target: aarch64-unknown-linux-musl
runner: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
runner: macos-15-intel
cross: false
- target: aarch64-apple-darwin
runner: macos-15
cross: false
- target: x86_64-pc-windows-msvc
runner: windows-latest
cross: false
steps:
- uses: actions/checkout@v4
with:
ref: ${{ needs.release.outputs.tag }}
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo apt-get update && sudo apt-get install -y musl-tools
- name: Install cross
if: matrix.cross
run: cargo install cross --locked
- name: Build
shell: bash
run: |
BIN_NAME="${{ github.event.repository.name }}"
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }}
else
cargo build --release --target ${{ matrix.target }}
fi
- name: Upload to release
shell: bash
run: |
BIN_NAME="${{ github.event.repository.name }}"
TAG="${{ needs.release.outputs.tag }}"
if [ -f "target/${{ matrix.target }}/release/${BIN_NAME}.exe" ]; then
cp "target/${{ matrix.target }}/release/${BIN_NAME}.exe" "${BIN_NAME}-${{ matrix.target }}.exe"
gh release upload "$TAG" "${BIN_NAME}-${{ matrix.target }}.exe" --clobber
else
cp "target/${{ matrix.target }}/release/${BIN_NAME}" "${BIN_NAME}-${{ matrix.target }}"
chmod +x "${BIN_NAME}-${{ matrix.target }}"
gh release upload "$TAG" "${BIN_NAME}-${{ matrix.target }}" --clobber
fi
# Uncomment for crates.io publishing:
# publish:
# needs: release
# if: needs.release.outputs.released == 'true'
# runs-on: ubuntu-latest
# permissions:
# id-token: write
# contents: read
# steps:
# - uses: actions/checkout@v4
# with:
# ref: ${{ needs.release.outputs.tag }}
# - uses: dtolnay/rust-toolchain@stable
# - uses: Swatinem/rust-cache@v2
# - id: auth
# uses: rust-lang/crates-io-auth-action@v1
# - name: Publish
# env:
# CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
# run: cargo publish --allow-dirty
sr.yaml
See sync-release skill for full sr.yaml reference.
git:
tag_prefix: "v"
floating_tag: true
commit:
types:
minor: [feat]
patch: [fix, perf, refactor]
none: [docs, revert, chore, ci, test, build, style]
changelog:
file: CHANGELOG.md
packages:
- path: .
version_files:
- Cargo.toml
stage_files:
- Cargo.lock
publish:
type: cargo
workspace: true # iterate [workspace].members in declaration order
For workspaces, sr auto-discovers member Cargo.toml files from the root. List [workspace].members in dependency order (leaf crates first) so cargo publish reaches crates.io in the right order.
Common Commands
Cargo is the native build system:
cargo fmt --all # format
cargo clippy --workspace -- -D warnings # lint
cargo test --workspace # test
cargo build --release # build
cargo run -- <args> # run
Set up git hooks during init: git config core.hooksPath .githooks && cargo fetch
Gotchas
- Always use
--workspacefor clippy/test/check in multi-crate repos crossis only needed for ARM targets (aarch64-*); x86 musl just needsmusl-toolsmacos-15-intelfor x86_64 Darwin,macos-15for aarch64 Darwin- List
[workspace].membersin dependency order (leaf crates first) -- the cargo publisher iterates in that order, and crates.io index propagation (~30-60s) is handled via retry inside sr - Use
-p <crate-name>forcargo buildwhen the workspace has multiple binaries (publish is handled by the typed publisher) cancel-in-progress: falseon release workflow to prevent partial releases
Workspace Member Files
Each publishable workspace member (crates/<name>/) must have:
| File | Content |
|---|---|
LICENSE | Copy of root LICENSE |
README.md | Crate name heading, description from Cargo.toml, link to workspace repo |
When scaffolding a new workspace member, generate both files. See scaffold-project for the README template.
Skip examples/ members -- they are not published to crates.io.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.