agentleFS
fmindfmind/dot/skills/shell/SKILL.md

shell

Skill14 starsChanged yesterdayMITView on GitHub

Write and lint portable POSIX sh, Bash, and Fish scripts (shellcheck, shfmt, traps).

  • Deletes or force-pushes

21 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use update-cli-config, migrate-to-skills and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • PandelisZSkill

    update-cli-config

    View and modify Cursor CLI configuration settings in ~/.cursor/cli-config.json. Use when the user wants to change CLI settings, configure permissions, switch approval mode, enable vim mode, toggle display options, configure sandbox, or manage any CLI preferences.

    Also in 7 projects that use this

  • 32103210Skill

    migrate-to-skills

    Convert 'Applied intelligently' Cursor rules (.cursor/rules/*.mdc) and slash commands (.cursor/commands/*.md) to Agent Skills format (.cursor/skills/). Use when you want to migrate rules or commands to skills, convert .mdc rules to SKILL.md format, or consolidate commands into the skills directory.

    Also in 7 projects that use this

  • 32103210Skill

    update-cursor-settings

    Modify Cursor/VSCode user settings in settings.json. Use when you want to change editor settings, preferences, configuration, themes, font size, tab size, format on save, auto save, keybindings, or any settings.json values.

    Also in 7 projects that use this

  • 0mlkrizzz655335vSkill

    review-bugbot

    缺陷导向代码审查。用 Bugbot 子代理找 bug。

    Also in 4 projects that use this

  • 0mlkrizzz655335vSkill

    origin

    origin CLI 管理。安装、登录、更新、修复 origin.cursor.com 的 CLI。"disabled-environments:

    Also in 3 projects that use this

  • Tsumugii24Skill

    split-to-prs

    Split current work into small reviewable PRs. Use when the user asks to split a chat, set of changes, branch, or PR.

    Also in 6 projects that use this

  • +2 more from 32103210
  • +3 more from 0mlkrizzz655335v

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 15 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Keep shell scripts small, strict, and auditable across POSIX sh, bash, zsh, and fish (bootstraps, entrypoints, Fish functions, git hooks, …

    line 15
  2. Very specific:

    Bound temp files, traps & non-TTY runs: create temp dirs via mktemp -d with

    line 25
  3. Very specific:

    Eliminate injection & brittle parsing: never interpolate variables into eval, sh -c "...", or sed/awk—pass positional args (sh -c 'cmd …

    line 26

“Common” is measured: kept by at least 6 in 10 of the 15 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Shell Scripting, Portability & Safety

Keep shell scripts small, strict, and auditable across POSIX sh, bash, zsh, and fish (bootstraps, entrypoints, Fish functions, git hooks, CI run: blocks). Once logic passes ~100 lines or needs retries, structured JSON/YAML parsing, or complex branching, graduate to a PEP 723 Python script (python/script).

Workflow

  1. Pick a dialect-true shebang and strict header:
    • Strict POSIX sh (dash/Alpine/BSD): #!/bin/sh + set -eu (no bashisms: no [[ ]], arrays, pipefail, local where strict portability applies, or $'...').
    • Bash: #!/usr/bin/env bash + set -euo pipefail.
    • Zsh: #!/usr/bin/env zsh + emulate -L zsh + set -euo pipefail (syntax-check via zsh -n).
    • Fish: #!/usr/bin/env fish (never mix POSIX syntax; use set -gx—never set -U—inside tracked config files so persistent universal state is never mutated).
  2. Quote every expansion and protect paths: wrap every variable and command substitution ("${var}", "$(cmd)"), store argument lists in arrays "${arr[@]}" (or set -- in sh) rather than space-delimited strings, pass -- before variable paths (rm -rf -- "${dir:?}/sub"), and split local out; out="$(cmd)" so local/export/readonly never mask non-zero exits under set -e.
  3. Bound temp files, traps & non-TTY runs: create temp dirs via mktemp -d with trap cleanup EXIT; trap 'trap - EXIT; cleanup; trap - INT; kill -INT $$' INT; trap 'trap - EXIT; cleanup; trap - TERM; kill -TERM $$' TERM (avoids double cleanup and preserves signal exits; guard unset vars under set -u), disable prompts (--yes, </dev/null), and keep operations idempotent (ln -sfn, pre-checks over blind >>).
  4. Eliminate injection & brittle parsing: never interpolate variables into eval, sh -c "...", or sed/awk—pass positional args (sh -c 'cmd "$1"' _ "$arg"), and verify checksums/signatures before running downloaded installers.
    • Structured data: parse JSON with jq and YAML with Go yq (mikefarah/yq, e.g. yq -i '.key = strenv(VAL)' file.yml—distinct from Python kislyuk/yq).
    • Safe file iteration: in POSIX sh, use find ... -exec ... {} + or safe globs; in Bash, use while IFS= read -r -d '' f; do ...; done < <(find ... -print0) (never for f in $(ls ...)).
  5. Verify with deterministic linters and syntax checks:

    shellcheck -- <scripts...>
    shfmt -d -i 2 -s -- <scripts...>
    sh -n -- <posix-script>
    bash -n -- <bash-script>
    zsh -n -- <zsh-script>
    fish --no-config --no-execute -- <fish-script>
    fish --no-config -c 'fish_indent --check < <fish-script>'

    -n and --no-execute parse one script per invocation (loop over multiple files rather than passing a list). Enable optional .shellcheckrc checks like enable=check-extra-masked-returns where supported; project shfmt/shellcheck flags take precedence. Pin shellcheck and shfmt per project in mise.toml (mise).

Gotchas

  • set -e exit masking: set -e is disabled inside if/&&/|| conditions and function calls within them; check critical steps explicitly and collect background PIDs with wait "$pid".
  • Empty globs, empty arrays, & leading-dash filenames: unmatched globs pass literal * unless shopt -s nullglob (Bash) or [ -e "$f" ] || continue (POSIX) guards the loop; prefix relative globs (./*) or pass -- so - filenames cannot become flags. On macOS Bash 3.2 under set -u, empty "${arr[@]}" errors—expand via ${arr[@]+"${arr[@]}"}.
  • GNU vs BSD userland drift: sed -i, mktemp, date, readlink -f, and xargs -r behave differently on macOS vs Linux; stick to POSIX flags or move cross-platform scripts to Python.

Documentation

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.