# Build Safer Production Bash Scripts

Shell automation often fails through unsafe expansion, weak error handling, and portability gaps. This skill guides defensive Bash design, testing, documentation, and review.

## Install

```bash
npx skillstore add sickn33/bash-pro
```

## Metadata

- Status: approved
- Slug: sickn33-bash-pro
- Skillstore revision: r2
- Version status: missing
- Tree hash: ec56ad4ee9713e44378362811acb604ed040b7e7bcda358526c360d4b7b35bd8
- Author: sickn33
- GitHub username: sickn33
- License: MIT
- Repository: https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/bash-pro
- Ref: 5a26d1d61d694db29af9b138c661c1981076d9df
- Supported tools: Claude, Codex, Claude Code
- Audit status: complete
- Agent install advisory: allowed
- Manual install advisory: allowed
- Artifact signature: available
- Audit attestation: unavailable
- Human verification: not\_verified
- Risk factors: external\_commands, network, filesystem
- Quality score: 78
- Quality tier: bronze
- Public page: https://skillstore.pages.dev/skills/sickn33-bash-pro
- Manifest: https://skillstore.pages.dev/api/skills/sickn33-bash-pro/manifest

## Capabilities

- Designs Bash scripts with strict error handling, validated inputs, and predictable cleanup.
- Reviews quoting, globbing, command substitution, pipelines, and file operations for common safety problems.
- Applies Bash version checks and platform-aware patterns for Linux and macOS portability.
- Creates testing approaches using Bats or ShellSpec and linting workflows using ShellCheck and shfmt.
- Structures command-line interfaces with argument parsing, help text, exit codes, and dry-run behavior.
- Recommends logging, observability, dependency controls, and CI checks for production shell automation.

## Use Cases

- Harden Deployment Automation: Review deployment scripts for quoting, cleanup, error propagation, idempotency, and safe handling of operator input.
- Build Tested Command-Line Tools: Create maintainable Bash utilities with argument parsing, help output, structured logs, and automated tests.
- Standardize CI Shell Checks: Define ShellCheck, shfmt, and Bats checks across supported Bash versions and operating systems.

## Prompt Templates

### Create a Simple Script

```
Create a Bash script that [task]. Define inputs, outputs, failure behavior, and a dry-run option. Explain required commands.
```

### Review an Existing Script

```
Review this Bash script for quoting, input validation, cleanup, pipeline failures, and portability. Rank issues and propose focused corrections: [script]
```

### Add Tests and CI

```
Create a test strategy for [script]. Include Bats cases, ShellCheck and shfmt checks, supported Bash versions, and CI failure criteria.
```

### Design Production Automation

```
Design production Bash automation for [workflow]. Include threat boundaries, idempotency, rollback, observability, dependency checks, concurrency controls, tests, and release validation.
```

## Limitations

- Generated scripts still require review and testing in the target operating environment.
- The guidance targets Bash and does not replace POSIX shell or PowerShell expertise.
- External commands, permissions, versions, and platform behavior must be verified before execution.
- Destructive or privileged operations require explicit boundaries, backups, and human approval.

## Best Practices

- State inputs, permissions, destructive effects, and target platforms before generating or revising a script.
- Run ShellCheck, formatting checks, and focused tests in an isolated environment before production use.
- Request dry-run behavior and explicit confirmation for deletion, privilege changes, or broad file operations.

## Anti Patterns

- Do not execute generated scripts without reviewing paths, variables, dependencies, and command arguments.
- Do not pass untrusted text through eval or construct commands with unsafe string concatenation.
- Do not assume Linux and macOS commands share identical options or output formats.

## Security Audit

- Audited at: 2026-08-14T10:08:12.756\+00:00
- Summary: All 136 static detections are false positives caused by Markdown code formatting, defensive examples, or reference links. The skill contains no executable files or prompt injection.

## Stats

- Views: 100
- Downloads: 12
- Favorites: 0
- Popularity score: 0
