---
name: "shellcheck-security-static-analysis"
description: "Audit Bash and POSIX shell scripts for quoting flaws, word splitting, and command injection."
metadata:
  author: "Vidar Holen"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "run shellcheck on script"
  - "fix bash quoting shellcheck"
  - "prevent shell injection shellcheck"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# ShellCheck Bash Security & Quoting Analyzer

Runs ShellCheck static analysis: identifying missing variable quotes, unsafe glob expansions, unquoted array variables, and fragile command substitutions.

## When to Invoke
Invoke this skill whenever you need to:
- run shellcheck on script
- fix bash quoting shellcheck
- prevent shell injection shellcheck

## Execution SOP & Rules
1. Run shellcheck --severity=style scripts/*.sh in automated CI pre-commit checks.
2. Always double-quote variables containing filenames or user inputs: rm -f "$FILE".
3. Use printf rather than echo to output arbitrary variables safely.
4. Enforce set -euo pipefail to ensure scripts exit immediately on error or unbound variables.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
