Files
clawmates/skills/rust/write-rust-current-edition.md
T
Omar SobhandClaude Opus 4.7 7b23f61632
ci / gates (push) Successful in 4s
ci / frontend (push) Successful in 25s
ci / rust (push) Failing after 3m41s
ci / e2e (push) Skipped
ci / publish (push) Skipped
slice 3.5c: seed 15 built-in skills across the 6 stacks
Hand-authored skill catalog anchored to real 2026-07 versions:
  - Rust 1.97.1 (stable), edition 2024
  - React 19.2.7, Server Components + Actions
  - TailwindCSS 4.3.3 (CSS-first config, Oxide engine)
  - three.js r185 (WebGPURenderer stable, BatchedMesh matured)
  - React Native 0.86 / Expo SDK 54+ (New Architecture default)
  - cargo-nextest 0.9.140, gitleaks 8.20+, cargo-audit 0.21+
  - Postgres 17 (18 in beta, don't rely on)
  - CUDA Blackwell, Metal Apple7+, ROCm CDNA3

Ships 15 skills across the categories:
  foundation/  workspace-repo-commit-protocol
               small-focused-commits
               tdd-red-green-refactor
               code-review-checklist
               int-xx-marker-protocol
               decompose-int-items
  rust/        write-rust-current-edition
               rust-error-handling
               cargo-test-driven-development
               rust-async-tokio-idioms
  backend/     postgres-migrations-forward-only
               postgres-index-selection
               api-pagination-day-1
  frontend/    react-19-server-components
               tailwind-v4-idioms
               component-4-state-model
  mobile/      expo-managed-vs-bare
               rn-flashlist-perf
  gpu/         gpu-coalescing-and-occupancy
               roofline-model
  threejs/     threejs-perf-and-teardown
  security/    cargo-audit-workflow
               secret-scanning-gitleaks

skills_loader.rs walks skills/**/*.md, parses YAML frontmatter
(name, description, when_to_use, tags), upserts via
skills_catalog::upsert_builtin. Idempotent per boot — bumps version
+ appends skill_versions row ONLY when body changes. Deterministic
sha256-derived ids so builtins are stable across boots.

Dockerfile copies skills/ to /etc/clawmates/skills. Server boot
task spawns loader alongside team_template_loader.

Follow-ups (Slice 3.5c continuation, future PRs):
  - 20-30 more skills (duckdb, shadcn composition, a11y, WebGPU
    migration, metal frame capture, rocprof, deep gitea forge
    integration, semgrep rulepacks)
  - Bind skills to team template roles (add [role.skills] refs to
    templates/teams/*.toml + wire template_role_skills population
    in team_template_loader)

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-07-19 13:55:44 -07:00

2.7 KiB

name, description, when_to_use, tags
name description when_to_use tags
write-rust-current-edition House Rust style anchored to edition 2024 + MSRV 1.97.1 (as of 2026-07). Idioms, patterns, and version-guarded features. Writing any Rust code. Pin on rust_sdlc + backend + gpu coder roles.
rust
style
versioned

Writing Rust (edition 2024, MSRV 1.97.1)

Toolchain we ship against

Version fields as of 2026-07. Verify with rustc --version before assuming.

  • stable: 1.97.1
  • workspace MSRV: 1.97.1 (some crates require 1.98.0+; check rust-toolchain.toml)
  • edition: 2024 (default for new crates; workspace-wide bump per project)
  • cargo tools we standardize on: cargo-nextest 0.9.140, cargo-audit 0.21+, cargo-llvm-cov 0.6+, cargo-machete, cargo-hakari (for workspace unification)

Idioms

  • let-else over deep nesting.
    let Some(user) = auth.load(id).await? else {
        return Err(NotFound.into());
    };
    
  • ? with .context() at every boundary (uses anyhow::Context or the equivalent). Bare ? inside a private function is fine; at API surfaces, add context.
  • if let chains (stable in edition 2024):
    if let Some(x) = maybe && x > 0 && !seen.contains(&x) { ... }
    
    Nest with if let blocks in edition-2021 crates until MSRV catches up.
  • Struct-of-args when a fn exceeds ~5 params — pass an Args<'a> struct. Clippy's too_many_arguments enforces at 7.
  • impl Trait in argument position for callbacks; Box<dyn Trait> only when erasure is genuinely needed.
  • Arc<T> over Rc<T> anywhere Send might matter — you're almost always in a Tokio runtime.

Anti-patterns

  • unwrap() in library code. Only allowed in tests, in main.rs before the runtime spins up, and behind debug_assert!.
  • .clone() as a borrow-checker escape. Ask why the borrow can't work first. If it genuinely can't, add a comment explaining the tradeoff.
  • Arc<Mutex<T>> when a channel would do. For actor-like state, tokio::sync::mpsc is almost always the right answer.
  • Box<Pin<Future>> in public APIs where impl Future would do — leaks implementation and forces heap alloc.
  • #[allow(clippy::...)] without a comment. Every allow needs a one-line WHY.

Testing

  • cargo nextest run as the default runner — faster, better output, isolates flaky tests. Fall back to cargo test when nextest isn't installed.
  • #[tokio::test] for async. Prefer #[tokio::test(flavor = "multi_thread")] when the code under test spawns.
  • See cargo-test-driven-development for the TDD flow.

Lint policy

Every Rust crate CI runs cargo clippy --all-targets -- -D warnings. Warnings ARE errors. Fix the warning; if it's a false positive, #[allow(...)] with a comment.