
bash-script-validator
Validate, lint, audit, or fix bash/shell/.sh scripts via ShellCheck.
- Installs
- 682
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/akin-ozer/cc-devops-skills --skill bash-script-validator- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads bash-script-validator automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Bash Script Validator
Overview
This skill validates Bash and POSIX shell scripts with layered checks:
- Syntax validation (
bash -norsh -n) - ShellCheck static analysis (system binary or wrapper fallback)
- Custom security, portability, and optimization checks
Use the default flow below, then branch to fallbacks only when the environment is constrained.
Trigger Guidance
Use this skill when the request includes script quality, linting, syntax checking, or shell portability work.
Trigger Phrases
- "Validate this bash script"
- "Lint this
.shfile" - "Find security issues in this shell script"
- "Why does this script fail ShellCheck?"
- "Make this script POSIX compliant"
- "Review this shell script before CI"
Non-Trigger Examples
- General Linux command questions with no script file
- Kubernetes, Terraform, or pipeline validation tasks that do not involve shell scripts
- Pure prose editing tasks
Deterministic Execution Model
Run commands from this skill directory:
cd devops-skills-plugin/skills/bash-script-validator
Step 1: Preflight
- Confirm target path exists and is readable.
- Confirm
bashis available. - Determine whether fixes can be applied directly (write access) or only suggested (read-only).
Step 2: Run Baseline Validation (Default Path)
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:
- Detected shell type
- Exit code (
0clean,1warnings,2errors) - All reported issue lines and ShellCheck codes (
SC####) when present
Step 3: Load Only Needed References
Progressive disclosure by issue type:
- ShellCheck code explanations:
docs/shellcheck-reference.md - General fix patterns and security mistakes:
docs/common-mistakes.md - Bash-only behavior:
docs/bash-reference.md - POSIX portability or bashism fixes:
docs/shell-reference.md - Text-processing optimization issues:
docs/grep-reference.md,docs/awk-reference.md,docs/sed-reference.md,docs/regex-reference.md(only when directly relevant)
Step 4: Provide or Apply Fixes
For each issue, include:
- Exact location from validator output (line number and snippet)
- Root cause
- Corrected code
- Why the change is safer or more portable
- Subsection-level citation (format below)
If the request includes patching files and write access is available, apply fixes in small batches grouped by issue type.
Step 5: Rerun Policy (Mandatory After Changes)
After each batch of edits, rerun the validator:
bash scripts/validate.sh <script-path>
Rerun loop rules:
- Continue until no new errors are introduced.
- If warnings remain by design, document why they are intentionally accepted.
- If constraints prevent full resolution, report unresolved items with a clear next action.
- Always report the latest rerun exit code and remaining issue count.
Fallback Behavior
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 |
Citation Guidance for Fixes
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 Bashisms
Citation rules:
- Cite the most specific section that justifies the fix.
- For ShellCheck findings, include both the
SC####code and the matching section. - If no exact subsection exists, cite the closest section and state that the fix is inferred from that guidance.
Response Template
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>
Example Flows
Fully Automated Environment
# 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.
Deterministic CI Gate
# 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.
Constrained Environment (No ShellCheck Runtime)
# 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.
Validator Script Details
Scripts
scripts/validate.sh: primary validator entrypointscripts/shellcheck_wrapper.sh: optional ShellCheck fallback using a cached Python virtual environment
Detection and Ordering
Validation order in scripts/validate.sh:
- File checks (exists/readable/text)
- Shebang-based shell detection
- Syntax check
- ShellCheck (or fallback/skip behavior)
- Custom checks
- Summary with exit code
Exit Codes
0: no issues found1: warnings found2: errors found
References
Load 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.md
Done Criteria
This skill update is complete when all are true:
- Trigger guidance is explicit (positive and non-trigger examples).
- Default workflow is deterministic and ordered.
- Fallback behavior is explicit for missing tooling and constrained environments.
- Fix explanations include subsection-level citations.
- Post-fix rerun policy is mandatory and reported with exit codes.
- Documentation supports both fully automated and constrained execution paths.
FAQ
What does the bash-script-validator skill do?
Validate, lint, audit, or fix bash/shell/.sh scripts via ShellCheck.
How do I install bash-script-validator?
Run npx skills add https://github.com/akin-ozer/cc-devops-skills --skill bash-script-validator in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/bash-script-validator/ (personal) or .claude/skills/bash-script-validator/ (project).
Which AI agents can use bash-script-validator?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is bash-script-validator safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains bash-script-validator?
It is published by akin-ozer in akin-ozer/cc-devops-skills. It has 682 recorded installs.
More from akin-ozer/cc-devops-skills
ansible-validator
akin-ozer/cc-devops-skills
Validate, lint, audit, or debug Ansible playbooks, roles, inventories, FQCN, tasks.
terragrunt-generator
akin-ozer/cc-devops-skills
Generate/create/scaffold Terragrunt HCL files — root.hcl, terragrunt.hcl, child modules, stacks, multi-env layouts.
k8s-debug
akin-ozer/cc-devops-skills
Diagnose and fix Kubernetes pods, CrashLoopBackOff, Pending, DNS, networking, storage, and rollout failures with kubectl.
ansible-generator
akin-ozer/cc-devops-skills
Generate, create, or scaffold Ansible playbooks, roles, tasks, handlers, inventory, vars.
jenkinsfile-generator
akin-ozer/cc-devops-skills
Generate/create/scaffold Jenkinsfile — declarative, scripted, shared library, CI/CD pipelines.
dockerfile-validator
akin-ozer/cc-devops-skills
Validate, lint, audit, or scan a Dockerfile for security and best practices.
Popular devops & cloud skills
microsoft-foundry
microsoft/azure-skills
Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, managed harness agent create, GitHub Copilot harness agent, create agent, update agent, add tool to agent, invoke agent, agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure
azure-diagnostics
microsoft/azure-skills
Debug Azure production issues on Azure using AppLens, Azure Monitor, resource health, and safe triage. WHEN: debug production issues, troubleshoot app service, app service high CPU, app service deployment failure, troubleshoot container apps, container app 503 or target port mismatch, troubleshoot functions, function telemetry missing or stopped after a config/connection-string change, troubleshoot AKS, VM RDP, Linux SSH, VM black screen, can't connect to VM, reset VM password, NSG or firewall blocking, kubectl cannot connect, kube-system/CoreDNS failures, pod pending, crashloop, node not ready, upgrade failures, analyze logs, KQL, insights, image pull failures, cold start issues, health probe failures, resource health, root cause of errors, troubleshoot event hubs, troubleshoot service bus, messaging SDK error, AMQP connection failure, message lock lost, lock renewal during long-running processing, service bus dead letter.
azure-prepare
microsoft/azure-skills
Prepare azd-based Azure projects for deployment: generates azure.yaml, infrastructure (Bicep/Terraform), and Dockerfiles for the Azure Developer CLI (azd) workflow. USE ONLY when the user explicitly wants to use azd as the deployment tool, or the project already has an azure.yaml file. DO NOT USE FOR: non-azd deployments, Python App Service code-only deploys (use python-appservice-deploy), or cross-cloud migration (use azure-cloud-migrate). WHEN: prepare app for azd, create azure.yaml, set up azd infrastructure, modernize app for Azure with azd, deploy with azd, function app, timer trigger, service bus trigger, event-driven function, managed identity, generate Bicep, generate Terraform, create and deploy to Azure.
azure-ai
microsoft/azure-skills
Use for Azure AI: Search, Speech, OpenAI, Document Intelligence. Helps with search, vector/hybrid search, speech-to-text, text-to-speech, transcription, OCR. WHEN: AI Search, query search, vector search, hybrid search, semantic search, speech-to-text, text-to-speech, transcribe, OCR, convert text to speech.
azure-deploy
microsoft/azure-skills
Execute Azure deployments for ALREADY-PREPARED applications that have existing .azure/deployment-plan.md and infrastructure files. DO NOT use this skill when the user asks to CREATE a new application — use azure-prepare instead. This skill runs azd up, azd deploy, terraform apply, and az deployment commands with built-in error recovery. Requires .azure/deployment-plan.md from azure-prepare and validated status from azure-validate. WHEN: "run azd up", "run azd deploy", "execute deployment", "push to production", "push to cloud", "go live", "ship it", "bicep deploy", "terraform apply", "publish to Azure", "launch on Azure". DO NOT USE WHEN: "create and deploy", "build and deploy", "create a new app", "set up infrastructure", "create and deploy to Azure using Terraform" — use azure-prepare for these.
azure-validate
microsoft/azure-skills
Pre-deployment validation for Azure readiness. Run deep checks on configuration, infrastructure (Bicep or Terraform), RBAC role assignments, managed identity permissions, and prerequisites before deploying. WHEN: validate my app, check deployment readiness, run preflight checks, verify configuration, check if ready to deploy, validate azure.yaml, validate Bicep, test before deploying, troubleshoot deployment errors, validate Azure Functions, validate function app, validate serverless deployment, verify RBAC roles, check role assignments, review managed identity permissions, what-if analysis, validate Container Apps deployment.