一键导入
setup
Bootstrap the Rust dev environment — verify rustup, toolchain, rust-analyzer, cargo tools, env vars.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Bootstrap the Rust dev environment — verify rustup, toolchain, rust-analyzer, cargo tools, env vars.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | setup |
| description | Bootstrap the Rust dev environment — verify rustup, toolchain, rust-analyzer, cargo tools, env vars. |
Bootstrap (or re-verify) the development environment. Idempotent — safe to re-run.
rustup is installedrustup --version
If missing: stop and tell the user to install rustup from https://rustup.rs/. Do not attempt to install it without asking.
rustup show active-toolchain
If a rust-toolchain.toml file exists in the project root, verify the pinned toolchain is installed:
rustup toolchain list
If the pinned toolchain is missing, install it:
rustup toolchain install "$(grep 'channel' rust-toolchain.toml | cut -d'"' -f2)"
rust-analyzer is availablerustup component list --installed | grep rust-analyzer
If not installed, add it:
rustup component add rust-analyzer
Also check that the binary is reachable:
rust-analyzer --version
If rust-analyzer is not found even after rustup component add, warn the user — it may need to be installed as a standalone binary or via their editor's extension.
Check for and install if missing:
# rustfmt
rustup component list --installed | grep rustfmt || rustup component add rustfmt
# clippy
rustup component list --installed | grep clippy || rustup component add clippy
# llvm-cov (coverage)
cargo llvm-cov --version 2>/dev/null || cargo install cargo-llvm-cov
rustup component list --installed | grep llvm-tools || rustup component add llvm-tools-preview
rust-analyzer-mcp is installedrust-analyzer-mcp is the MCP server that exposes rust-analyzer to Claude Code. Check for it:
rust-analyzer-mcp --version 2>/dev/null || cargo install rust-analyzer-mcp
Then verify .mcp.json exists at the project root and contains the server entry. Read the file if it exists:
cat .mcp.json 2>/dev/null
If .mcp.json is missing or does not contain a rust-analyzer entry under mcpServers, create or merge it:
{
"mcpServers": {
"rust-analyzer": {
"command": "rust-analyzer-mcp"
}
}
}
If .mcp.json already exists with other servers, add the rust-analyzer entry alongside them — do not overwrite the whole file. Use jq if available:
jq '.mcpServers["rust-analyzer"] = {"command": "rust-analyzer-mcp"}' .mcp.json > .mcp.json.tmp \
&& mv .mcp.json.tmp .mcp.json
Note: .mcp.json should be committed to the repo so every contributor and CI run picks up the same MCP servers automatically.
cargo checkcargo check
This verifies the project compiles without producing build artefacts. If it fails, report the compiler error verbatim — do not attempt to fix compilation errors during setup.
.env exists (if .env-template is present)test -f .env || (test -f .env-template && cp .env-template .env)
If .env was just created, enumerate the keys the user needs to fill in (read .env-template).
Print a short status block:
Setup status
rustup : <version>
toolchain : <active toolchain>
rust-analyzer : <version | missing>
rustfmt : <installed | missing>
clippy : <installed | missing>
cargo-llvm-cov : <version | missing>
rust-analyzer-mcp : <version | missing>
.mcp.json : <present | created | missing rust-analyzer entry>
cargo check : <ok | FAILED>
.env : <present | created from template | not applicable>
RUST_LOG : <set | unset>
Keep it tight — one line per item. If everything is green, end with "Ready." If anything is yellow/red, list the next action explicitly.
Review a pull request or pending changes. Performs a focused code review against the current branch's diff (or staged diff if invoked pre-commit), surfacing correctness bugs, missing tests, style violations, and unclear naming. Use when the user asks to "review this", "review the PR", "code review", or before commits/PRs.
Complete a security review of pending changes on the current branch. Focuses on injection, authn/authz, secrets, SSRF, deserialisation, insecure defaults, and supply-chain risk. Use when the user asks to "security review", "security audit", "check for vulns", or before raising a PR.
Pre-commit gate (fmt + clippy + test) then create a conventional commit with explicit file staging.
Create or update ARCHITECTURE.md with system components, data flows, and ADRs
Format Rust code with rustfmt and report what changed.
Full TDD loop — plan, branch, write code + tests, fmt, clippy, test, review, commit.