posix-shell
Skill0 starsChanged 2 months agoMITView on GitHub
Enforce strict POSIX compliance and BusyBox ash compatibility for OpenWrt scripts. Forbids bashisms, ensures safe variable quoting, efficient resource usage, and clean UCI interactions.
In this repository22 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ark-theme-uiSkill
- openwrt-hardware-offloadingSkill
- openwrt-imagebuilderSkill
- openwrt-luci-modernSkill
- openwrt-network-firewallSkill
- openwrt-sqm-bufferbloatSkill
- openwrt-storage-failsafeSkill
- openwrt-wifi-meshSkill
- posix-shellSkill
- security-auditorSkill
- systematic-debuggingSkill
- ark-theme-uiSkill
- openwrt-hardware-offloadingSkill
- openwrt-imagebuilderSkill
- openwrt-luci-modernSkill
- openwrt-network-firewallSkill
- openwrt-sqm-bufferbloatSkill
- openwrt-storage-failsafeSkill
- openwrt-wifi-meshSkill
- security-auditorSkill
- systematic-debuggingSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 47
Use a flag -q (quiet) quando o valor puder não existir: uci -q get "system.@system[0].hostname".
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
POSIX Shell & BusyBox Ash Guidelines (ARK Router)
Objetivo
Garantir que todo script de shell desenvolvido para o ARK Router execute de forma confiável e leve sob o BusyBox ash (/bin/sh), sem dependências do GNU Bash e com consumo mínimo de recursos (RAM e Flash).
Regras Fundamentais (Invioláveis)
1. Zero Bash-ismos (Strict POSIX)
- Shebang Obrigatório:
#!/bin/sh(nunca#!/bin/bash). - ❌ Proibido
[[ ... ]]: Use sempre[ ... ]outest.- Correto:
[ -n "$var" ] && [ "$var" = "val" ] - Incorreto:
[[ -n $var && $var == "val" ]]
- Correto:
- ❌ Proibido arrays:
arr=(a b c)não existe no POSIX ash. Use listas separadas por espaço ou processe comset --. - ❌ Proibido substituições não-POSIX:
- Incorreto:
${var//foo/bar},${var^^}. - Correto: Use
sed,awk, oucutde forma enxuta.
- Incorreto:
- ❌ Proibido
function foo(): No POSIX, a sintaxe de função é apenasfoo() { ... }. - ❌ Proibido
read -aouread -p: Useprintf "Prompt: " && read -r line.
2. Tratamento Seguro de Variáveis e Aspas
- Sempre citar variáveis de expansão:
"$var"para evitar quebras por espaços ou expansão de glob. - Citar caminhos do UCI:
ip=$(uci -q get "network.lan.ipaddr") - Tratar saídas de comandos e verificar códigos de retorno:
if ! output=$(some_command); then logger -t ark-router "Erro ao executar some_command" return 1 fi
3. Eficiência em Sistemas Embarcados (128 MB / 256 MB RAM)
- Evite criar subshells desnecessários
$(...)dentro de loops intensivos. - Prefira comandos internos do BusyBox (built-ins) como
case ... esac,test,echo,printf. - Evite tubulações excessivas (
cat file | grep foo | awk ...). Use comandos compostos ou leia linha a linha comwhile read -r line; do ... done < file.
4. Boas Práticas com o UCI
- Use a flag
-q(quiet) quando o valor puder não existir:uci -q get "system.@system[0].hostname". - Sempre realize
uci commitapenas ao final de um lote de alterações para poupar escritas na Flash SPI. - Reinicie serviços de rede ou firewall de forma condicional, nunca incondicionalmente em loops.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

