skills / rules
Cursor rule0 starsChanged 2 months agoMITView on GitHub
Bash scripting style conventions for marslo
- Deletes or force-pushes
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 4,183 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 repository32 other files it gives its agents.
- .claude/CLAUDE.mdCLAUDE.md
- .cursor/rules/base-rule.mdcCursor rule
- .cursor/rules/groovy-implicit-return.mdcCursor rule
- .cursor/rules/groovy-style.mdcCursor rule
- .cursor/rules/markdown-style.mdcCursor rule
- .cursor/rules/python-style.mdcCursor rule
- automateSkill
- autopilotSkill
- canvasSkill
- create-hookSkill
- create-ruleSkill
- create-skillSkill
- create-subagentSkill
- cursor-blameSkill
- git-messageSkill
- goalSkill
- loopSkill
- migrate-to-skillsSkill
- new-repoSkill
- onboardSkill
- originSkill
- rename-chatSkill
- review-bugbotSkill
- review-securitySkill
- reviewSkill
- sdkSkill
- shareSkill
- shellSkill
- split-to-prsSkill
- statuslineSkill
- update-cli-configSkill
- update-cursor-settingsSkill
The file
We split this bash-style.mdc into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 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.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
Always #!/usr/bin/env bash — portable, resolves bash 5.x from PATH (Homebrew).
- Very specific: line 49
When a statement nests brackets/parens/braces ([{}]), pad the outermost pair with a space on each side.
- Distinctive: line 61
If a string has no expansion (no variable, no command sub), use single quotes.
≈ “Common” is an estimate: at least 1 in 5 of the 6,668 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: Bash scripting style conventions for marslo
globs: **/*.sh
alwaysApply: false
---
# Bash Style
Apply these conventions when writing or editing Bash scripts.
## Shebang
Always `#!/usr/bin/env bash` — portable, resolves bash 5.x from PATH (Homebrew). Never hardcode `#!/bin/bash` (macOS system bash 3.2) or `#!/opt/homebrew/bin/bash`.
```bash
#!/usr/bin/env bash # ✅ portable, PATH-resolved
#!/bin/bash # ❌ macOS system bash 3.2
#!/opt/homebrew/bin/bash # ❌ hardcoded path — not portable
```
## 1. Naming
- **UPPER_CASE_WITH_UNDERSCORES** (Java-style constants) for global variables, variables set from CLI argument/option parsing, and anything treated as a constant/config: `ROOT`, `GLOBAL_PATH`, `ME`, `CURRENT_ROOT`, `PREFIX`, `DO_PATH`.
- **camelCase** for ordinary local working variables and for all function names: `buildNumber`, `tmpFile`; `installCli()`, `fetchLogs()`.
```bash
# ✅ good
declare -r ROOT="$(pwd)" # global / constant
function fetchLogs() { # function → camelCase
local buildNumber="${1}" # local working var → camelCase
}
# ❌ bad
declare -r root="$(pwd)"
function fetch_logs() { local BuildNumber="${1}"; }
```
## 2. Always brace expansions
Reference every variable as `${var}` — never bare `$var` (positionals too: `${1}`, `"${@}"`, `${#}`).
```bash
echo "${NAME}" ; rm -rf "${DIR}/output" ; run "${@}" # ✅
echo "$name" ; rm -rf "$dir/output" ; run "$@" # ❌
```
## 3. Space the outermost bracket when brackets nest
When a statement nests brackets/parens/braces `([{}])`, pad the **outermost** pair with a space on each side; inner pairs stay tight.
```bash
ROOT="$( cd "$(dirname "${0}")" && pwd )" # ✅ outer padded, inner tight
files=( "${dir}"/*.log ) # ✅
ROOT="$(cd "$(dirname "${0}")" && pwd)" # ❌
files=("${dir}"/*.log) # ❌
```
## 4. Single-quote hardcoded strings
If a string has no expansion (no variable, no command sub), use single quotes; use double quotes only when interpolating.
```bash
msg='hello world' ; path="${ROOT}/output" # ✅
msg="hello world" # ❌
```
## 5. Yoda comparisons — literal on the left
In equality tests, put the hardcoded literal on the left, the variable on the right.
```bash
test 'abc' = "${VAR}" # ✅
test "${VAR}" = 'abc' # ❌
```
## 6. Prefer `test` over `[[ ... ]]` / `[ ... ]`
For portability, prefer `test EXPR`. Fall back to `[[ ... ]]` only when you need its extras — regex `=~`, glob `==`, or a compound condition that's clearer grouped.
```bash
test -f "${FILE}" # ✅ portable
test -n "${X}" && test '-' != "${X}" # ✅ chain with shell &&
[[ -f "${FILE}" ]] # ❌ when plain test suffices
[[ "${VAL}" =~ ^[0-9]+$ ]] # ✅ OK — regex needs [[ ]]
```
## 7. Collapse simple if/else into `&&` / `||`
- single-branch `if` → `test COND && cmd` (or `test COND || cmd`)
- two-branch with single statements → `test COND && cmd1 || cmd2`
```bash
test -d "${DIR}" && rm -rf "${DIR}" # ✅ single-branch
test -f "${F}" || echo 'missing' >&2 # ✅
test -f "${F}" && echo 'found' || echo 'missing' # ✅ two-branch
```
⚠ Pitfall: in `A && cmd1 || cmd2`, `cmd2` also runs if `cmd1` fails. When `cmd1` may fail — or the branch **returns a value** — keep a full `if/else/fi`:
```bash
if test -f "${F}"; then status='ok'; else status='no'; fi
```
## 8. Build commands as arrays — never `eval`
Assemble a command in an indexed array and run it via `"${CMD[@]}"`; never concatenate into a string and `eval`. Arrays keep word boundaries intact (no re-splitting, no re-globbing, no quote-injection) and stay `command`-prefixable.
```bash
# ✅ global / config command → UPPER_CASE
declare -a CMD=( command rg --color=never "${PATTERN}" "${DIR}" )
"${CMD[@]}"
# ✅ local working command → camelCase
local -a lsCmd=( command ls -la "${target}" )
"${lsCmd[@]}"
# ✅ conditionally extend, then run once
declare -a CMD=( command git log )
test -n "${SINCE}" && CMD+=( --since "${SINCE}" )
"${CMD[@]}"
# ❌ eval spawns a subshell and re-parses — word-splitting & injection risk
eval "command ls -la ${target}"
# ❌ unquoted string command — splits/globs on whitespace in values
cmd="command grep ${PATTERN} ${DIR}"; ${cmd}
```
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.

