feat(skills): add style review workflow
This commit is contained in:
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.
|
||||
13
src/skills/style/nix/rules/flake.md
Normal file
13
src/skills/style/nix/rules/flake.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Flake rules
|
||||
|
||||
## Keep `flake.nix` as flake wiring
|
||||
|
||||
### Rule
|
||||
|
||||
Add flake inputs in `flake.nix`.
|
||||
Put new flake output implementation in `src/dotfiles/default.nix`.
|
||||
Use `flake.nix` to pass inputs into that implementation.
|
||||
|
||||
### Rationale
|
||||
|
||||
This keeps dependency declarations separate from output logic.
|
||||
17
src/skills/style/nix/rules/let.md
Normal file
17
src/skills/style/nix/rules/let.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Let rules
|
||||
|
||||
## Prefer explicit dependencies over shared convenience bindings
|
||||
|
||||
### Rule
|
||||
|
||||
Do not add a `let` binding only to let sibling values share one expression.
|
||||
Apply this rule only when one sibling value clearly owns the concept.
|
||||
When one sibling value owns the concept, reference that sibling value directly.
|
||||
When a flake output owns the public value, reference that output through `self`.
|
||||
Do not make an output attrset recursive only to reference sibling outputs.
|
||||
Do not apply this rule when a binding names a local constant used to keep sibling assignments in sync.
|
||||
|
||||
### Rationale
|
||||
|
||||
Shared convenience bindings hide dependency direction.
|
||||
Explicit references show which value owns a concept and which value consumes it.
|
||||
Reference in New Issue
Block a user