skill-everything / rules
Cursor rule20 starsChanged 7 months agoMITView on GitHub
Apply when writing or reviewing Bash or POSIX shell scripts — automation, CI steps, deploy scripts, or any shell-based tooling.
Where files are headingNew Cursor rule files have more rules about planning and tracking tasks, and fewer about code style.
Of the Cursor rule files we read, the 1,533 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository49 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/brainstorming.mdcCursor rule
- .cursor/rules/branch-finishing.mdcCursor rule
- .cursor/rules/code-quality.mdcCursor rule
- .cursor/rules/db-schema.mdcCursor rule
- .cursor/rules/debugging.mdcCursor rule
- .cursor/rules/docker.mdcCursor rule
- .cursor/rules/domain-template.mdcCursor rule
- .cursor/rules/drawio.mdcCursor rule
- .cursor/rules/error-log.mdcCursor rule
- .cursor/rules/fastapi.mdcCursor rule
- .cursor/rules/git-conventions.mdcCursor rule
- .cursor/rules/github-cli.mdcCursor rule
- .cursor/rules/implementation-plan.mdcCursor rule
- .cursor/rules/langchain.mdcCursor rule
- .cursor/rules/python.mdcCursor rule
- .cursor/rules/react.mdcCursor rule
- .cursor/rules/review-deployment.mdcCursor rule
- .cursor/rules/security-review.mdcCursor rule
- .cursor/rules/self-extension-workflow.mdcCursor rule
- .cursor/rules/svg-check.mdcCursor rule
- .cursor/rules/tdd.mdcCursor rule
- .cursor/rules/typescript.mdcCursor rule
- skill-everythingSkill
- brainstormingSkill
- branch-finishingSkill
- code-qualitySkill
- db-schemaSkill
- debuggingSkill
- dockerSkill
- domain-templateSkill
- drawioSkill
- error-logSkill
- fastapiSkill
- git-conventionsSkill
- github-cliSkill
- implementation-planSkill
- langchainSkill
- pythonSkill
- reactSkill
- review-deploymentSkill
- security-reviewSkill
- self-extension-workflowSkill
- shell-scriptingSkill
- svg-checkSkill
- tddSkill
- <kebab-case-name>Skill
- typescriptSkill
The file
Show its rules and text
We split this shell-scripting.mdc into the rules it gives an agent
16 rules. About 0 are common, 1 is distinctive, and 15 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 17
Fail-fast header: Always begin every shell script with set -euo pipefail so that unset variables, failed commands, and pipeline errors …
- Very specific: line 19
Trap cleanup: Always register a trap 'cleanup' EXIT function to remove temp files and release locks even when the script exits early due to …
- Very specific: line 21
Meaningful exit codes: Always exit with a non-zero code that reflects the failure category (e.g., exit 1 for usage errors, exit 2 for …
- Very specific: line 23
No eval: Never use eval to construct or execute dynamic commands.
- Very specific: line 27
Quote every variable: Always double-quote variable expansions ("$var", "$@") to prevent word-splitting and glob expansion on values …
- Very specific: line 29
Declare locals: Always declare variables inside functions with local to prevent accidental global namespace pollution.
- Very specific: line 31
Readonly constants: Use readonly for values that must not change after assignment (e.g., readonly SCRIPT_DIR="$(cd "$(dirname "$0")" && …
- Very specific: line 35
POSIX shebang: Always start scripts with #!/usr/bin/env bash (or #!/bin/sh for strict POSIX).
- Very specific: line 37
Portable syntax: Prefer POSIX-compatible constructs ([ ] over [[ ]], $(...) over backticks) when the script must run under /bin/sh.
- Very specific: line 39
ShellCheck clean: Ensure every script passes shellcheck -S warning with zero warnings before committing.
- Distinctive: line 43
Use functions: Always decompose scripts longer than ~30 lines into named functions with a main entry point called at the bottom.
- Very specific: line 45
Argument parsing with getopts: Use getopts for option parsing in scripts that accept flags.
- Very specific: line 47
Temp file handling: Always create temporary files with mktemp and store the path in a variable cleaned up by the EXIT trap.
- Very specific: line 51
Structured logging: Use a log() helper that prefixes output with a timestamp and level (INFO, WARN, ERROR) and routes errors to stderr …
- Very specific: line 53
Idempotent operations: Ensure scripts can be run multiple times without side effects — use guards like [ -d "$dir" ] || mkdir -p "$dir" and …
- Very specific: line 55
Heredocs for multi-line strings: Prefer heredocs (<<'EOF' ...
≈ “Common” is an estimate: at least 1 in 5 of the 3,030 Cursor rule files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
--- description: Apply when writing or reviewing Bash or POSIX shell scripts — automation, CI steps, deploy scripts, or any shell-based tooling. alwaysApply: false --- # Sub-Skill: Bash / POSIX Scripting <!-- target: tokens_target above. Run `python tools/render_readme_table.py` to update README. --> **Purpose:** Prevent silent failures, portability bugs, and security holes in shell scripts by enforcing safe defaults, clean structure, and ShellCheck compliance. --- ## Rules ### Safety & Error Handling 1. **Fail-fast header.** Always begin every shell script with `set -euo pipefail` so that unset variables, failed commands, and pipeline errors abort execution immediately. Reference: ERR-2026-021 2. **Trap cleanup.** Always register a `trap 'cleanup' EXIT` function to remove temp files and release locks even when the script exits early due to an error. 3. **Meaningful exit codes.** Always exit with a non-zero code that reflects the failure category (e.g., `exit 1` for usage errors, `exit 2` for dependency missing); never exit with `0` on failure. 4. **No eval.** Never use `eval` to construct or execute dynamic commands; prefer arrays or explicit argument lists to avoid injection vulnerabilities. ### Variables & Quoting 5. **Quote every variable.** Always double-quote variable expansions (`"$var"`, `"$@"`) to prevent word-splitting and glob expansion on values containing spaces or special characters. 6. **Declare locals.** Always declare variables inside functions with `local` to prevent accidental global namespace pollution. 7. **Readonly constants.** Use `readonly` for values that must not change after assignment (e.g., `readonly SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"`). ### Portability & Compatibility 8. **POSIX shebang.** Always start scripts with `#!/usr/bin/env bash` (or `#!/bin/sh` for strict POSIX); never rely on `/bin/bash` being present at a fixed path on all target systems. 9. **Portable syntax.** Prefer POSIX-compatible constructs (`[ ]` over `[[ ]]`, `$(...)` over backticks) when the script must run under `/bin/sh`; use Bash-specific features only when the shebang explicitly targets Bash. 10. **ShellCheck clean.** Ensure every script passes `shellcheck -S warning` with zero warnings before committing; treat ShellCheck output as mandatory, not advisory. ### Structure & Maintainability 11. **Use functions.** Always decompose scripts longer than ~30 lines into named functions with a `main` entry point called at the bottom; avoid top-level imperative code scattered throughout the file. 12. **Argument parsing with getopts.** Use `getopts` for option parsing in scripts that accept flags; never parse `$1`, `$2` manually for flag-style arguments. 13. **Temp file handling.** Always create temporary files with `mktemp` and store the path in a variable cleaned up by the `EXIT` trap; never hard-code paths like `/tmp/myfile`. ### Logging & Idempotency 14. **Structured logging.** Use a `log()` helper that prefixes output with a timestamp and level (`INFO`, `WARN`, `ERROR`) and routes errors to stderr (`>&2`); never mix diagnostic output into stdout used for data. 15. **Idempotent operations.** Ensure scripts can be run multiple times without side effects — use guards like `[ -d "$dir" ] || mkdir -p "$dir"` and `command -v tool >/dev/null 2>&1 || install_tool` before acting. 16. **Heredocs for multi-line strings.** Prefer heredocs (`<<'EOF' ... EOF`) over concatenated `echo` calls for multi-line output or embedded config; use the quoted form (`<<'EOF'`) to suppress variable expansion when the content is literal. --- ## See also - `skills/code-quality/SKILL.md` - `skills/error-log/SKILL.md`
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
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.

