agentleFS
alexderzalexderz/agentic-toolbox/skills/shell-safety/SKILL.md

shell-safety

Skill5 starsChanged 46 days agoMITView on GitHub

use this when writing, reviewing, or running shell or bash — including agent tool commands, CI steps, one-liners, and scripts — classify Always / Ask first / Never before the command runs.

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    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
  1. Very specific:

    If this skill applies, use it.

    line 10
  2. Distinctive:

    Stop. Classify. Ask or never — do not run.

    line 87

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

First-party Always / Ask first / Never for tester and security. Compatible with security-hardening: LLM output is untrusted; encode for the shell sink; the system prompt is not a boundary.

If this skill applies, use it; do not rationalize past the gate. No scripts/ in this skill dir.

konstruktoid bash-secure is reference only — do not install or copy that pack.

Iron law

No shell command runs until it is classified Always, Ask first, or Never.

Model-chosen commands, generated scripts, and $(...) from untrusted text are client input.

Always

RuleWhy
Read the command before it runsYou cannot classify what you have not read
set -euo pipefail and IFS=$'\n\t' on scriptsFail closed on error, unset, and pipe fail
Quote "$var" and "$@"Word-split and glob are injection
Arrays, then "${args[@]}"Do not build command strings
${path:?} before rm / mv / chmod on a variable pathEmpty path becomes / or cwd
[[ ]] tests; printf not echo for untrusted text[ and echo are footguns
mktemp plus trap cleanupPredictable temps; no /tmp/foo races
cd -- "$dir" || exitFailed cd must not continue
ShellCheck on committed scripts (tester)Static catch before CI
Allowlist / encode before model text reaches a shellSame as security-hardening encode-for-sink
Workspace-scoped paths; non-interactive flagsAgents must not hang or roam

Ask first

TopicWhy it is a stop
Elevated shell, setuid, new capabilitiesPrivilege is a trust-boundary widen
Recursive force-remove / wipe outside the repo or this task's temp dirBlast radius
Pipe remote content into a shell; unpinned vendor installersINTAKE: clone, do not run installers
Force-push, history rewrite, deleting shared remote branchesIrreversible git
Writes under home, /etc, or credential dirsSecrets and host config
New network egress or piping remote contentNew trust
Disabling strict mode (set +e and kin) for a whole scriptFail-open
Running an opaque script you have not readSame as untrusted client input

Record the decision. Do not self-except.

Never

NeverWhy
Dynamic shell evaluation of user or model text (eval / -c / source of untrusted input)Injection; security-hardening Never
Pipe unpinned remote script into a shellSupply chain
Recursive force-remove of filesystem root or unguarded variable paths; unquoted destructive globsHost wipe
Secrets in scripts, git, or command lines that will be loggedHistory is forever
Copy scripts/ into a skill dirINTAKE quarantine
Extra hosts / Windows outside the workspace without operator approvalHost lock
Personal finance, mail, or password-manager via shellOut of agent scope
Bind all interfaces or public mesh from a one-linerNetwork becomes the client
World-writable mode bits on secretsData-class fail

Host and personal-account locks are Never, not Ask first.

Roles

RoleOwnsDoes not own
securityThis gate at Spec and Review when shell touches a boundary; skill intakeWriting tester CI yaml
testerShellCheck hooks when .sh appearsSkipping security because CI is green
builderClassifying commands before they runSelf-excepting “just this once”
managerAfter-actBlessing a ship that skipped the gate

Workers do not bypass security (SDLC roles). A green ShellCheck is not a security clear.

Red flags

  • “The model said the command is safe”
  • “I’ll pipe remote content into a shell just this once”
  • “Elevated shell is faster than asking”
  • “Empty path is fine”
  • “The extra host is convenient”

Stop. Classify. Ask or never — do not run.

Upstream pin

Intent: obra/superpowers using-superpowers @ b36e0829c6d0140e93cfef2ca599b1b07d4a7797. Body is first-party. See SOURCES.md.

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.