
Bash Scripting
Follow a three-phase workflow to design, structure, and implement production bash scripts with strict mode, defensive patterns, and tests for deploy and ops automation.
Overview
Bash Scripting is an agent skill most often used in Ship (also Build, Operate) that orchestrates a three-phase workflow for production-ready shell scripts with defensive patterns and testing.
Install
npx skills add https://github.com/sickn33/antigravity-awesome-skills --skill bash-scriptingWhat is this skill?
- Three workflow phases: Script Design, Script Structure, Core Implementation
- Invokes bash-pro and bash-defensive-patterns for strict mode, argument parsing, and cleanup handlers
- Covers automation, sysadmin tools, deployment scripts, backups, and CI/CD scripts
- Copy-paste @bash-pro and @bash-defensive-patterns prompts per phase
- Plans logging strategy, usage function, and error handling before writing core logic
- 3 workflow phases: Script Design, Script Structure, Core Implementation
Adoption & trust: 935 installs on skills.sh; 40.1k GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need reliable deploy or ops automation but agent-generated bash tends to skip strict mode, usage docs, and safe failure paths.
Who is it for?
Solo builders writing deployment hooks, backup jobs, or CI glue who want repeatable agent phases instead of one-shot script dumps.
Skip if: Greenfield apps better served by Makefile, Python, or platform-native deploy tools when bash adds no portability win.
When should I use this skill?
Creating automation scripts, system administration tools, deployment scripts, backup solutions, or CI/CD scripts.
What do I get? / Deliverables
You get a documented script design, structured skeleton with logging and traps, then core logic—using @bash-pro and @bash-defensive-patterns at each gate.
- Production-oriented .sh script with usage, parsing, and logging
- Phase design notes covering inputs, outputs, and error strategy
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Ship is the canonical shelf because the workflow explicitly targets deployment scripts, CI/CD, backups, and system administration—work you do when moving code safely to production. Launch subphase covers release-oriented automation (deploy pipelines, preflight scripts) rather than one-off local hacks.
Where it fits
Add a repo-local setup.sh with argument parsing and usage text for new contributors.
Author a release script that tags, builds, and uploads artifacts with trap-based cleanup on failure.
Create scheduled backup scripts with structured logging for a single VPS.
How it compares
Use this phased workflow skill instead of asking the agent for a single monolithic bash file without strict mode or test plan.
Common Questions / FAQ
Who is bash-scripting for?
Indie developers and small teams who automate servers, releases, and backups with shell scripts and want agents to follow a structured production checklist.
When should I use bash-scripting?
During Build when scaffolding repo scripts, during Ship for deployment and CI/CD scripts, and during Operate for backup and sysadmin tooling—whenever automation must survive real failure modes.
Is bash-scripting safe to install?
The workflow encourages defensive patterns but generated scripts may still run destructive commands; review the Security Audits panel on this page and dry-run on staging before production.
Workflow Chain
Requires first: bash pro, bash defensive patterns
SKILL.md
READMESKILL.md - Bash Scripting
# Bash Scripting Workflow ## Overview Specialized workflow for creating robust, production-ready bash scripts with defensive programming patterns, comprehensive error handling, and automated testing. ## When to Use This Workflow Use this workflow when: - Creating automation scripts - Writing system administration tools - Building deployment scripts - Developing backup solutions - Creating CI/CD scripts ## Workflow Phases ### Phase 1: Script Design #### Skills to Invoke - `bash-pro` - Professional scripting - `bash-defensive-patterns` - Defensive patterns #### Actions 1. Define script purpose 2. Identify inputs/outputs 3. Plan error handling 4. Design logging strategy 5. Document requirements #### Copy-Paste Prompts ``` Use @bash-pro to design production-ready bash script ``` ### Phase 2: Script Structure #### Skills to Invoke - `bash-pro` - Script structure - `bash-defensive-patterns` - Safety patterns #### Actions 1. Add shebang and strict mode 2. Create usage function 3. Implement argument parsing 4. Set up logging 5. Add cleanup handlers #### Copy-Paste Prompts ``` Use @bash-defensive-patterns to implement strict mode and error handling ``` ### Phase 3: Core Implementation #### Skills to Invoke - `bash-linux` - Linux commands - `linux-shell-scripting` - Shell scripting #### Actions 1. Implement main functions 2. Add input validation 3. Create helper functions 4. Handle edge cases 5. Add progress indicators #### Copy-Paste Prompts ``` Use @bash-linux to implement system commands ``` ### Phase 4: Error Handling #### Skills to Invoke - `bash-defensive-patterns` - Error handling - `error-handling-patterns` - Error patterns #### Actions 1. Add trap handlers 2. Implement retry logic 3. Create error messages 4. Set up exit codes 5. Add rollback capability #### Copy-Paste Prompts ``` Use @bash-defensive-patterns to add comprehensive error handling ``` ### Phase 5: Logging #### Skills to Invoke - `bash-pro` - Logging patterns #### Actions 1. Create logging function 2. Add log levels 3. Implement timestamps 4. Configure log rotation 5. Add debug mode #### Copy-Paste Prompts ``` Use @bash-pro to implement structured logging ``` ### Phase 6: Testing #### Skills to Invoke - `bats-testing-patterns` - Bats testing - `shellcheck-configuration` - ShellCheck #### Actions 1. Write Bats tests 2. Run ShellCheck 3. Test edge cases 4. Verify error handling 5. Test with different inputs #### Copy-Paste Prompts ``` Use @bats-testing-patterns to write script tests ``` ``` Use @shellcheck-configuration to lint bash script ``` ### Phase 7: Documentation #### Skills to Invoke - `documentation-templates` - Documentation #### Actions 1. Add script header 2. Document functions 3. Create usage examples 4. List dependencies 5. Add troubleshooting section #### Copy-Paste Prompts ``` Use @documentation-templates to document bash script ``` ## Script Template ```bash #!/usr/bin/env bash set -euo pipefail readonly SCRIPT_NAME=$(basename "$0") readonly SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) log() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] $*"; } error() { log "ERROR: $*" >&2; exit 1; } usage() { cat <<EOF Usage: $SCRIPT_NAME [OPTIONS] Options: -h, --help Show help -v, --verbose Verbose output EOF } main() { log "Script started" # Implementation log "Script completed" } main "$@" ``` ## Quality Gates - [ ] ShellCheck passes - [ ] Bats tests pass - [ ] Error handling works - [ ] Logging functional - [ ] Documentation complete ## Related Workflow Bundles - `os-scripting` - OS scripting - `linux-troubleshooting` - Linux troubleshooting - `cloud-devops` - DevOps automation ## Limitations - Use this skill only when the task clearly matches the sco