shell
Skill1 starsChanged 4 months agoMITView on GitHub
Load before running or writing ANY shell — including throwaway one-liners you intend to run yourself, not just scripts you save. Trigger on the act, not the request: you are about to type awk, sed, cut, or a second pipe; you are parsing du/ps/ls/find output; a command needs a loop, a conditional, or arithmetic; you are writing $(...) inside another $(...); you need a file list, sizes, or process info; you are choosing a shebang or an interpreter; a command exceeds one line or will outlive this session; output must be machine-read, or must separate data from diagnostics; you are editing a Makefile recipe, Dockerfile RUN, CI run: block, cron entry, or .env; or you are reviewing or debugging shell someone else wrote. Answers "should this be shell at all?" first — usually jq, yq, sd, nu, Python or bun — then applies the Bash/Zsh/POSIX/Nushell safety rules to whatever survives that question.
- Reads credentials
8 other projects use a version of this.
Adopted by
Most recently taken up by
- JameMy0001/antigravity-skills-hubtheir own version, first seen Oct 2, 2026
- leishifu666/skillstheir own version, first seen Sep 29, 2026
- pale-knight/redteam-skilltheir own version, first seen Aug 20, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Jul 14, 2026
- last9/mithaitheir own version, first seen Jun 25, 2026
- Cogni-AI-OU/cogni-ai-agent-skillstheir own version, first seen May 19, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- pale-knight/redteam-skill★ 48same name
- nimadorostkar/Claude-Skills-collection★ 28same name
- last9/mithai★ 18same name
- Cogni-AI-OU/cogni-ai-agent-skills★ 4same name
- ffsshhttiikk/opencode-agents-skills★ 2same name
- JameMy0001/antigravity-skills-hub★ 1same name
- leishifu666/skills★ 1same name
- PandelisZ/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- llms.txtllms.txt
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 0 are distinctive, and 2 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 36
Hard stop: if a pipeline needs three or more stages, or any awk beyond {print $1}, stop and write a script file.
- Very specific: line 67
Never write bare bash and hope.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Shell
Most "shell problems" are solved by not writing shell. This skill decides that first, then enforces the rules for the parts that genuinely are shell.
1. Pick the tool before writing a line
| The task | Use | Not |
| JSON in, JSON out | jq | grep/sed on JSON |
| YAML / TOML / XML | yq | any regex |
| Substitute text in files | sd | sed -i (delimiter escaping, BSD-vs-GNU -i) |
| Find files | fd | find with -exec chains |
| Search contents | rg | grep -r |
| Query the OS for structured facts (sizes, processes, files) | nu | du/ps + awk |
| String case/encoding transforms | sttr | tr/awk |
| SQLite | sqlite3 or a bun script | shelling out per row |
| Anything with a data structure, two stages of logic, or arithmetic | Python or a bun .ts file | a pipeline |
Hard stop: if a pipeline needs three or more stages, or any awk beyond
{print $1}, stop and write a script file. A three-stage awk/sed/cut chain is
unreadable, unportable (BSD vs GNU), and silently wrong on unusual input.
See reference/pipelines.md for the replacement
table, BSD-vs-GNU traps, and worked rewrites.
1b. Do not invoke a tool from memory — check it
A recalled flag is a guess. Model memory for CLI flags is stale, version-skewed, and confidently wrong. Checking costs one command; guessing costs a silent wrong answer, which is worse than an error because nothing tells you.
Escalate in this order, stopping as soon as you know:
<cmd> --help— always first. Fast, offline, matches the installed version. Modern Rust tools (sd,rg,fd) have excellent--help.man <cmd>— when--helpis a summary and you need semantics. Not every tool ships one (nuandsttrdo not;sd,rg,fd,jq,yqdo — check withman -w <cmd>).<cmd> --version+ context7 — for a library or a tool with real documentation, when behaviour differs across versions. Pin the answer to the installed version.- Web search — last, for "why does X do Y" questions no reference answers.
Then run it once on a known input before trusting it in a pipeline.
Cached essentials and the gotchas that bite —
reference/cli-cheatsheets.md.
2. Pick the interpreter deliberately
Never write bare bash and hope. On macOS /bin/bash is 3.2 (2007, frozen over
GPLv3) — no mapfile, no associative arrays, no ${var^^}. Homebrew's bash 5.x lives
at /opt/homebrew/bin/bash.
- Portable script →
#!/usr/bin/env bashand stay inside 3.2 features, or assert the version at the top. - Need bash 4+/5 features → require it explicitly, do not assume
envfinds it. - Interactive-shell config → that is Zsh on macOS, not bash.
- Structured data → Nushell.
Details and the env -S flag trick: reference/shebang.md.
3. The non-negotiables (Bash)
| # | Rule | Enforced by |
| 1 | set -euo pipefail first line of every script | style |
| 2 | Quote every expansion: "$var", "$(cmd)" | SC2086 |
| 3 | read -r, never bare read | SC2162 |
| 4 | Declare local, then assign — local x="$(cmd)" hides the exit status | SC2155 |
| 5 | Arrays for lists; expand "${arr[@]}" | SC2206 |
| 6 | [[ ... ]], not [ ... ] | SC2292 |
| 7 | return in helpers; exit only in main | style |
| 8 | trap '...' EXIT for cleanup | style |
| 9 | printf, never echo — builtins disagree on -n, -e, backslashes | SC2028/SC2059 |
| 10 | ${var} braces | SC2250 |
| 11 | readonly constants; command -v, not which | style |
| 12 | Never parse ls; use a glob | SC2045 |
| 13 | No nested $( $( ) ) — assign an intermediate variable | readability |
Full rationale and citations: reference/shell-standards.md.
4. Then the shell-specific reference
Load only the one you are actually writing:
- Bash —
pipefailsemantics,trap ERR, BSD-vs-GNU coreutils, bash-3.2 traps →reference/bash.md - Zsh —
emulate -L zsh, no automatic word-splitting, glob qualifiers, startup files →reference/zsh.md - POSIX sh — no
local, no arrays,[ ]only,set -euwithoutpipefail→reference/posix-sh.md - Nushell — parse-time vs runtime,
constforsource, structured pipelines,savenot>,^cmd | complete→reference/nushell.md - Streams — stdout is data, stderr is diagnostics, exit codes, signals →
reference/streams.md
5. Verify before claiming it works
shellcheck script.sh # default severity — CI's --severity=warning hides SC2086
shfmt -d script.sh # layout, and rewrites backticks
nu --ide-check script.nu # parse + type errors for Nushelltask lint runs these across the repo. A script that has not been shellcheck'd at
default severity has not been checked.
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.

