AgentLint Verified 85/100304 Shell / Bash repos analyzed
Shell / Bash CLAUDE.md & AGENTS.md Template
set -euo pipefail, ShellCheck compliance, and BSD/GNU portability from 304 Shell repos.
# Shell / Bash Project — Shell Automation Harness Portable POSIX/Bash CLI scripts checked with `shellcheck` and tested across macOS and Linux. ## Commands - Syntax check: `bash -n scripts/*.sh` - Lint: `shellcheck -x scripts/*.sh` - Fast unit tests: `bash tests/test_core.sh` ## Rules - Don't write scripts without `set -euo pipefail` at the top. Instead fail fast on unset variables and pipeline errors. Because silent failures corrupt downstream files. - Don't leave variable expansions unquoted (`$FILE`). Instead always double-quote (`"$FILE"`). Because paths with spaces split into broken arguments. - Don't rely on GNU-only flags like `sed -i ''` vs `sed -i` without portability handling. Instead write temp files atomically or test on both BSD and GNU. - When touching install scripts, read `docs/release-safety.md` first. ## Continuity - Keep secrets out of scripts, pass tokens via env vars, and update `HANDOFF.md`.
Most Adopted Shell / Bash Rules Across Real Open-Source Repos
Measured across 304 public Shell / Bash repositories in the 4,533-repo harness study:
unit-teststesting
Write unit tests for all changes
31.9%97 repos
conventional-commitsworkflow
Use conventional commit messages
31.2%95 repos
error-handlingpatterns
Proper error handling with context
30.9%94 repos
ci-cdtooling
CI/CD pipeline must pass
27.6%84 repos
dockertooling
Docker for containerization
27.0%82 repos
dryprinciples
Don't repeat yourself
16.1%49 repos
no-secretssecurity
Never commit secrets or .env files
12.8%39 repos
kissprinciples
Keep it simple
12.2%37 repos
Essential Commands (Checks W1 & W7)
- install
- brew install shellcheck shfmt
- fastTest
- bash tests/test_core.sh
- fullTest
- bash tests/run_all.sh
- lint
- shellcheck scripts/*.sh && shfmt -d scripts/
- build
- bash -n scripts/*.sh
Common Shell / Bash Agent Pitfalls
- 01Unquoted
$varexpansions break on spaces and introduce command-injection bugs. - 02Using GNU-only
sed -iorreadlink -fbreaks macOS BSD shells.