home / skills / plurigrid / asi / rust

rust skill

This skill helps you manage Rust projects with cargo, rustc, clippy, and rustfmt for efficient development.

npx playbooks add skill plurigrid/asi --skill rust

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
1.8 KB
---
name: rust
description: Rust ecosystem = cargo + rustc + clippy + rustfmt.
version: 1.0.0
---


# rust

Rust ecosystem = cargo + rustc + clippy + rustfmt.

## Atomic Skills

| Skill | Commands | Domain |
|-------|----------|--------|
| cargo | 36 | Package manager |
| rustc | 1 | Compiler |
| clippy | 1 | Linter |
| rustfmt | 1 | Formatter |

## Workflow

```bash
cargo new project
cd project
cargo add serde tokio
cargo build --release
cargo test
cargo clippy
cargo fmt
```

## Cargo.toml

```toml
[package]
name = "myapp"
version = "0.1.0"
edition = "2021"

[dependencies]
serde = { version = "1.0", features = ["derive"] }
tokio = { version = "1", features = ["full"] }
```

## Cross-compile

```bash
rustup target add aarch64-apple-darwin
cargo build --target aarch64-apple-darwin
```



## Scientific Skill Interleaving

This skill connects to the K-Dense-AI/claude-scientific-skills ecosystem:

### Graph Theory
- **networkx** [○] via bicomodule
  - Universal graph hub

### Bibliography References

- `general`: 734 citations in bib.duckdb



## SDF Interleaving

This skill connects to **Software Design for Flexibility** (Hanson & Sussman, 2021):

### Primary Chapter: 5. Evaluation

**Concepts**: eval, apply, interpreter, environment

### GF(3) Balanced Triad

```
rust (−) + SDF.Ch5 (−) + [balancer] (−) = 0
```

**Skill Trit**: -1 (MINUS - verification)


### Connection Pattern

Evaluation interprets expressions. This skill processes or generates evaluable forms.
## Cat# Integration

This skill maps to **Cat# = Comod(P)** as a bicomodule in the equipment structure:

```
Trit: 0 (ERGODIC)
Home: Prof
Poly Op: ⊗
Kan Role: Adj
Color: #26D826
```

### GF(3) Naturality

The skill participates in triads satisfying:
```
(-1) + (0) + (+1) ≡ 0 (mod 3)
```

This ensures compositional coherence in the Cat# equipment structure.

Overview

This skill bundles core Rust tooling into a single, practical interface: cargo, rustc, clippy, and rustfmt. It focuses on typical project lifecycle tasks—bootstrapping, dependency management, building, testing, linting, and formatting—so you can move from idea to reproducible binary with minimal friction. The skill is optimized for cross-compilation and scientific workflows that interleave evaluation and compositional tooling.

How this skill works

The skill invokes cargo for project creation, dependency resolution, builds, and test runs. It calls rustc for low-level compilation control, clippy for static analysis and lints, and rustfmt for code formatting. Cross-target builds are supported through rustup-managed targets, and the skill can emit or consume Cargo.toml fragments for integration into larger workflows.

When to use it

  • Starting a new Rust project or library and scaffolding Cargo.toml
  • Adding and managing dependencies (including feature flags)
  • Running release builds and cross-compilation for other architectures
  • Automating CI steps: test, lint, format, and build
  • Integrating Rust tooling into scientific pipelines or evaluation workflows

Best practices

  • Use cargo new or cargo init to create consistent project layout
  • Declare dependencies and feature flags explicitly in Cargo.toml
  • Run cargo clippy regularly and treat warnings as actionable items
  • Keep rustfmt in pre-commit or CI to enforce a single style
  • Add rustup targets early when cross-compiling to avoid build surprises

Example use cases

  • Bootstrap a new async service with serde and tokio dependencies
  • Set up CI: cargo build --release, cargo test, cargo clippy, cargo fmt -- --check
  • Cross-compile a binary for Apple Silicon with rustup target add
  • Integrate linting and formatting into a scientific evaluation pipeline
  • Generate reproducible builds for deployment or benchmarking

FAQ

How do I add dependencies with features?

Add them in Cargo.toml using the features table, e.g. serde = { version = "1.0", features = ["derive"] } or use cargo add with feature flags.

What is the recommended CI sequence?

Build (cargo build --release), run tests (cargo test), run clippy (cargo clippy), and check formatting (cargo fmt -- --check) to catch issues early.