shell

A guide to writing safer shell scripts and operating live machines from the command line.

In plain words
What is it for?
It helps write Bash scripts, add dry-run and verification modes, clean up with traps, use locks, edit system configuration, and safely run checks across servers over SSH.
Why use it?
It addresses common script risks such as unsafe quoting, incomplete cleanup, accidental repeated changes, and poorly controlled server operations.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/infohata/mind-vault/shell
Any agent
npx skills add infohata/mind-vault --skill shell
Clone the repo
git clone --depth 1 https://github.com/infohata/mind-vault

Made for: Claude Code, Codex.

Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,688 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00063 $0.03688
Opus 5 $0.00032 $0.01844
Sonnet 5 $0.00013 $0.00738
Haiku 4.5 $0.00006 $0.00369

Measured 2d ago against content hash dcee99cfd651, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade D, and why

shell scanned grade D with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

- [references/INTERACTIVE_SUDO_LOGIN_SHELL.md](references/INTERACTIVE_SUDO_LOGIN_SHELL.md) — the *interactive* sibling of `PRIVILEGE_DROP_PORTABILITY.md`: `sudo -iu <user>` / `sudo -i` / `su -` opens a login shell that b

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

`trap 'rm -rf -- "$tmp"' EXIT HUP INT TERM` registered immediately after
skills/shell/SKILL.md · 171 lines

How it starts

The opening of the file, as written. The whole thing — 171 lines — stays where its author put it; the contents beside it link to each section on GitHub.

shell

The vault's base shell-language layer — what python is to the framework skills, shell is to ops work: language-general recipes beneath the deployment skill and the devops persona. Two tiers live here:

  • Language mechanics (patterns 1–3 + the non-negotiables): true of any bash script — deploy tooling, installers, cron jobs, CI steps, maintenance scripts.
  • Live-host ops machinery (patterns 4–7): scripts that mutate live systems — mode surfaces, operator gates, SSH sweep hygiene, safe config edits, evidence gates.

deployment owns the Docker-Compose deploy lifecycle and machine provisioning; its references point down into this layer for the language-general mechanics rather than restating them. New shell-general patterns land here, not under deployment by gravity.

When to use

TRIGGER when: writing or reviewing any bash/sh script — ops/maintenance/rollout tooling, cron jobs, CI steps, entrypoints; user asks to "make this script safe to re-run"; adding or auditing DRY-RUN / --apply / --verify mode surfaces; sweeping a host fleet over SSH; editing system config files (PAM stack, nsswitch.conf, login-path or firewall config) from a script; designing precondition checklists for operator tooling.

SKIP when: the script is a Docker-Compose deploy / backup / rollback (→ deployment owns that lifecycle) or a machine-provisioning installer (→ deployment's SHELL_INSTALLERS.md leads and reaches down into this layer); one-shot commands a human types interactively.

Language mechanics

1. Strict mode and its holes

Fires when authoring any script. set -euo pipefail (+ shopt -s inherit_errexit on bash ≥4.4 — without it multi-step command substitutions sail past a failing first step) is the house prologue AND a known-leaky tripwire: pipeline-in-assignment aborts before your friendly error, head -N SIGPIPE races, informative non-zero rcs (diff, grep), local var=$(cmd) masking failure (SC2155), condition contexts disabling errexit transitively (if f; then turns -e off inside all of f), unguarded cd (SC2164), (( i++ )) at zero. Explicit rc handling at every destructive step, as if -e were absent; never retrofit -e onto a working script. Full catalog + the honest judgment-call stance: references/STRICT_MODE_HAZARDS.md.

Read the full file on GitHub · 171 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 171 lines · 63 tokens per session scan D dcee99cfd651

Subscribe to this mod's changes

shell is a skill published in the GitHub repository infohata/mind-vault (2 stars, last pushed 5d ago), licensed Apache-2.0. It adds 63 tokens to every session and 3,688 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it D with 2 findings (asks for root, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens

chat-perf

Run chat perf benchmarks and memory leak checks against the local dev build or any published VS Code version. Use when investigating chat rendering regressions, validating perf-sensitive changes to chat UI, or checking for memory leaks in the chat response pipeline.

microsoft/vscode · 51 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens