feat(skills): add rust style skill

This commit is contained in:
2026-09-17 01:28:43 -04:00
parent 247712582a
commit 2b520ec483
6 changed files with 109 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
# Rule format
Use this structure for each rule:
```md
## Rule title
### Rule
State enforceable instructions.
### Rationale
Explain why the rule exists.
```
Add `### Examples` only when examples clarify the rule.

View File

@@ -0,0 +1,34 @@
---
name: rust-style
description: Use when creating, editing, or reviewing Rust files in this repository.
---
# rust-style
Use this skill as the source of truth for repository Rust conventions.
## Load rules
Read every Markdown file directly under [`rules/`](rules/) before applying this skill.
Resolve [`rules/`](rules/) relative to this `SKILL.md`.
Finish when all discovered rule files have been read.
## Apply rules
Apply the loaded rules when editing or reviewing Rust files.
When loaded rules conflict, follow the most specific rule.
After editing Rust files, run:
```bash
nix run .#fix
```
Finish when `nix run .#fix` succeeds and the Rust change follows the loaded rules.
If the command fails, report the failure.
## Maintain rules
When adding or changing files under [`rules/`](rules/), read [`RULE-FORMAT.md`](RULE-FORMAT.md) first.
Finish when the changed rule files follow that format.

View File

@@ -0,0 +1,13 @@
# Bazel rules
## Use one source input style per `rust_test`
### Rule
Do not set both `crate` and `srcs` on a `rust_test` target.
Use exactly one input style for each Rust test target.
### Rationale
`rules_rust` rejects `rust_test` targets that set both `crate` and `srcs`.
Keeping one input style per target makes the test declaration valid and unambiguous.

View File

@@ -0,0 +1,13 @@
# Test rules
## Keep Rust tests in separate files
### Rule
Put Rust tests in separate `*_test.rs` files.
Do not add inline `#[cfg(test)]` modules.
Declare each test file in the nearest Bazel `BUILD` file with a `rust_test` target.
### Rationale
Separate test files keep production modules focused and match the repository's Bazel test layout.