feat(skills): add style review workflow
This commit is contained in:
@@ -6,6 +6,7 @@ This directory contains monorepo-owned agent skill sources.
|
||||
|
||||
```text
|
||||
src/skills/ Monorepo-owned skill sources
|
||||
src/skills/<group>/<skill>/ Grouped monorepo skill sources
|
||||
.pi/skills/ Monorepo-wide enabled Pi skill symlinks
|
||||
src/<project>/skills/ Project-owned skill sources
|
||||
src/<project>/.pi/skills/ Project-specific enabled Pi skill symlinks
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
---
|
||||
name: nix-style
|
||||
description: Use when creating, editing, or reviewing Nix files in this repository.
|
||||
---
|
||||
|
||||
# nix-style
|
||||
|
||||
Use this skill as the source of truth for repository Nix 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 Nix files.
|
||||
When loaded rules conflict, follow the most specific rule.
|
||||
|
||||
After editing Nix files, run:
|
||||
|
||||
```bash
|
||||
nix run .#fix
|
||||
```
|
||||
|
||||
Finish when `nix run .#fix` succeeds and the Nix 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.
|
||||
21
src/skills/style/STYLE.md
Normal file
21
src/skills/style/STYLE.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# Style skill instructions
|
||||
|
||||
Use this document for skills that own repository style conventions.
|
||||
|
||||
## Load rules
|
||||
|
||||
Read every Markdown file directly under `rules/` before applying the skill.
|
||||
Resolve `rules/` relative to the skill's `SKILL.md`.
|
||||
|
||||
Finish when all discovered rule files have been read.
|
||||
|
||||
## Apply rules
|
||||
|
||||
Apply the loaded rules when editing or reviewing files covered by the skill.
|
||||
When loaded rules conflict, follow the most specific rule.
|
||||
|
||||
|
||||
## Maintain rules
|
||||
|
||||
When adding or changing files under `rules/`, read `src/skills/style/RULE-FORMAT.md` first.
|
||||
Finish when the changed rule files follow that format.
|
||||
18
src/skills/style/nix/SKILL.md
Normal file
18
src/skills/style/nix/SKILL.md
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
name: nix-style
|
||||
description: Use when creating, editing, or reviewing Nix files in this repository.
|
||||
---
|
||||
|
||||
# nix-style
|
||||
|
||||
Use this skill as the source of truth for repository Nix conventions.
|
||||
Follow the shared style skill instructions in `src/skills/style/STYLE.md`.
|
||||
|
||||
After editing Nix files, run:
|
||||
|
||||
```bash
|
||||
nix run .#fix
|
||||
```
|
||||
|
||||
Finish when `nix run .#fix` succeeds and the Nix change follows the loaded rules.
|
||||
If the command fails, report the failure.
|
||||
9
src/skills/style/rust/SKILL.md
Normal file
9
src/skills/style/rust/SKILL.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
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.
|
||||
Follow the shared style skill instructions in `src/skills/style/STYLE.md`.
|
||||
39
src/skills/style/rust/rules/build.md
Normal file
39
src/skills/style/rust/rules/build.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# Build rules
|
||||
|
||||
## Use workspace dependency versions
|
||||
|
||||
### Rule
|
||||
|
||||
Declare Rust dependency versions in the repository root `Cargo.toml` under `[workspace.dependencies]`.
|
||||
Reference workspace dependencies from package `Cargo.toml` files with `workspace = true`.
|
||||
Do not declare dependency versions in package `Cargo.toml` files unless the operator explicitly requests a package-local version.
|
||||
Add package-local dependency features only when the feature set is specific to that package.
|
||||
|
||||
### Rationale
|
||||
|
||||
The repository has one Cargo workspace and one `Cargo.lock`.
|
||||
Centralized dependency versions keep package manifests consistent with the workspace lockfile.
|
||||
|
||||
## Declare Rust tests in Bazel
|
||||
|
||||
### Rule
|
||||
|
||||
Declare Rust test files in the nearest Bazel `BUILD` file with `rust_test`.
|
||||
Do not add `[[test]]` entries to `Cargo.toml` unless the operator explicitly requests Cargo test declarations.
|
||||
|
||||
### Rationale
|
||||
|
||||
Bazel is the source of truth for Rust test targets in this repository.
|
||||
Keeping test declarations in Bazel avoids duplicate test target lists.
|
||||
|
||||
## 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.
|
||||
28
src/skills/style/rust/rules/files.md
Normal file
28
src/skills/style/rust/rules/files.md
Normal file
@@ -0,0 +1,28 @@
|
||||
# File rules
|
||||
|
||||
## Avoid generic Rust file names
|
||||
|
||||
### Rule
|
||||
|
||||
Do not name Rust source files `lib.rs` or `main.rs`.
|
||||
Name library crate root files after the crate they define.
|
||||
Name binary crate root files after the binary they define, or use a `_main.rs` suffix.
|
||||
Set explicit Cargo paths and Bazel `srcs` when needed.
|
||||
|
||||
### Rationale
|
||||
|
||||
Generic root names make file search results and review context less clear.
|
||||
Descriptive file names show which crate or binary owns the code.
|
||||
|
||||
## Keep Rust tests in separate files
|
||||
|
||||
### Rule
|
||||
|
||||
Put Rust tests in separate `*_test.rs` files.
|
||||
Name each test file after the Rust source file or crate root that it tests.
|
||||
Do not use generic test file names such as `lib_test.rs` or `main_test.rs`.
|
||||
Do not add inline `#[cfg(test)]` modules.
|
||||
|
||||
### Rationale
|
||||
|
||||
Separate test files keep production modules focused and match the repository's Bazel test layout.
|
||||
Reference in New Issue
Block a user