1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197# Rust Skills
179 Rust rules your AI coding agent can use to write better code.
Works with Claude Code, Cursor, Windsurf, Copilot, Codex, Aider, Zed, Amp, Cline, and pretty much any other agent that supports skills.
## Install
```bash
npx add-skill leonardomso/rust-skills
```
That's it. The CLI figures out which agents you have and installs the skill to the right place.
## How to use it
After installing, just ask your agent:
```
/rust-skills review this function
```
```
/rust-skills is my error handling idiomatic?
```
```
/rust-skills check for memory issues
```
The agent loads the relevant rules and applies them to your code.
## What's in here
179 rules split into 14 categories:
| Category | Rules | What it covers |
|----------|-------|----------------|
| **Ownership & Borrowing** | 12 | When to borrow vs clone, Arc/Rc, lifetimes |
| **Error Handling** | 12 | thiserror for libs, anyhow for apps, the `?` operator |
| **Memory** | 15 | SmallVec, arenas, avoiding allocations |
| **API Design** | 15 | Builder pattern, newtypes, sealed traits |
| **Async** | 15 | Tokio patterns, channels, spawn_blocking |
| **Optimization** | 12 | LTO, inlining, PGO, SIMD |
| **Naming** | 16 | Following Rust API Guidelines |
| **Type Safety** | 10 | Newtypes, parse don't validate |
| **Testing** | 13 | Proptest, mockall, criterion |
| **Docs** | 11 | Doc examples, intra-doc links |
| **Performance** | 11 | Iterators, entry API, collect patterns |
| **Project Structure** | 11 | Workspaces, module layout |
| **Linting** | 11 | Clippy config, CI setup |
| **Anti-patterns** | 15 | Common mistakes and how to fix them |
Each rule has:
- Why it matters
- Bad code example
- Good code example
- Links to official docs when relevant
## Manual install
If `add-skill` doesn't work for your setup, here's how to install manually:
<details>
<summary><b>Claude Code</b></summary>
Global (applies to all projects):
```bash
git clone https://github.com/leonardomso/rust-skills.git ~/.claude/skills/rust-skills
```
Or just for one project:
```bash
git clone https://github.com/leonardomso/rust-skills.git .claude/skills/rust-skills
```
</details>
<details>
<summary><b>OpenCode</b></summary>
```bash
git clone https://github.com/leonardomso/rust-skills.git .opencode/skills/rust-skills
```
</details>
<details>
<summary><b>Cursor</b></summary>
```bash
git clone https://github.com/leonardomso/rust-skills.git .cursor/skills/rust-skills
```
Or just grab the skill file:
```bash
curl -o .cursorrules https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md
```
</details>
<details>
<summary><b>Windsurf</b></summary>
```bash
mkdir -p .windsurf/rules
curl -o .windsurf/rules/rust-skills.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md
```
</details>
<details>
<summary><b>OpenAI Codex</b></summary>
```bash
git clone https://github.com/leonardomso/rust-skills.git .codex/skills/rust-skills
```
Or use the AGENTS.md standard:
```bash
curl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md
```
</details>
<details>
<summary><b>GitHub Copilot</b></summary>
```bash
mkdir -p .github
curl -o .github/copilot-instructions.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md
```
</details>
<details>
<summary><b>Aider</b></summary>
Add to `.aider.conf.yml`:
```yaml
read: path/to/rust-skills/SKILL.md
```
Or pass it directly:
```bash
aider --read path/to/rust-skills/SKILL.md
```
</details>
<details>
<summary><b>Zed</b></summary>
```bash
curl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md
```
</details>
<details>
<summary><b>Amp</b></summary>
```bash
git clone https://github.com/leonardomso/rust-skills.git .agents/skills/rust-skills
```
</details>
<details>
<summary><b>Cline / Roo Code</b></summary>
```bash
mkdir -p .clinerules
curl -o .clinerules/rust-skills.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md
```
</details>
<details>
<summary><b>Other agents (AGENTS.md)</b></summary>
If your agent supports the [AGENTS.md](https://agents.md) standard:
```bash
curl -o AGENTS.md https://raw.githubusercontent.com/leonardomso/rust-skills/master/SKILL.md
```
</details>
## All rules
See [SKILL.md](./SKILL.md) for the full list with links to each rule file.
## Where these rules come from
- [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/)
- [Rust Performance Book](https://nnethercote.github.io/perf-book/)
- [Rust Design Patterns](https://rust-unofficial.github.io/patterns/)
- Real code from ripgrep, tokio, serde, polars, axum
- Clippy docs
## Contributing
PRs welcome. Just follow the format of existing rules.
## License
MIT