MCPInstall

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
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads bash-script-validator automatically when relevant.

  3. 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:

  1. Syntax validation (bash -n or sh -n)
  2. ShellCheck static analysis (system binary or wrapper fallback)
  3. 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 .sh file"
  • "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

  1. Confirm target path exists and is readable.
  2. Confirm bash is available.
  3. 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 (0 clean, 1 warnings, 2 errors)
  • 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:

  1. Exact location from validator output (line number and snippet)
  2. Root cause
  3. Corrected code
  4. Why the change is safer or more portable
  5. 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:

  1. Continue until no new errors are introduced.
  2. If warnings remain by design, document why they are intentionally accepted.
  3. If constraints prevent full resolution, report unresolved items with a clear next action.
  4. 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.

ConstraintFallback actionReporting requirement
shellcheck missing, wrapper availableLet scripts/validate.sh use scripts/shellcheck_wrapper.sh --cache automaticallyState that wrapper mode was used
shellcheck and wrapper unavailableRun syntax + custom checks only (validator does this)Explicitly call out reduced coverage and missing ShellCheck analysis
Python unavailable for wrapperSkip wrapper path, keep syntax + custom checksState why ShellCheck could not run
Target file is read-onlyProvide precise patch suggestions without editingMark response as "advisory only"
Target file missing or unreadableStop and request a valid file pathDo not fabricate results
Binary/non-text inputStop validationReport 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 -> Solution
  • Reference: docs/shellcheck-reference.md -> SC2164: Use || exit After cd
  • Reference: docs/shell-reference.md -> POSIX Best Practices -> 5. Avoid Bashisms

Citation rules:

  1. Cite the most specific section that justifies the fix.
  2. For ShellCheck findings, include both the SC#### code and the matching section.
  3. 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 Results
  • Command: bash scripts/validate.sh <script-path>
  • Detected shell: <shell>
  • Exit code: <code>
  • Summary: <errors> errors, <warnings> warnings, <info> info
  • Issue: <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 entrypoint
  • scripts/shellcheck_wrapper.sh: optional ShellCheck fallback using a cached Python virtual environment

Detection and Ordering

Validation order in scripts/validate.sh:

  1. File checks (exists/readable/text)
  2. Shebang-based shell detection
  3. Syntax check
  4. ShellCheck (or fallback/skip behavior)
  5. Custom checks
  6. Summary with exit code

Exit Codes

  • 0: no issues found
  • 1: warnings found
  • 2: errors found

References

Load only what is needed:

  • docs/bash-reference.md
  • docs/shell-reference.md
  • docs/shellcheck-reference.md
  • docs/common-mistakes.md
  • docs/grep-reference.md
  • docs/awk-reference.md
  • docs/sed-reference.md
  • docs/regex-reference.md

Done Criteria

This skill update is complete when all are true:

  1. Trigger guidance is explicit (positive and non-trigger examples).
  2. Default workflow is deterministic and ordered.
  3. Fallback behavior is explicit for missing tooling and constrained environments.
  4. Fix explanations include subsection-level citations.
  5. Post-fix rerun policy is mandatory and reported with exit codes.
  6. 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

View all →

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.

DevOps & Cloud1.2K installs

k8s-debug

akin-ozer/cc-devops-skills

Diagnose and fix Kubernetes pods, CrashLoopBackOff, Pending, DNS, networking, storage, and rollout failures with kubectl.

DevOps & Cloud825 installs

ansible-generator

akin-ozer/cc-devops-skills

Generate, create, or scaffold Ansible playbooks, roles, tasks, handlers, inventory, vars.

DevOps & Cloud817 installs

jenkinsfile-generator

akin-ozer/cc-devops-skills

Generate/create/scaffold Jenkinsfile — declarative, scripted, shared library, CI/CD pipelines.

DevOps & Cloud809 installs

dockerfile-validator

akin-ozer/cc-devops-skills

Validate, lint, audit, or scan a Dockerfile for security and best practices.

Popular devops & cloud skills

View category →

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

OfficialDevOps & Cloud579.1K installs

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.

OfficialDevOps & Cloud569.8K installs

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.

OfficialDevOps & Cloud569K installs

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.

OfficialDevOps & Cloud568.8K installs

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.

OfficialDevOps & Cloud568.6K installs

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.

OfficialDevOps & Cloud568K installs