docs(skills): add nix let review rule
This commit is contained in:
@@ -9,12 +9,8 @@ Use this skill as the source of truth for repository Nix conventions.
|
||||
|
||||
## Load rules
|
||||
|
||||
Read every Markdown file under [`rules/`](rules/) before applying this skill.
|
||||
Discover rule files from the skill source:
|
||||
|
||||
```bash
|
||||
find src/skills/nix-style/rules -maxdepth 1 -type f -name '*.md' -print | sort
|
||||
```
|
||||
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.
|
||||
|
||||
@@ -29,7 +25,8 @@ After editing Nix files, run:
|
||||
nix run .#fix
|
||||
```
|
||||
|
||||
Finish when the Nix change follows the loaded rules.
|
||||
Finish when `nix run .#fix` succeeds and the Nix change follows the loaded rules.
|
||||
If the command fails, report the failure.
|
||||
|
||||
## Maintain rules
|
||||
|
||||
|
||||
16
src/skills/nix-style/rules/let.md
Normal file
16
src/skills/nix-style/rules/let.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Let rules
|
||||
|
||||
## Prefer explicit dependencies over shared convenience bindings
|
||||
|
||||
### Rule
|
||||
|
||||
Do not add a `let` binding only to let sibling values share one expression.
|
||||
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.
|
||||
|
||||
### 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