cue-ai 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +757 -110
- package/package.json +5 -5
- package/profiles/README.md +12 -12
- package/profiles/SCHEMA.md +31 -3
- package/profiles/_cache/README.md +1 -1
- package/profiles/_types.ts +26 -1
- package/profiles/backend/profile.yaml +1 -0
- package/profiles/career/profile.yaml +13 -0
- package/profiles/core/profile.yaml +76 -9
- package/profiles/creative-media/README.md +1 -1
- package/profiles/cybersecurity/profile.yaml +779 -756
- package/profiles/ecc/profile.yaml +39 -0
- package/profiles/event-design/profile.yaml +10 -0
- package/profiles/fleet-control/README.md +1 -1
- package/profiles/frontend/profile.yaml +14 -0
- package/profiles/full/README.md +1 -1
- package/profiles/go-api/profile.yaml +1 -0
- package/profiles/marketing/profile.yaml +12 -1
- package/profiles/predict-everything/profile.yaml +9 -0
- package/profiles/rust/profile.yaml +22 -3
- package/profiles/rust-cli/profile.yaml +14 -0
- package/profiles/rust-core/profile.yaml +35 -0
- package/profiles/rust-embedded/profile.yaml +11 -0
- package/profiles/rust-ffi/profile.yaml +13 -0
- package/profiles/rust-game/profile.yaml +11 -0
- package/profiles/rust-wasm/profile.yaml +11 -0
- package/profiles/rust-web/profile.yaml +17 -0
- package/profiles/schema.json +44 -4
- package/profiles/trendradar/profile.yaml +11 -0
- package/resources/mcps/README.md +39 -164
- package/resources/mcps/configs/claude.sanitized.json +55 -0
- package/resources/mcps/configs/claude_runtime.sanitized.json +47 -0
- package/resources/skills/README.md +70 -113
- package/resources/skills/skills/event-design/wedding-invitations/SKILL.md +43 -0
- package/resources/skills/skills/meta/acpx/SKILL.md +78 -0
- package/resources/skills/skills/meta/cue-usage/SKILL.md +24 -0
- package/resources/skills/skills/meta/profile-fit-monitor/SKILL.md +24 -0
- package/resources/skills/skills/predict-everything/mirofish/SKILL.md +75 -0
- package/resources/skills/skills/research/trendradar/SKILL.md +88 -0
- package/resources/skills/skills/rust/async-tokio/SKILL.md +27 -0
- package/resources/skills/skills/rust/axum-api/SKILL.md +38 -0
- package/resources/skills/skills/rust/bacon-watch/SKILL.md +24 -0
- package/resources/skills/skills/rust/bevy/SKILL.md +43 -0
- package/resources/skills/skills/rust/bindgen/SKILL.md +39 -0
- package/resources/skills/skills/rust/cargo-audit/SKILL.md +26 -0
- package/resources/skills/skills/rust/cargo-basics/SKILL.md +28 -0
- package/resources/skills/skills/rust/cargo-chef/SKILL.md +43 -0
- package/resources/skills/skills/rust/cargo-edit/SKILL.md +26 -0
- package/resources/skills/skills/rust/cargo-expand/SKILL.md +24 -0
- package/resources/skills/skills/rust/cargo-flamegraph/SKILL.md +26 -0
- package/resources/skills/skills/rust/cargo-fuzz/SKILL.md +34 -0
- package/resources/skills/skills/rust/cargo-hack/SKILL.md +26 -0
- package/resources/skills/skills/rust/cargo-msrv/SKILL.md +30 -0
- package/resources/skills/skills/rust/cargo-mutants/SKILL.md +26 -0
- package/resources/skills/skills/rust/cargo-nextest/SKILL.md +24 -0
- package/resources/skills/skills/rust/cargo-readme/SKILL.md +36 -0
- package/resources/skills/skills/rust/cbindgen/SKILL.md +41 -0
- package/resources/skills/skills/rust/chisel-tool/SKILL.md +32 -0
- package/resources/skills/skills/rust/clap-cli/SKILL.md +44 -0
- package/resources/skills/skills/rust/clippy-and-fmt/SKILL.md +25 -0
- package/resources/skills/skills/rust/cross-compile/SKILL.md +26 -0
- package/resources/skills/skills/rust/embedded/SKILL.md +33 -0
- package/resources/skills/skills/rust/error-handling/SKILL.md +32 -0
- package/resources/skills/skills/rust/just-runner/SKILL.md +26 -0
- package/resources/skills/skills/rust/mdbook/SKILL.md +25 -0
- package/resources/skills/skills/rust/napi-rs/SKILL.md +32 -0
- package/resources/skills/skills/rust/no-std/SKILL.md +42 -0
- package/resources/skills/skills/rust/property-testing/SKILL.md +35 -0
- package/resources/skills/skills/rust/pyo3/SKILL.md +40 -0
- package/resources/skills/skills/rust/ratatui-tui/SKILL.md +36 -0
- package/resources/skills/skills/rust/release-plz/SKILL.md +27 -0
- package/resources/skills/skills/rust/reqwest/SKILL.md +37 -0
- package/resources/skills/skills/rust/sccache/SKILL.md +28 -0
- package/resources/skills/skills/rust/serde/SKILL.md +30 -0
- package/resources/skills/skills/rust/snapshot-testing/SKILL.md +30 -0
- package/resources/skills/skills/rust/sqlx-cli/SKILL.md +33 -0
- package/resources/skills/skills/rust/tracing/SKILL.md +36 -0
- package/resources/skills/skills/rust/typos-spellcheck/SKILL.md +31 -0
- package/resources/skills/skills/rust/uniffi/SKILL.md +38 -0
- package/resources/skills/skills/rust/wasm-rust/SKILL.md +27 -0
- package/resources/skills/skills/security/agentshield/SKILL.md +119 -0
- package/src/commands/_index.ts +47 -3
- package/src/commands/cli.test.ts +192 -0
- package/src/commands/cli.ts +303 -0
- package/src/commands/current.ts +1 -1
- package/src/commands/debug.test.ts +62 -0
- package/src/commands/debug.ts +212 -0
- package/src/commands/discover.scoring.test.ts +216 -0
- package/src/commands/discover.test.ts +145 -0
- package/src/commands/discover.ts +2618 -0
- package/src/commands/eval-behavior.test.ts +56 -0
- package/src/commands/eval-behavior.ts +189 -0
- package/src/commands/eval.test.ts +102 -0
- package/src/commands/eval.ts +348 -0
- package/src/commands/evolve.ts +291 -0
- package/src/commands/failures.test.ts +78 -0
- package/src/commands/failures.ts +393 -0
- package/src/commands/feedback.ts +219 -0
- package/src/commands/init.ts +26 -0
- package/src/commands/launch.e2e.test.ts +9 -1
- package/src/commands/launch.ts +174 -11
- package/src/commands/lint-skill.ts +157 -0
- package/src/commands/marketplace.ts +763 -2
- package/src/commands/new.ts +1 -1
- package/src/commands/optimizer.ts +92 -28
- package/src/commands/profile-draft-skill.test.ts +96 -0
- package/src/commands/profile-draft-skill.ts +287 -0
- package/src/commands/profile-evolve.test.ts +126 -0
- package/src/commands/profile-evolve.ts +0 -0
- package/src/commands/profile-suggest.ts +223 -0
- package/src/commands/profile.ts +41 -0
- package/src/commands/quick.ts +2 -17
- package/src/commands/scan.ts +2 -2
- package/src/commands/score.ts +1 -1
- package/src/commands/share.ts +1 -1
- package/src/commands/sources.ts +2 -2
- package/src/commands/submit-profile.ts +262 -0
- package/src/commands/upgrade.ts +1 -1
- package/src/commands/use.ts +35 -5
- package/src/commands/validate.ts +1 -1
- package/src/index.ts +66 -0
- package/src/lib/analytics.ts +48 -2
- package/src/lib/claude-binary.ts +39 -0
- package/src/lib/cli-extractor.ts +77 -0
- package/src/lib/cluster-skills.test.ts +268 -0
- package/src/lib/cluster-skills.ts +290 -0
- package/src/lib/credentials-sync.test.ts +208 -0
- package/src/lib/credentials-sync.ts +205 -0
- package/src/lib/mcp-materializer.test.ts +1 -1
- package/src/lib/persona-playbooks.test.ts +111 -0
- package/src/lib/pr-poster.test.ts +243 -0
- package/src/lib/pr-poster.ts +285 -0
- package/src/lib/pr-throttle.test.ts +148 -0
- package/src/lib/pr-throttle.ts +209 -0
- package/src/lib/profile-generator.test.ts +1 -1
- package/src/lib/profile-generator.ts +2 -2
- package/src/lib/profile-linter.test.ts +6 -3
- package/src/lib/profile-linter.ts +71 -8
- package/src/lib/profile-loader.test.ts +1 -1
- package/src/lib/profile-loader.ts +16 -0
- package/src/lib/resolver-local.test.ts +1 -1
- package/src/lib/resolver-npx.test.ts +76 -1
- package/src/lib/resolver-npx.ts +35 -3
- package/src/lib/resolver-plugins.test.ts +1 -1
- package/src/lib/runtime-materializer.test.ts +191 -7
- package/src/lib/runtime-materializer.ts +310 -42
- package/src/lib/scan-plugins.test.ts +1 -1
- package/src/lib/skill-linter.test.ts +174 -0
- package/src/lib/skill-linter.ts +507 -0
- package/src/lib/skill-subset.test.ts +95 -0
- package/src/lib/skill-subset.ts +166 -0
- package/src/lib/star-prompt.ts +1 -1
- package/src/lib/uvx-installer.test.ts +229 -0
- package/src/lib/uvx-installer.ts +278 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: axum-api
|
|
3
|
+
description: Use when building an HTTP API or web service in Rust. Covers axum (recommended), with notes on actix-web and rocket. Extractors, layers, error types, OpenAPI.
|
|
4
|
+
allowed-tools: Bash(cargo:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# axum — the standard Rust web framework
|
|
8
|
+
|
|
9
|
+
Built on `hyper` + `tower`. Tokio-native. Used by Discord, Cloudflare, etc.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **Minimum router**:
|
|
13
|
+
```rust
|
|
14
|
+
let app = Router::new()
|
|
15
|
+
.route("/users/:id", get(get_user))
|
|
16
|
+
.route("/users", post(create_user))
|
|
17
|
+
.with_state(app_state);
|
|
18
|
+
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await?;
|
|
19
|
+
axum::serve(listener, app).await?;
|
|
20
|
+
```
|
|
21
|
+
- **Extractors** (extract from request): `Path<T>`, `Query<T>`, `Json<T>`, `State<S>`, `Extension<T>`, custom `FromRequestParts`
|
|
22
|
+
- **Responses**: return any `IntoResponse` — `Json<T>`, `(StatusCode, body)`, custom error types
|
|
23
|
+
- **Error type**: define one app-wide `AppError`; impl `IntoResponse` mapping variants to status codes
|
|
24
|
+
- **Middleware (layers)**: `.layer(TraceLayer::new_for_http())` for logging, `.layer(CorsLayer::permissive())`, custom via `tower::Service`
|
|
25
|
+
- **Shared state**: `Router::with_state(state)` then `State(s): State<AppState>` extractor
|
|
26
|
+
- **WebSocket**: `WebSocketUpgrade` extractor
|
|
27
|
+
- **OpenAPI**: `utoipa` + `utoipa-swagger-ui` to auto-gen docs from `#[derive(ToSchema)]` + `#[utoipa::path]`
|
|
28
|
+
- **Alternatives**: `actix-web` (older, fast, actor-flavored), `rocket` (macro-heavy, less async-idiomatic)
|
|
29
|
+
|
|
30
|
+
## Prerequisites
|
|
31
|
+
- cargo
|
|
32
|
+
- crates: `axum`, `tokio = { features = ["full"] }`, `tower-http`, `serde`
|
|
33
|
+
|
|
34
|
+
## Notes
|
|
35
|
+
- Always wrap with `TraceLayer` + a tracing subscriber — request logs cost ~zero and save days of debugging.
|
|
36
|
+
- For >50 routes, split into modules each returning a `Router<AppState>` and `.merge()` them in `main`.
|
|
37
|
+
- Don't manually parse `Authorization` headers in every handler — write a custom extractor once.
|
|
38
|
+
- Health/readiness endpoints belong on a separate `Router` mounted unconditionally (no auth middleware).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bacon-watch
|
|
3
|
+
description: Use when iterating on Rust code and wanting auto-rerun on save. Covers bacon (TUI) and cargo-watch (simpler scripted loop).
|
|
4
|
+
allowed-tools: Bash(bacon:*), Bash(cargo:*), Bash(cargo-watch:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# bacon & cargo-watch
|
|
8
|
+
|
|
9
|
+
Live feedback while you code.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- TUI with split panes: `bacon` (defaults to check) · `bacon clippy` · `bacon test`
|
|
13
|
+
- Per-project jobs: edit `bacon.toml` to define jobs
|
|
14
|
+
- One-shot loop: `cargo watch -x check` · chain: `cargo watch -x check -x test`
|
|
15
|
+
- On file change run any cmd: `cargo watch -s "cargo run -- --foo"`
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
- bacon (`cargo install --locked bacon`)
|
|
19
|
+
- cargo-watch (`cargo install cargo-watch --locked`)
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
- bacon's TUI handles long output better; cargo-watch is better when you want a one-line scripted loop.
|
|
23
|
+
- Bacon's `--headless` mode pipes to stdout — useful inside tmux/editor panes.
|
|
24
|
+
- Use bacon for active development; reach for cargo-watch only when you need to compose with non-cargo commands.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bevy
|
|
3
|
+
description: Use when building a game or interactive simulation in Rust with the Bevy engine — ECS-first, data-driven, hot-reloading, cross-platform (desktop + wasm).
|
|
4
|
+
allowed-tools: Bash(cargo:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Bevy — Rust game engine
|
|
8
|
+
|
|
9
|
+
Entity-Component-System architecture, Rust-native, batteries-included (2D + 3D + UI + audio + input).
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **Setup**: `bevy = "0.14"` — pin a version, Bevy churns fast and 0.x bumps are breaking
|
|
13
|
+
- **Hello triangle**:
|
|
14
|
+
```rust
|
|
15
|
+
use bevy::prelude::*;
|
|
16
|
+
fn main() {
|
|
17
|
+
App::new()
|
|
18
|
+
.add_plugins(DefaultPlugins)
|
|
19
|
+
.add_systems(Startup, setup)
|
|
20
|
+
.add_systems(Update, move_things)
|
|
21
|
+
.run();
|
|
22
|
+
}
|
|
23
|
+
fn setup(mut cmd: Commands) { cmd.spawn(Camera2dBundle::default()); }
|
|
24
|
+
fn move_things(mut q: Query<&mut Transform, With<Player>>, time: Res<Time>) { /* ... */ }
|
|
25
|
+
```
|
|
26
|
+
- **Spawn entities**: `commands.spawn((MeshBundle { ... }, Velocity(v), Player));` — tuples of components
|
|
27
|
+
- **Query data**: `Query<(&mut Transform, &Velocity), With<Player>>` — typed iteration over matching entities
|
|
28
|
+
- **Resources**: globally-shared state via `Res<T>` / `ResMut<T>`
|
|
29
|
+
- **Events**: `EventWriter<MyEvent>` / `EventReader<MyEvent>` for decoupled comms
|
|
30
|
+
- **States / schedules**: `add_systems(Update, my_sys.run_if(in_state(GameState::Playing)))`
|
|
31
|
+
- **Hot reload assets**: `bevy = { features = ["file_watcher"] }` — change PNGs without rebuilding
|
|
32
|
+
|
|
33
|
+
## Prerequisites
|
|
34
|
+
- cargo
|
|
35
|
+
- Dev deps for fast iterative builds: `[profile.dev] opt-level = 1` plus `[profile.dev.package."*"] opt-level = 3`
|
|
36
|
+
- On Linux: `apt install libwayland-dev libxkbcommon-dev libudev-dev libasound2-dev` (winit + audio)
|
|
37
|
+
|
|
38
|
+
## Notes
|
|
39
|
+
- Bevy releases break things. Read the migration guide before bumping minor versions.
|
|
40
|
+
- For WASM target, use `cargo run --target wasm32-unknown-unknown` with `trunk` or `wasm-server-runner` (see `rust/wasm-rust` skill).
|
|
41
|
+
- ECS thinking takes time — avoid global mutable state and reach for components/resources instead.
|
|
42
|
+
- Ecosystem crates (`bevy_egui`, `bevy_rapier`, `leafwing-input-manager`) cover UI, physics, input remapping respectively.
|
|
43
|
+
- Alternative engines: `macroquad` (simpler, immediate-mode), `fyrox` (scene-based, GUI editor).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: bindgen
|
|
3
|
+
description: Use when calling C libraries from Rust — auto-generate FFI signatures from C headers instead of hand-typing extern blocks.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(bindgen:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# bindgen — C → Rust FFI
|
|
8
|
+
|
|
9
|
+
Reads C headers via libclang, emits `extern "C" { ... }` blocks + struct layouts.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **One-off generation**:
|
|
13
|
+
```sh
|
|
14
|
+
bindgen wrapper.h -o src/bindings.rs --allowlist-function 'foo_.*' --allowlist-type 'Foo.*'
|
|
15
|
+
```
|
|
16
|
+
- **Build-script integration** (regenerates on header change):
|
|
17
|
+
```rust
|
|
18
|
+
// build.rs
|
|
19
|
+
fn main() {
|
|
20
|
+
println!("cargo:rustc-link-lib=mylib");
|
|
21
|
+
let bindings = bindgen::Builder::default()
|
|
22
|
+
.header("wrapper.h")
|
|
23
|
+
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
|
24
|
+
.generate().unwrap();
|
|
25
|
+
bindings.write_to_file(std::path::PathBuf::from(std::env::var("OUT_DIR").unwrap()).join("bindings.rs")).unwrap();
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
Then `include!(concat!(env!("OUT_DIR"), "/bindings.rs"));` in your lib.rs.
|
|
29
|
+
- **Vendored vs system libs**: pair with `pkg-config` crate or `cmake` crate to find/build the underlying C library.
|
|
30
|
+
|
|
31
|
+
## Prerequisites
|
|
32
|
+
- bindgen CLI (or `bindgen` build-dep)
|
|
33
|
+
- `libclang` (`apt install libclang-dev` / `brew install llvm` + `LIBCLANG_PATH`)
|
|
34
|
+
|
|
35
|
+
## Notes
|
|
36
|
+
- Always wrap unsafe FFI in a safe Rust API in the same crate — downstream users should never write `unsafe { ffi::* }`.
|
|
37
|
+
- Use `--allowlist-*` aggressively. Generating bindings for ALL of `stdio.h` produces hundreds of unused items.
|
|
38
|
+
- For C++ libraries: bindgen has partial support; for serious C++ interop use `cxx` crate (different model).
|
|
39
|
+
- Pre-built `*-sys` crates already exist for most popular C libs (e.g. `libgit2-sys`, `libz-sys`) — check crates.io before rolling your own.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-audit
|
|
3
|
+
description: Use when checking a Rust project for known vulnerabilities, license violations, or supply-chain risk. Covers cargo-audit, cargo-deny, cargo-geiger, cargo-vet, cargo-crev.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-audit:*), Bash(cargo-deny:*), Bash(cargo-geiger:*), Bash(cargo-vet:*), Bash(cargo-crev:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rust Security Suite
|
|
8
|
+
|
|
9
|
+
Supply-chain and unsafe-code auditing.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- Vuln scan against RustSec advisory DB: `cargo audit`
|
|
13
|
+
- Hard-fail in CI: `cargo audit --deny warnings`
|
|
14
|
+
- Policy check (licenses, advisories, dup versions, bans): `cargo deny init` then `cargo deny check`
|
|
15
|
+
- Count unsafe in deps: `cargo geiger`
|
|
16
|
+
- Supply-chain trust audit (Mozilla): `cargo vet init` then `cargo vet`
|
|
17
|
+
- Crowd-sourced review trust web: `cargo crev review <crate>`
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
- cargo-audit, cargo-deny, cargo-geiger, cargo-vet, cargo-crev (all via `cargo install --locked`)
|
|
21
|
+
|
|
22
|
+
## Notes
|
|
23
|
+
- cargo-audit + cargo-deny together cover 90% of real-world supply-chain needs. Start with those two.
|
|
24
|
+
- Wire `cargo audit` into CI as a separate job — advisories drop continuously, so a pinned `Cargo.lock` can become unsafe overnight without a code change.
|
|
25
|
+
- cargo-deny config lives in `deny.toml`. Use `[advisories]` and `[licenses]` first; `[bans]` and `[sources]` are advanced.
|
|
26
|
+
- cargo-geiger output is informational, not gating — high unsafe counts in crates like `tokio` are expected.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-basics
|
|
3
|
+
description: Use when starting, building, running, testing, or generating docs for a Rust crate. Covers cargo new/init/check/build/run/test/doc and workspace scoping.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(rustc:*), Bash(rustup:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Cargo Basics
|
|
8
|
+
|
|
9
|
+
Core cargo workflow. Use before reaching for anything fancier.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- New crate: `cargo new --bin <name>` or `cargo new --lib <name>`
|
|
13
|
+
- Inside an existing source tree: `cargo init`
|
|
14
|
+
- Type-check only (fast inner loop): `cargo check`
|
|
15
|
+
- Build: `cargo build` (debug) · `cargo build --release` (optimized)
|
|
16
|
+
- Run binary: `cargo run` · pass args: `cargo run -- --flag value`
|
|
17
|
+
- Test: `cargo test` · filter: `cargo test <substring>` · show prints: `cargo test -- --nocapture`
|
|
18
|
+
- Docs: `cargo doc --open --no-deps`
|
|
19
|
+
- Workspace member scope: `cargo build -p <member>`
|
|
20
|
+
- Pick a toolchain: `cargo +nightly build` · default per project via `rust-toolchain.toml`
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
- rustup (installs cargo, rustc, clippy, rustfmt)
|
|
24
|
+
|
|
25
|
+
## Notes
|
|
26
|
+
- `cargo check` is ~3x faster than `cargo build`. Loop on check, build only when running.
|
|
27
|
+
- `--release` strips debug + enables optimizations — slow to compile, much faster runtime. Don't use it for tests unless benchmarking.
|
|
28
|
+
- `Cargo.lock` should be committed for binaries, ignored for library crates published to crates.io.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-chef
|
|
3
|
+
description: Use when building a Docker image of a Rust app and the dep compile step keeps invalidating cache. Splits dep compilation into a cacheable layer.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-chef:*), Bash(docker:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-chef — Docker layer caching for Rust
|
|
8
|
+
|
|
9
|
+
Without it: changing one line of your app re-downloads + recompiles all deps because Cargo.toml/lock layer changes. With it: deps live in their own cached layer.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
Multi-stage Dockerfile pattern:
|
|
14
|
+
|
|
15
|
+
```dockerfile
|
|
16
|
+
FROM rust:1-slim AS chef
|
|
17
|
+
RUN cargo install cargo-chef --locked
|
|
18
|
+
WORKDIR /app
|
|
19
|
+
|
|
20
|
+
FROM chef AS planner
|
|
21
|
+
COPY . .
|
|
22
|
+
RUN cargo chef prepare --recipe-path recipe.json
|
|
23
|
+
|
|
24
|
+
FROM chef AS builder
|
|
25
|
+
COPY --from=planner /app/recipe.json recipe.json
|
|
26
|
+
RUN cargo chef cook --release --recipe-path recipe.json # cached if recipe.json unchanged
|
|
27
|
+
COPY . .
|
|
28
|
+
RUN cargo build --release
|
|
29
|
+
|
|
30
|
+
FROM debian:bookworm-slim AS runtime
|
|
31
|
+
COPY --from=builder /app/target/release/myapp /usr/local/bin/
|
|
32
|
+
ENTRYPOINT ["/usr/local/bin/myapp"]
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Prerequisites
|
|
36
|
+
- cargo-chef (used inside the build image)
|
|
37
|
+
- Docker / Podman with BuildKit
|
|
38
|
+
|
|
39
|
+
## Notes
|
|
40
|
+
- `recipe.json` is deterministic from Cargo.toml/lock — only changes when deps change, which is what makes the cache layer durable.
|
|
41
|
+
- Pairs well with `sccache` set via `RUSTC_WRAPPER=sccache` in the builder stage for second-level caching across machines.
|
|
42
|
+
- For smallest runtime images, switch the final stage to `gcr.io/distroless/cc-debian12` (static binaries can use `scratch`).
|
|
43
|
+
- Doesn't speed up `cargo build` locally — it's purely a Docker layer caching pattern.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-edit
|
|
3
|
+
description: Use when adding, removing, or upgrading Rust dependencies, or auditing unused deps. Covers cargo add/rm/upgrade, cargo-outdated, cargo-machete, cargo-udeps.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-edit:*), Bash(cargo-outdated:*), Bash(cargo-machete:*), Bash(cargo-udeps:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Cargo Dependency Tooling
|
|
8
|
+
|
|
9
|
+
Manage Cargo.toml without hand-editing.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- Add: `cargo add serde --features derive`
|
|
13
|
+
- Remove: `cargo remove serde`
|
|
14
|
+
- Upgrade everything compatibly: `cargo update`
|
|
15
|
+
- Upgrade past semver: `cargo upgrade` (needs cargo-edit) — bumps Cargo.toml itself
|
|
16
|
+
- See what has a newer version: `cargo outdated --root-deps-only`
|
|
17
|
+
- Find unused deps (fast): `cargo machete`
|
|
18
|
+
- Find unused deps (thorough, needs nightly): `cargo +nightly udeps`
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
- cargo-edit, cargo-outdated, cargo-machete, cargo-udeps
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
- `cargo add/remove` are built into cargo since 1.62, but `cargo upgrade` still needs cargo-edit.
|
|
25
|
+
- `cargo machete` is fast and catches the common case; reach for udeps only when machete misses something (it's nightly-only and slower).
|
|
26
|
+
- `cargo outdated --root-deps-only` filters out transitives — usually what you want.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-expand
|
|
3
|
+
description: Use when debugging Rust macros (proc-macros, derive, declarative) — see what code the macro actually generates.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-expand:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-expand
|
|
8
|
+
|
|
9
|
+
See the post-macro source. Indispensable when a derive misbehaves.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- Expand whole crate: `cargo expand`
|
|
13
|
+
- One module: `cargo expand path::to::module`
|
|
14
|
+
- One test: `cargo expand --test <name>`
|
|
15
|
+
- Filter to a function/struct: `cargo expand path::to::ItemName`
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
- cargo-expand
|
|
19
|
+
- Nightly toolchain (cargo-expand pins one automatically)
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
- Output is full Rust — pipe through `bat -l rust` for highlighting.
|
|
23
|
+
- When a `#[derive(Serialize)]` produces weird output, expand and read the generated `impl`. The compiler error suddenly makes sense.
|
|
24
|
+
- Don't commit expanded output — it's a debugging tool, not a refactor target.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-flamegraph
|
|
3
|
+
description: Use when profiling Rust performance, benchmarking, or analysing binary size. Covers cargo-flamegraph, cargo-criterion, cargo-bloat.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-flamegraph:*), Bash(cargo-criterion:*), Bash(cargo-bloat:*), Bash(perf:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rust Performance Toolkit
|
|
8
|
+
|
|
9
|
+
CPU profiling, benchmark frontend, binary-size analysis.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- Flamegraph of a binary: `cargo flamegraph --release` (opens svg)
|
|
13
|
+
- Flamegraph of a test: `cargo flamegraph --test <name>`
|
|
14
|
+
- Criterion benches with nicer output: `cargo criterion`
|
|
15
|
+
- What takes space in the release binary: `cargo bloat --release --crates`
|
|
16
|
+
- Per-function bloat: `cargo bloat --release -n 30`
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
- cargo-flamegraph (`cargo install flamegraph --locked`)
|
|
20
|
+
- cargo-criterion, cargo-bloat
|
|
21
|
+
- Linux: `linux-tools-common` + `linux-tools-generic` for `perf`. macOS: dtrace (root).
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
- Always profile `--release` — debug builds are useless for perf.
|
|
25
|
+
- Add `[profile.release] debug = true` to Cargo.toml so flamegraphs have symbols (doesn't slow runtime, just enlarges the binary).
|
|
26
|
+
- Criterion benches need the `criterion` crate as a dev-dep and `[[bench]]` entries with `harness = false`.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-fuzz
|
|
3
|
+
description: Use when fuzzing parsers, deserializers, FFI boundaries, or any code that takes untrusted bytes. libFuzzer integration via cargo-fuzz.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-fuzz:*), Bash(rustup:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-fuzz — libFuzzer for Rust
|
|
8
|
+
|
|
9
|
+
Coverage-guided fuzzing. Often finds panics + UB within minutes on parser code.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **Init in a crate**: `cargo fuzz init`
|
|
13
|
+
- **Add a target**: `cargo fuzz add my_parser` — generates `fuzz/fuzz_targets/my_parser.rs`
|
|
14
|
+
- **Target body**:
|
|
15
|
+
```rust
|
|
16
|
+
libfuzzer_sys::fuzz_target!(|data: &[u8]| {
|
|
17
|
+
let _ = my_crate::parse(data); // must not panic
|
|
18
|
+
});
|
|
19
|
+
```
|
|
20
|
+
- **Run** (requires nightly): `cargo +nightly fuzz run my_parser`
|
|
21
|
+
- **Reproduce a crash**: `cargo +nightly fuzz run my_parser fuzz/artifacts/my_parser/crash-*`
|
|
22
|
+
- **Minimize crashes**: `cargo +nightly fuzz tmin my_parser <artifact>`
|
|
23
|
+
- **Seed corpus**: drop interesting inputs in `fuzz/corpus/my_parser/`
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
- nightly: `rustup install nightly`
|
|
27
|
+
- cargo-fuzz
|
|
28
|
+
- libFuzzer ships with nightly's compiler-rt — no extra package on Linux/macOS
|
|
29
|
+
|
|
30
|
+
## Notes
|
|
31
|
+
- Run continuously in the background, not as a unit test — fuzzing is a long-running search.
|
|
32
|
+
- Pair with `arbitrary` crate so target bodies parse `&[u8]` into structured types: `fuzz_target!(|input: MyStruct| ...)` via `#[derive(Arbitrary)]`.
|
|
33
|
+
- Commit interesting corpus inputs + any minimized crashes — they accelerate the next run.
|
|
34
|
+
- For HTTP server fuzzing, look at `cargo-bolero` (multi-engine wrapper) instead.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-hack
|
|
3
|
+
description: Use when a Rust crate has multiple feature flags and you need to verify every combination compiles + tests cleanly. Catches "works on default features only" bugs.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-hack:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-hack — feature combo testing
|
|
8
|
+
|
|
9
|
+
Without it, `cargo test` only covers default features. Feature combinations are silent bombs.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **Check every feature individually**: `cargo hack check --each-feature`
|
|
13
|
+
- **Check every subset** (slow but thorough): `cargo hack check --feature-powerset`
|
|
14
|
+
- **Skip dev deps from feature analysis**: `--ignore-private`
|
|
15
|
+
- **Limit MSRV**: `cargo hack check --rust-version` (pairs with `cargo-msrv`)
|
|
16
|
+
- **Exclude expensive features**: `--exclude-features expensive,slow`
|
|
17
|
+
- **CI pattern**: `cargo hack --each-feature --no-dev-deps check`
|
|
18
|
+
|
|
19
|
+
## Prerequisites
|
|
20
|
+
- cargo-hack
|
|
21
|
+
- A `Cargo.toml` with `[features]` declared
|
|
22
|
+
|
|
23
|
+
## Notes
|
|
24
|
+
- `--feature-powerset` is N² in feature count; for crates with 6+ features, prefer `--each-feature` + manual important combos.
|
|
25
|
+
- Catches the classic "`use mod_x::Foo`" inside `#[cfg(feature = "a")]` that breaks when feature `b` isn't enabled.
|
|
26
|
+
- Wire into CI as a separate job — it's slower than the main test job but high-signal.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-msrv
|
|
3
|
+
description: Use when determining or verifying the minimum supported Rust version (MSRV) of a published crate.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-msrv:*), Bash(rustup:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-msrv
|
|
8
|
+
|
|
9
|
+
Finds the oldest stable Rust that still compiles your crate. Critical for libraries (downstream users may not be on the latest toolchain).
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **Discover MSRV**: `cargo msrv find` (binary searches over toolchains)
|
|
13
|
+
- **Verify a declared MSRV**: `cargo msrv verify` (reads `rust-version` from Cargo.toml)
|
|
14
|
+
- **Set MSRV in Cargo.toml**:
|
|
15
|
+
```toml
|
|
16
|
+
[package]
|
|
17
|
+
rust-version = "1.75"
|
|
18
|
+
```
|
|
19
|
+
- **List versions tried**: `cargo msrv list`
|
|
20
|
+
- **Per-crate in a workspace**: `cargo msrv --path crates/mylib find`
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
- cargo-msrv
|
|
24
|
+
- Multiple rustup toolchains (msrv installs them as needed)
|
|
25
|
+
|
|
26
|
+
## Notes
|
|
27
|
+
- Pair with `cargo-hack`'s `--rust-version` flag to gate feature combinations against MSRV in CI.
|
|
28
|
+
- MSRV bumps are semver-significant for many crate authors — treat as a minor (sometimes major) bump.
|
|
29
|
+
- The `rust-version` field in Cargo.toml is what `cargo verify-project` and the registry check.
|
|
30
|
+
- Use `#[cfg(rust_version = "1.80")]`-style cfg only via the `rustversion` crate — there's no built-in cfg for it.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-mutants
|
|
3
|
+
description: Use when measuring test quality — mutation testing modifies your code and checks tests catch the change. Finds "I have 90% coverage but tests assert nothing".
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-mutants:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-mutants — mutation testing
|
|
8
|
+
|
|
9
|
+
Permutes operators (`<` → `<=`, `+` → `-`, returns `Default`, etc.) then runs your tests. A mutation that survives = your tests aren't really testing it.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **First run**: `cargo mutants` (slow — runs whole test suite per mutation)
|
|
13
|
+
- **Scope to one file**: `cargo mutants -f src/parser.rs`
|
|
14
|
+
- **Skip slow tests**: `cargo mutants --test-tool=nextest -- --skip slow_`
|
|
15
|
+
- **Baseline-only (fast sanity)**: `cargo mutants --check`
|
|
16
|
+
- **In CI** (PR-scoped): `cargo mutants --in-diff <(git diff main)`
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
- cargo-mutants
|
|
20
|
+
- A passing test suite (baseline must be green or it bails)
|
|
21
|
+
|
|
22
|
+
## Notes
|
|
23
|
+
- Expect long runtimes — N_mutants × test_duration. Practical on libraries (~minutes), painful on large workspaces (hours). Use `--in-diff` in CI.
|
|
24
|
+
- "Missed" mutations point to under-tested branches; "timeout" usually means an infinite loop introduced by the mutation (safe).
|
|
25
|
+
- Pair with `cargo-nextest` (`--test-tool=nextest`) for big speedups.
|
|
26
|
+
- Skip generated code, FFI shims, and trivial newtypes via `# mutants: skip` line comment.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-nextest
|
|
3
|
+
description: Use when running Rust tests slowly with cargo test, or when CI test time hurts. Drop-in faster runner with better output, retries, and JUnit XML.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-nextest:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-nextest
|
|
8
|
+
|
|
9
|
+
Faster, prettier `cargo test` replacement. ~60% faster on most workspaces.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- Default test run: `cargo nextest run`
|
|
13
|
+
- Filter: `cargo nextest run <substring>` · by crate: `-p <crate>`
|
|
14
|
+
- Retry flaky: `cargo nextest run --retries 2`
|
|
15
|
+
- CI JUnit output: `cargo nextest run --profile ci` with `[profile.ci.junit] path = "junit.xml"` in `.config/nextest.toml`
|
|
16
|
+
- List without running: `cargo nextest list`
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
- cargo-nextest (`cargo install cargo-nextest --locked`)
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
- Does NOT run doctests — keep `cargo test --doc` in CI alongside nextest.
|
|
23
|
+
- Parallelism is per-test, not per-binary, which is the speedup source.
|
|
24
|
+
- Stable test IDs make flake tracking easy: `<crate>::<test_path>`.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cargo-readme
|
|
3
|
+
description: Use when keeping README.md in sync with lib.rs doc comments — generate the README from `//!` crate-level docs.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cargo-readme:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cargo-readme
|
|
8
|
+
|
|
9
|
+
Single source of truth: write docs in `src/lib.rs`, generate README. No drift between rustdoc and the GitHub front page.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **One-shot**: `cargo readme > README.md`
|
|
13
|
+
- **Template** (control title/badges around the generated body): `README.tpl` at repo root; reference with `{{readme}}`
|
|
14
|
+
- **CI guard**: `diff <(cargo readme) README.md` — non-zero exit blocks PR if README drifted
|
|
15
|
+
- **Workspace**: run per-crate; root README usually stays hand-written
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
- cargo-readme
|
|
19
|
+
- Crate-level docs in `src/lib.rs`:
|
|
20
|
+
```rust
|
|
21
|
+
//! # mylib
|
|
22
|
+
//!
|
|
23
|
+
//! Does the thing.
|
|
24
|
+
//!
|
|
25
|
+
//! ## Example
|
|
26
|
+
//!
|
|
27
|
+
//! ```
|
|
28
|
+
//! mylib::do_thing();
|
|
29
|
+
//! ```
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
- Code blocks in `//!` docs are tested by `cargo test --doc` — README examples stay correct.
|
|
34
|
+
- For published crates, this avoids the classic "README example doesn't compile because the API changed" bug.
|
|
35
|
+
- Alternative: `cargo-rdme` (newer, slightly different template style). `cargo-readme` is more entrenched.
|
|
36
|
+
- For workspace root READMEs that aren't per-crate, hand-edit and skip this skill.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cbindgen
|
|
3
|
+
description: Use when exposing a Rust library to C/C++ — auto-generate C headers from a Rust crate so other languages can link to it.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(cbindgen:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# cbindgen — Rust → C/C++ headers
|
|
8
|
+
|
|
9
|
+
The reverse of `bindgen`. Walks your `#[no_mangle] extern "C"` items and emits a header.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **Setup Cargo.toml**:
|
|
13
|
+
```toml
|
|
14
|
+
[lib]
|
|
15
|
+
crate-type = ["cdylib", "staticlib"]
|
|
16
|
+
```
|
|
17
|
+
- **Rust side** — annotate every exported item:
|
|
18
|
+
```rust
|
|
19
|
+
#[no_mangle]
|
|
20
|
+
pub extern "C" fn add(a: i32, b: i32) -> i32 { a + b }
|
|
21
|
+
#[repr(C)]
|
|
22
|
+
pub struct Point { x: f64, y: f64 }
|
|
23
|
+
```
|
|
24
|
+
- **Generate**: `cbindgen --config cbindgen.toml --crate mylib -o include/mylib.h`
|
|
25
|
+
- **Build-script flavor** (regenerates on every build):
|
|
26
|
+
```rust
|
|
27
|
+
// build.rs
|
|
28
|
+
let crate_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
|
|
29
|
+
cbindgen::Builder::new().with_crate(crate_dir).generate().unwrap().write_to_file("include/mylib.h");
|
|
30
|
+
```
|
|
31
|
+
- **cbindgen.toml** controls language (C or C++), include guards, namespace, type renames.
|
|
32
|
+
|
|
33
|
+
## Prerequisites
|
|
34
|
+
- cbindgen CLI (or build-dep)
|
|
35
|
+
- Rust items must be `#[no_mangle] pub extern "C"` with `#[repr(C)]` types
|
|
36
|
+
|
|
37
|
+
## Notes
|
|
38
|
+
- Only items reachable from `pub` and `extern "C"` are emitted — make sure they're not behind feature gates that aren't active at generation time.
|
|
39
|
+
- Pair with a `*.pc` (pkg-config) file or a small CMake `Find<Mylib>.cmake` so downstream C/C++ users can link cleanly.
|
|
40
|
+
- For C++-specific features (templates, namespaces), set `language = "C++"` in `cbindgen.toml`.
|
|
41
|
+
- Common pitfall: returning `String` or `Vec<T>` across FFI is UB — return `*mut c_char` / raw pointers with explicit free fns.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chisel-tool
|
|
3
|
+
description: Use when an agent needs precision file edits with minimal token overhead — patch-based, kernel-confined paths. Pointer to the upstream Chisel MCP server.
|
|
4
|
+
allowed-tools: Bash(chisel:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Chisel — agent-oriented precision file edits
|
|
8
|
+
|
|
9
|
+
[`ckanthony/Chisel`](https://github.com/ckanthony/Chisel) — Rust-powered MCP server providing token-efficient file operations:
|
|
10
|
+
|
|
11
|
+
- `patch_apply` — send unified diffs instead of whole files (~20× fewer tokens on large edits)
|
|
12
|
+
- `shell_exec` — whitelisted Unix tools (grep/sed/awk/find/cat) the model already knows
|
|
13
|
+
- Strict path confinement, symlink-aware root, atomic writes, bearer-token auth, `127.0.0.1`-only by default
|
|
14
|
+
|
|
15
|
+
## When to use
|
|
16
|
+
- Editing large files where rewriting them in full would burn context (>100 lines)
|
|
17
|
+
- Multi-file refactors where each touch is a small diff
|
|
18
|
+
- Untrusted-input agentic workflows where path confinement matters
|
|
19
|
+
|
|
20
|
+
## Install
|
|
21
|
+
- **MCP-style (recommended)**: download a `.mcpb` bundle from [releases](https://github.com/ckanthony/Chisel/releases/latest)
|
|
22
|
+
- **Binary**: `cargo install --git https://github.com/ckanthony/Chisel chisel` (or `cue cli install chisel`)
|
|
23
|
+
- **Upstream agent guide**: this profile auto-installs the canonical SKILL.md via `npx skills add ckanthony/Chisel`
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
- `chisel` binary on PATH (or run as a Docker MCP)
|
|
27
|
+
- An MCP-aware client (Claude Code, Codex, custom)
|
|
28
|
+
|
|
29
|
+
## Notes
|
|
30
|
+
- This skill is a **pointer**. The detailed agent guide is the upstream `SKILL.md` fetched into the materialized profile by cue's npx mechanism — read that one in preference to this.
|
|
31
|
+
- For pure-Rust embedding (no separate process), use `chisel-core` library directly.
|
|
32
|
+
- Pairs well with `caveman` (terse-output mode) — both target the same goal: less token bloat per turn.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clap-cli
|
|
3
|
+
description: Use when building a command-line tool in Rust. Covers clap derive (subcommands, args, env), dialoguer for prompts, indicatif for progress bars/spinners.
|
|
4
|
+
allowed-tools: Bash(cargo:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# clap + dialoguer + indicatif — CLI building stack
|
|
8
|
+
|
|
9
|
+
`clap` is the universal arg parser. Derive macros over builder API for new code.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- **Setup**: `clap = { version = "4", features = ["derive", "env"] }`
|
|
13
|
+
- **Basic args**:
|
|
14
|
+
```rust
|
|
15
|
+
#[derive(clap::Parser)]
|
|
16
|
+
#[command(version, about)]
|
|
17
|
+
struct Args {
|
|
18
|
+
#[arg(short, long, env = "MY_TOKEN")]
|
|
19
|
+
token: String,
|
|
20
|
+
#[arg(long, default_value_t = 10)]
|
|
21
|
+
limit: usize,
|
|
22
|
+
paths: Vec<PathBuf>,
|
|
23
|
+
}
|
|
24
|
+
fn main() {
|
|
25
|
+
let args = Args::parse();
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
- **Subcommands**: `#[derive(clap::Subcommand)]` enum + `#[command(subcommand)] cmd: Cmd` field
|
|
29
|
+
- **Validate**: `#[arg(value_parser = clap::value_parser!(u16).range(1..=65535))]`
|
|
30
|
+
- **Shell completions** (one-time gen, ship as separate file): `clap_complete::generate(Shell::Bash, &mut cmd, "myapp", &mut io::stdout())`
|
|
31
|
+
- **Interactive prompts** (when args are missing or for confirms): `dialoguer::{Input, Confirm, Select, Password}`
|
|
32
|
+
- **Progress bars**: `indicatif::{ProgressBar, MultiProgress}` — `.with_style(ProgressStyle::with_template("{spinner} {msg}").unwrap())`
|
|
33
|
+
- **Pretty errors**: `color-eyre` or pair `anyhow` with `tracing-subscriber` + ANSI
|
|
34
|
+
|
|
35
|
+
## Prerequisites
|
|
36
|
+
- cargo
|
|
37
|
+
- crates: `clap`, optionally `dialoguer`, `indicatif`, `color-eyre`
|
|
38
|
+
|
|
39
|
+
## Notes
|
|
40
|
+
- Use `env` attribute over manual `std::env::var` — clap shows env source in `--help` and respects override order.
|
|
41
|
+
- For subcommands, derive each in its own module; keeps the top-level enum clean.
|
|
42
|
+
- `Args::parse()` panics on bad input (exits with usage). For library use: `Args::try_parse()`.
|
|
43
|
+
- `indicatif` progress bars MUST be `drop`ped or `finish_and_clear()`ed — otherwise they leave the terminal in a weird state.
|
|
44
|
+
- For long-running CLIs, route logging through `tracing` and use `indicatif`-aware writer (`indicatif_log_bridge`) so logs don't break the bar.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: clippy-and-fmt
|
|
3
|
+
description: Use when linting or formatting Rust code, or when CI complains about style. Covers cargo clippy with -D warnings, cargo fmt --check, and per-crate config files.
|
|
4
|
+
allowed-tools: Bash(cargo:*), Bash(rustfmt:*), Bash(clippy:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Clippy & rustfmt
|
|
8
|
+
|
|
9
|
+
The two non-negotiable Rust quality gates.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
- Format: `cargo fmt` · check only (CI): `cargo fmt --check`
|
|
13
|
+
- Lint: `cargo clippy --all-targets --all-features`
|
|
14
|
+
- Lint as gate: `cargo clippy --all-targets -- -D warnings` (warnings become errors)
|
|
15
|
+
- Fix what's auto-fixable: `cargo clippy --fix --allow-dirty`
|
|
16
|
+
- Project config: `rustfmt.toml` for format rules; `clippy.toml` + `#![deny(clippy::pedantic)]` in lib.rs for lint strictness
|
|
17
|
+
|
|
18
|
+
## Prerequisites
|
|
19
|
+
- rustup (installs both via `rustup component add clippy rustfmt`)
|
|
20
|
+
|
|
21
|
+
## Notes
|
|
22
|
+
- Run both before commit. The fmt check is instant; clippy adds ~2x a `cargo check`.
|
|
23
|
+
- Don't blanket-allow lints in lib.rs — `#[allow(...)]` at the offending site so the lint stays useful elsewhere.
|
|
24
|
+
- The `-D warnings` flag is what most CIs use; matching it locally avoids surprise failures.
|
|
25
|
+
- `cargo fmt --check` exits non-zero on diff — perfect for pre-commit hooks.
|