shell

A guide for creating Bash shell scripts with error handling, input checks, safe variable use, temporary files, permissions, and cleanup. Shell scripts are small programs that run commands on a computer.

In plain words
What is it for?
Use it when writing scripts that execute commands, handle external input, access files or networks, manage temporary files, or need controlled permissions and cleanup.
Why use it?
It helps reduce mistakes such as command injection, accidental file changes, leaked secrets, and unclear behavior when a command fails. It also highlights the system access a script may have.

Command

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 commands/dotclaude/marketplace/shell
Clone the repo
git clone --depth 1 https://github.com/dotclaude/marketplace
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 472 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.00009 $0.00472
Opus 5 $0.00005 $0.00236
Sonnet 5 $0.00002 $0.00094
Haiku 4.5 $0.00001 $0.00047

Measured 2d ago against content hash b06f2f431580, 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.

- [ ] **Safe file permissions**: chmod 700 for scripts, 600 for configs

Recursive force deletehighDestructive command

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

- `rm -rf` with variables
plugins/cli-mastery/commands/shell.md · 68 lines

What it actually says

Shell Command

Shell script creation with error handling and best practices

SECURITY WARNING

CRITICAL: This command creates shell scripts with Bash execution capabilities.

Scripts you create will have the power to:

  • Execute system commands
  • Modify/delete files
  • Access network resources
  • Change permissions and ownership
  • Potentially escalate privileges

BEFORE requesting a script, consider:

  • What's the blast radius if this script is exploited?
  • Does this script handle any untrusted input?
  • Will this script access sensitive data or credentials?
  • What's the minimum privilege level needed?

Security Requirements Checklist

EVERY shell script must include:

  • Strict error handling: set -euo pipefail
  • Input validation: Validate ALL external inputs with regex
  • Quoted variables: ALWAYS quote variables to prevent injection
  • No hardcoded secrets: Use env vars or secret management
  • Secure temp files: Use mktemp, never predictable names
  • Least privilege: Run with minimum necessary permissions
  • Cleanup handlers: Use trap to clean up on exit/error
  • Safe file permissions: chmod 700 for scripts, 600 for configs
  • Command validation: Validate commands before execution
  • Audit logging: Log security-relevant operations

Dangerous Operations to Avoid

STOP and think before using:

  • rm -rf with variables
  • chmod 777 or similar overly permissive modes
  • sudo without specific command limits
  • eval with external input
  • Unquoted variables in commands
  • Shell injection via unsanitized input

Arguments

$1 (Required): script-purpose

$2 (Optional): robustness (production requires strict security)

Examples

/shell "Backup database with rotation" production
/shell "Deploy application with health checks"

Invoke the shell-scripter agent with: $ARGUMENTS

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 · 68 lines · 9 tokens per session scan D b06f2f431580

Subscribe to this mod's changes

shell is a command published in the GitHub repository dotclaude/marketplace (41 stars, last pushed 4mo ago), licensed MIT. It adds 9 tokens to every session and 472 once invoked, about $0.0000 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-30.