# domain-ml

A Rust-focused skill for ML and AI app design, covering model loading, tensor handling, batching, streaming, and GPU inference.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2800 installs · ★ 1545
- Author: actionbook
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/actionbook/rust-skills/tree/HEAD/skills/domain-ml/SKILL.md
- Updated: 2026-08-23
- HTML: https://affpapa.org/en/nevibecode/skills/domain-ml

## What it does

domain-ml gives Rust projects a set of design constraints for machine learning and AI work. It covers memory-aware tensor handling, streaming for large data, batched inference, one-time model loading, and asynchronous data delivery for GPU workloads. Reproducibility is addressed through seeded randomness and versioning.

The skill maps common tasks to crates: `tract` for ONNX inference, `candle` and `burn` for training and inference, `tch-rs` for PyTorch bindings, `ndarray` for tensors, `polars` for data processing, and `fastembed` for embeddings. It also describes `OnceLock<Model>`, iterator-based streaming, and splitting inputs into batches.

When a model is trained in Python and deployed in Rust, the ONNX plus `tract` route is the clearest fit described here. GPU work depends on CUDA or Metal support in the selected backend, and large tensors should avoid unnecessary copies.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill domain-ml -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/domain-ml/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/domain-ml/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill domain-ml -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/domain-ml/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill domain-ml -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/domain-ml/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install actionbook/rust-skills domain-ml
```

2. **Manually: put the files in place**
- File: `.github/skills/domain-ml/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill domain-ml -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/actionbook/rust-skills --path skills/domain-ml
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/domain-ml/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add actionbook/rust-skills --skill domain-ml -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/actionbook/rust-skills/tree/HEAD/skills/domain-ml/SKILL.md

## When to use it
- design an ML application in Rust
- choose a crate for ONNX inference
- process inference inputs in batches
- reuse a loaded model across requests
- connect streaming data with GPU inference

## Example prompts
- Design a Rust inference service for `model.onnx` that loads the model once.
- Compare `tract`, `candle`, and `tch-rs` for my Rust ML application.
- Refactor this inference flow to batch inputs and avoid copying large tensors.

## Similar
- [domain-modeling](https://affpapa.org/en/nevibecode/skills/domain-modeling.md) — skill · 876391 installs
- [domain-driven-design](https://affpapa.org/en/nevibecode/skills/wondelai-domain-driven-design.md) — skill · 7200 installs
- [principle-model-the-domain](https://affpapa.org/en/nevibecode/skills/principle-model-the-domain.md) — skill · 5200 installs
- [deploying-custom-domain-rest-api](https://affpapa.org/en/nevibecode/skills/deploying-custom-domain-rest-api.md) — skill · 5000 installs
- [domain-authority-auditor](https://affpapa.org/en/nevibecode/skills/domain-authority-auditor.md) — skill · 4700 installs
- [understand-domain](https://affpapa.org/en/nevibecode/skills/understand-domain.md) — skill · 3600 installs

From the same set: [actionbook/rust-skills](https://affpapa.org/en/nevibecode/by/actionbook/rust-skills.md) — 33 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
