devops-skills-plugin/skills/bash-script-validator/SKILL.md
Validate, lint, audit, or fix bash/shell/.sh scripts via ShellCheck.
npx skillsauth add akin-ozer/cc-devops-skills bash-script-validatorInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill validates Bash and POSIX shell scripts with layered checks:
bash -n or sh -n)Use the default flow below, then branch to fallbacks only when the environment is constrained.
Use this skill when the request includes script quality, linting, syntax checking, or shell portability work.
.sh file"Run commands from this skill directory:
cd devops-skills-plugin/skills/bash-script-validator
bash is available.bash scripts/validate.sh <script-path>
For deterministic stage behavior, set the ShellCheck provider explicitly:
# Modes: auto (default), system, wrapper, disabled
VALIDATOR_SHELLCHECK_MODE=system bash scripts/validate.sh <script-path>
Record:
0 clean, 1 warnings, 2 errors)SC####) when presentProgressive disclosure by issue type:
docs/shellcheck-reference.mddocs/common-mistakes.mddocs/bash-reference.mddocs/shell-reference.mddocs/grep-reference.md, docs/awk-reference.md, docs/sed-reference.md, docs/regex-reference.md (only when directly relevant)For each issue, include:
If the request includes patching files and write access is available, apply fixes in small batches grouped by issue type.
After each batch of edits, rerun the validator:
bash scripts/validate.sh <script-path>
Rerun loop rules:
Use these branches only when the default flow cannot run as-is.
| Constraint | Fallback action | Reporting requirement |
| --- | --- | --- |
| shellcheck missing, wrapper available | Let scripts/validate.sh use scripts/shellcheck_wrapper.sh --cache automatically | State that wrapper mode was used |
| shellcheck and wrapper unavailable | Run syntax + custom checks only (validator does this) | Explicitly call out reduced coverage and missing ShellCheck analysis |
| Python unavailable for wrapper | Skip wrapper path, keep syntax + custom checks | State why ShellCheck could not run |
| Target file is read-only | Provide precise patch suggestions without editing | Mark response as "advisory only" |
| Target file missing or unreadable | Stop and request a valid file path | Do not fabricate results |
| Binary/non-text input | Stop validation | Report unsupported input type |
Use subsection-level citations for every non-trivial fix.
Required citation format:
Reference: docs/<file>.md -> <Section> -> <Subsection>
Examples:
Reference: docs/common-mistakes.md -> 1. Unquoted Variables -> SolutionReference: docs/shellcheck-reference.md -> SC2164: Use || exit After cdReference: docs/shell-reference.md -> POSIX Best Practices -> 5. Avoid BashismsCitation rules:
SC#### code and the matching section.Use this structure for deterministic output:
Validation ResultsCommand: bash scripts/validate.sh <script-path>Detected shell: <shell>Exit code: <code>Summary: <errors> errors, <warnings> warnings, <info> infoIssue: <short label> (Line <n>)Problem:
<problematic snippet>
Fix:
<corrected snippet>
Why: <short explanation>Reference: docs/<file>.md -> <Section> -> <Subsection>Rerun command: bash scripts/validate.sh <script-path>Exit code after fixes: <code>Remaining issues: <count or none># 1) Baseline validation
bash scripts/validate.sh examples/bad-bash.sh
# 2) Apply fixes to target script
# 3) Rerun validation
bash scripts/validate.sh examples/bad-bash.sh
Expected behavior: full syntax + ShellCheck + custom-check coverage, with iterative reruns until stable.
# Requires a system shellcheck binary.
bash scripts/run_ci_checks.sh
This runner enforces VALIDATOR_REQUIRE_SHELLCHECK=1 and VALIDATOR_SHELLCHECK_MODE=system
so CI fails if the ShellCheck stage is skipped or unavailable.
# shellcheck unavailable and wrapper cannot run
bash scripts/validate.sh examples/bad-shell.sh
Expected behavior: syntax + custom checks still run. Report reduced coverage and list what must be revalidated once ShellCheck is available.
scripts/validate.sh: primary validator entrypointscripts/shellcheck_wrapper.sh: optional ShellCheck fallback using a cached Python virtual environmentValidation order in scripts/validate.sh:
0: no issues found1: warnings found2: errors foundLoad only what is needed:
docs/bash-reference.mddocs/shell-reference.mddocs/shellcheck-reference.mddocs/common-mistakes.mddocs/grep-reference.mddocs/awk-reference.mddocs/sed-reference.mddocs/regex-reference.mdThis skill update is complete when all are true:
development
Validate, lint, audit, or check Terragrunt .hcl/terragrunt.hcl files, stacks, modules, compliance.
data-ai
Generate/create/scaffold Terragrunt HCL files — root.hcl, terragrunt.hcl, child modules, stacks, multi-env layouts.
development
Validate, lint, audit, or plan Terraform/.tf/HCL files; runs tflint, checkov, terraform validate.
devops
Create, generate, write, or scaffold Terraform .tf HCL — resources, modules, providers, variables, outputs.