shell-script

shell-script is a cursor rule for Cursor from hiromaily/go-crypto-wallet. It costs 0 tokens per session (3,973 once invoked), scanned C, original, MIT.

A set of guidelines for writing shell scripts that stop on errors and avoid fragile hardcoded settings.

In plain words
What is it for?
Use it when creating or reviewing shell scripts, especially scripts that run Docker commands or in continuous integration.
Why use it?
It helps scripts fail visibly when commands or pipelines go wrong and keeps them usable when project names or environments change.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: positional $N argument.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ./scripts/operation/btc/e2e/e2e-workflow.sh --reset.

Good fit Use it when creating or reviewing shell scripts, especially scripts that run Docker commands or in continuous integration.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/hiromaily/go-crypto-wallet
agentmods
npx agentmods add rules/hiromaily/go-crypto-wallet/shell-script

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for shell-script

README.md
[![agentmods](https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/shell-script/github.svg)](https://agentmods.dev/rules/hiromaily/go-crypto-wallet/shell-script)
Your own site
<a href="https://agentmods.dev/rules/hiromaily/go-crypto-wallet/shell-script"><img src="https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/shell-script/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for shell-script

Your own site · 80×15
<a href="https://agentmods.dev/rules/hiromaily/go-crypto-wallet/shell-script"><img src="https://agentmods.dev/badge/rules/hiromaily/go-crypto-wallet/shell-script.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 3,973 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.03973
Opus 5 $0.00000 $0.01987
Sonnet 5 $0.00000 $0.00795
Haiku 4.5 $0.00000 $0.00397

Measured 8d ago against content hash bd30174111cd, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade C, and why

shell-script scanned grade C with 1 finding 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 8d 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.

Recursive force deletehighDestructive command

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

find "$wallet_dir" -mindepth 1 ! -name 'bitcoin.conf' -exec rm -rf {} + 2>/dev/null || true
.cursor/rules/shell-script.mdc · 705 lines

How it starts

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

Shell Script Best Practices

Overview

Rules for writing robust, maintainable shell scripts in go-crypto-wallet. These rules are based on code review feedback and industry best practices.

Critical Shell Options

Always Use Strict Mode

set -euo pipefail

Explanation:

  • -e: Exit immediately if any command fails
  • -u: Treat unset variables as errors
  • -o pipefail: Fail if any command in a pipeline fails (not just the last one)

Why pipefail matters:

# WITHOUT pipefail (BAD)
set -eu
cat nonexistent.txt | grep "pattern"  # Only grep's exit code matters

# WITH pipefail (GOOD)
set -euo pipefail
cat nonexistent.txt | grep "pattern"  # Fails immediately if cat fails

Variable Configuration

Make Hardcoded Values Configurable

Bad:

# Hardcoded volume name - brittle if project name changes
docker volume rm "go-crypto-wallet_wallet-mysql"

Good:

# Configurable with default
DOCKER_VOLUME_NAME="${DOCKER_VOLUME_NAME:-go-crypto-wallet_wallet-mysql}"
docker volume rm "$DOCKER_VOLUME_NAME"

Benefits:

  • Flexibility for different environments
  • No breakage if project structure changes
  • Easy to override in CI/CD

Environment Variable Naming

Use descriptive, uppercase names with underscores:

RPC_USER="${RPC_USER:-xyz}"
RPC_PASSWORD="${RPC_PASSWORD:-xyz}"
WALLET_PASSPHRASE="${WALLET_PASSPHRASE:-test}"
DOCKER_VOLUME_NAME="${DOCKER_VOLUME_NAME:-go-crypto-wallet_wallet-mysql}"

Use Environment Variables Instead of Modifying Config Files

Bad (creates backups, modifies files):

# Backup and modify config file
sed -i.bak 's|host: "127.0.0.1:18332"|host: "127.0.0.1:18332/wallet/watch"|' config.yaml

# ... operations ...

# Restore backup
if [ -f "config.yaml.bak" ]; then
    mv "config.yaml.bak" "config.yaml"
fi

Good (use environment variables):

# Create wrapper function to set environment variable per-command
watch_with_wallet() {
    WALLET_BITCOIN_HOST="127.0.0.1:18332/wallet/watch" watch "$@"
}

# Use wrapper function
watch_with_wallet -c config.yaml create payment

Read the full file on GitHub · 705 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. 8d ago First seen · 705 lines · 0 tokens per session scan C bd30174111cd

Subscribe to this mod's changes

shell-script is a cursor rule published in the GitHub repository hiromaily/go-crypto-wallet (127 stars, last pushed 4mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 3,973 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.