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.
npx agentmods add rules/hamzaamjad/cursor-rules/434-bash-safetygit clone --depth 1 https://github.com/hamzaamjad/cursor-rulesWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00000 | $0.00974 |
| Opus 5 | $0.00000 | $0.00487 |
| Sonnet 5 | $0.00000 | $0.00195 |
| Haiku 4.5 | $0.00000 | $0.00097 |
Grade A, and why
434-bash-safety scanned grade A with 0 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 yesterday.
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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
What it actually says
- Purpose: To promote the creation of safe, robust, and maintainable Bash scripts by enforcing strict modes, safe variable handling, and dependency checks.
- Requirements:
- Start all scripts with
set -euo pipefail.set -e: Exit immediately if a command exits with a non-zero status.set -u: Treat unset variables as an error when substituting.set -o pipefail: Return value of a pipeline is the exit status of the last command to exit with a non-zero status, or zero if no command exited with a non-zero status.
- Always quote variable expansions (e.g.,
"$VAR","${ARRAY[@]}") unless deliberate word splitting or globbing is intended and understood. - Prefer functions for reusable blocks of code over loose commands.
- Explicitly check for the existence of required external commands before use (e.g., using
command -v). - Use environment variables or dedicated config files for configuration/secrets; avoid hardcoding values.
- Strive for idempotency where the script's purpose allows (can be run multiple times with the same initial state, yielding the same final state).
- Debugging/Modification: When refactoring or adding complex conditional logic, test changes incrementally. If a script fails with a syntax error, carefully review the diff of the last change, paying close attention to quoting, parentheses, and block structures (
if/then/else/fi,do/done).
- Start all scripts with
- Validation:
- Check (Static Analysis): Use
shellcheck(available at shellcheck.net) to automatically lint scripts. Configure CI to runshellcheckon all.shfiles. TargetSC2086(unquoted variables),SC2154(unset variables referenced withset -u), etc. - Check (Code Review): Verify
set -euo pipefailis present. Review variable expansions for correct quoting. Ensure dependencies are checked. Look for hardcoded secrets/paths. Assess idempotency logic.
- Check (Static Analysis): Use
- Examples:
- Dependency Check:
#!/bin/bash set -euo pipefail REQUIRED_CMD="jq" if ! command -v "$REQUIRED_CMD" &> /dev/null; then echo "Error: Required command '$REQUIRED_CMD' not found." >&2 exit 1 fi echo "Processing data..." # Safely use jq after check cat data.json | "$REQUIRED_CMD" '.items[] | .name' - Quoting:
# Bad: Fails if filename contains spaces # FILE_PATH="my report.txt" # ls $FILE_PATH # Good: Handles spaces correctly FILE_PATH="my report.txt" ls "$FILE_PATH" # Good: Iterating over array elements safely FILES=("file one.txt" "file two.txt") for f in "${FILES[@]}"; do echo "Processing '$f'" # Perform action on "$f" done
- Dependency Check:
- Changes: Explained
set -euo pipefail, specified validation viashellcheckand CI integration, provided more detailed examples for dependency checks and variable quoting (including array iteration). - Source References:
.cursor/rules/bash-safety.mdc; ShellCheck Website; ShellCheck GitHub; Bash scripting quirks & safety tips (jvns.ca)
Purpose: Make shell scripts robust, debuggable, and secure.
- Begin scripts with
set -euo pipefail; useIFSsafely. - Quote all variable expansions:
"$var". - Avoid
sudoinside scripts; require explicit invocation. - Trap signals (
trap 'cleanup' EXIT) for resource cleanup. - Validate required commands/files exist; exit with error if not.
- Do not echo secrets; read sensitive data from secure stores or env vars.
- Use `set -euo pipefail`
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.
- yesterday First seen · 70 lines · 0 tokens per session scan A 78beb5f55427
434-bash-safety is a cursor rule published in the GitHub repository hamzaamjad/cursor-rules (2 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 974 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other cursor rules, from other repositories
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.