Ai Language Idioms
Language Idioms for AI Agents
❄️ Nix
- Infinite Recursion: Never use
config.foo to define the enable condition for config.foo.
- Strings: Prefer
lib.concatStringsSep over repetitive string interpolation for lists.
- Let Bindings: Keep
let ... in blocks as close to their usage scope as possible.
🥟 Janet
- Immutability: Janet has both mutable (
array, table, buffer) and immutable (tuple, struct, string) data structures. Be explicit about which you are using.
- Macros: Avoid macros unless absolutely necessary. Use higher-order functions (
map, filter, reduce) first.
- Error Handling: Use
(try ... ([err] ...)) instead of letting the script crash, especially in hey CLI tasks.
🐚 Zsh
- Scoping: Always use
local for variables inside functions.
- Arrays: Use Zsh array syntax
my_array=(a b c) and iterate with for item in "${my_array[@]}"; do.
- Conditionals: Prefer
[[ ]] over [ ] for safe string evaluation.