ShellCheck
$ shellcheck Community Low RiskIndustry-standard static analyzer for POSIX sh, bash, dash, and ksh scripts, catching quoting bugs, undefined variables, and portability traps. Strictly read-only with native -f json / -f json1 structured diagnostics and severity thresholds (-S).
brew install shellcheck Runs instantaneous local AST checks on shell scripts with -f json1; MCP adds zero value here.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Native -f json and -f json1 (including replacement suggestions), -S severity filtering, --color=never, and stdin - support.
-f json1emits line/column/code/fix JSON diagnostics- Supports stdin
-and--color=never
Strictly read-only static parser; never modifies scripts or executes analyzed code.
- Zero side effects; never executes target scripts
Prebuilt static binaries across macOS, Linux, and Windows via Homebrew, distro repos, and GitHub Releases.
- Standalone static binaries with zero runtime deps
Prevents subtle shell quoting, globbing, and exit-code bugs in agent-generated scripts.
- Emits exact
SCxxxxcodes and automated fix patches injson1
Long-running gold-standard community tool (koalaman/shellcheck) under GPL-3.0.
- Ubiquitous industry-standard shell linter
Every SCxxxx rule has a dedicated wiki explanation page at shellcheck.net/wiki/.
- Searchable per-code wiki and man page
Security, Auth & Guardrails
Purely local static analysis; no credentials stored or required.
GPL-3.0 open-source Haskell binary; completely free.
# ShellCheck Agent Rules - Run `shellcheck -f json1` on every created or edited `.sh` / `.bash` script. - Never silence rules globally with `-e` unless justified; prefer targeted `# shellcheck disable=SCXXXX` with a comment.
Agent-Ready Command Recipes
Safe Read-Only Queries
shellcheck -f json1 -S warning scripts/deploy.sh
Analyzes the script at warning severity or higher and emits a rich JSON object with line/column spans and fix suggestions.
printf '%s\n' '#!/usr/bin/env bash' 'echo $FOO' | shellcheck -f json -
Validates generated shell snippets from stdin before writing them to disk.
Strengths for Agents
- +
-f json1returns exact spans and machine-applicablefixreplacements without touching files. - + Strictly read-only static binary available in virtually every CI and dev environment.
Caveats & Pitfalls
- ! Does not format or apply fixes directly (pair with
shfmtorgit applyondiffoutput). - ! Follows
sourced files only when-x(--external-sources) is enabled.