shell-script-audit

Audit and harden bash and zsh scripts for error handling, quoting, portability, and security.

Updated Mar 29, 2026
One-click install
npx skills add https://github.com/r-senchuk/agentskills --skill shell-script-audit-r-senchuk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: shell-script-audit
Source: https://github.com/r-senchuk/agentskills/tree/main/.agents/skills/shell-script-audit
Command: npx skills add https://github.com/r-senchuk/agentskills --skill shell-script-audit-r-senchuk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Shell scripts often contain silent failure modes, unquoted expansions, portability traps, and security holes that only surface in production. This Skill provides a structured audit workflow that finds these issues, reports them with severity levels, and applies targeted fixes. ## Core Features & Use Cases - Static Analysis: Runs syntax checks (bash -n, zsh -n) and ShellCheck, then performs a manual review across error handling, quoting, portability, input validation, security, and style categories. - Severity-Ranked Findings: Produces a findings table with line numbers, severity (critical/warning/info), category, and concrete fixes for each issue. - Fix and Validate: Applies fixes for critical and warning findings, then re-validates with syntax checks and ShellCheck to confirm no regressions. - Use Case: Point it at a scripts/ directory before a release to catch unquoted rm -rf $dir calls, missing set -euo pipefail, and macOS/Linux sed -i incompatibilities before they cause incidents. ## Quick Start Audit all shell scripts in the scripts directory for bash portability and error handling issues, then apply fixes for critical findings.

Frequently Asked Questions about shell-script-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I audit a bash script for bugs and security issues?▼

Run a syntax check with bash -n, run ShellCheck for automated warnings, then manually review error handling, quoting, input validation, and security patterns. This Skill automates that full workflow and produces a severity-ranked findings table with fixes.

What is the difference between bash and zsh script portability?▼

Bash and zsh share features like [[ ]] and set -o pipefail, but zsh-only constructs like ${var:h} and setopt fail in bash. POSIX sh scripts cannot use arrays, [[ ]], or pipefail at all, so the audit checks each script against its declared shebang shell.

Does this work without ShellCheck installed?▼

Yes. If ShellCheck is unavailable, the audit falls back to manual static analysis covering the same categories: error handling, quoting, portability, input validation, security, and style. Syntax checks with bash -n or zsh -n still run.

Can I use this to write a new shell script from scratch?▼

No. This Skill is scoped to reviewing, hardening, and fixing existing scripts only. Writing new scripts from scratch should use a standard coding workflow, as stated in the Skill's usage boundaries.

Why does my script break on macOS but work on Linux?▼

Common causes are GNU-only flags like sed -i without a backup argument, which macOS BSD sed rejects, and hardcoded Linux paths. The portability review flags these and suggests cross-platform alternatives.