bash-scripting
sickn33/agentic-awesome-skills
Workflow for creating production-ready bash scripts with defensive patterns, error handling, and testing.
What is bash-scripting?
A structured workflow for building robust shell scripts with defensive programming, comprehensive error handling, and automated testing. Use this when creating automation, system administration, deployment, or CI/CD scripts that need to be reliable and maintainable.
- Design scripts with clear purpose, inputs, outputs, and error-handling strategy
- Implement strict mode, argument parsing, logging, and cleanup handlers
- Add comprehensive error handling with trap handlers, retry logic, and rollback capability
- Write and run Bats tests and ShellCheck linting for quality assurance
- Create structured logging with levels, timestamps, and debug modes
- Document scripts with headers, function descriptions, usage examples, and dependencies
How to install bash-scripting
npx skills add https://github.com/sickn33/agentic-awesome-skills --skill bash-scriptingHow to use bash-scripting
- 1.Define your script's purpose, inputs, outputs, and error-handling requirements
- 2.Use bash-pro and bash-defensive-patterns to design the script structure with shebang, strict mode, and argument parsing
- 3.Implement core functionality using bash-linux and linux-shell-scripting skills
- 4.Add comprehensive error handling with trap handlers, retry logic, and exit codes using bash-defensive-patterns
- 5.Implement structured logging with levels and timestamps using bash-pro
- 6.Write Bats tests and run ShellCheck linting using bats-testing-patterns and shellcheck-configuration
- 7.Document the script with headers, function descriptions, usage examples, and troubleshooting information
Use cases
- Building deployment and CI/CD automation scripts with robust error handling
- Creating system administration tools for backup, monitoring, or maintenance tasks
- Developing infrastructure automation that requires defensive patterns and comprehensive logging
- Writing shell scripts that need to be tested, linted, and documented for production use
- Implementing scripts with retry logic, rollback capability, and detailed error reporting
- DevOps engineers and system administrators
- Backend developers building automation tools
- Infrastructure engineers creating deployment scripts
- Anyone writing shell scripts intended for production environments
bash-scripting FAQ
Strict mode uses `set -euo pipefail` to exit on errors, treat undefined variables as errors, and fail on pipe errors—making scripts more defensive and easier to debug.
Use this workflow when creating scripts for production, automation, or systems that need to be reliable, maintainable, and tested. For one-off scripts, simpler approaches may suffice.
The workflow uses Bats (Bash Automated Testing System) for writing and running tests, combined with ShellCheck for static linting and code quality checks.
It uses trap handlers to catch errors, implements retry logic for transient failures, provides clear error messages, sets appropriate exit codes, and includes rollback capability where needed.
Include a script header with purpose, document all functions with their inputs and outputs, provide usage examples, list dependencies, and add a troubleshooting section.
Full instructions (SKILL.md)
Source of truth, from sickn33/agentic-awesome-skills.
name: bash-scripting description: "Bash scripting workflow for creating production-ready shell scripts with defensive patterns, error handling, and testing." category: granular-workflow-bundle risk: safe source: personal date_added: "2026-02-27"
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 scriptingbash-defensive-patterns- Defensive patterns
Actions
- Define script purpose
- Identify inputs/outputs
- Plan error handling
- Design logging strategy
- Document requirements
Copy-Paste Prompts
Use @bash-pro to design production-ready bash script
Phase 2: Script Structure
Skills to Invoke
bash-pro- Script structurebash-defensive-patterns- Safety patterns
Actions
- Add shebang and strict mode
- Create usage function
- Implement argument parsing
- Set up logging
- 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 commandslinux-shell-scripting- Shell scripting
Actions
- Implement main functions
- Add input validation
- Create helper functions
- Handle edge cases
- Add progress indicators
Copy-Paste Prompts
Use @bash-linux to implement system commands
Phase 4: Error Handling
Skills to Invoke
bash-defensive-patterns- Error handlingerror-handling-patterns- Error patterns
Actions
- Add trap handlers
- Implement retry logic
- Create error messages
- Set up exit codes
- 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
- Create logging function
- Add log levels
- Implement timestamps
- Configure log rotation
- Add debug mode
Copy-Paste Prompts
Use @bash-pro to implement structured logging
Phase 6: Testing
Skills to Invoke
bats-testing-patterns- Bats testingshellcheck-configuration- ShellCheck
Actions
- Write Bats tests
- Run ShellCheck
- Test edge cases
- Verify error handling
- 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
- Add script header
- Document functions
- Create usage examples
- List dependencies
- Add troubleshooting section
Copy-Paste Prompts
Use @documentation-templates to document bash script
Script Template
#!/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 scriptinglinux-troubleshooting- Linux troubleshootingcloud-devops- DevOps automation
Limitations
- Use this skill only when the task clearly matches the scope described above.
- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Related skills
More from sickn33/agentic-awesome-skills and the wider catalog.

blockchain-developer
Build production-ready Web3 applications, smart contracts, and decentralized systems with expert guidance.

brainstorming
Transform vague ideas into validated designs through structured dialogue before implementation.

browser-automation
Build reliable browser automation tests using semantic locators, isolated contexts, and explicit outcome verification.

browser-extension-builder
Build Chrome, Firefox, and cross-browser extensions with Manifest V3, content scripts, and store publishing.

bullmq-specialist
Redis-backed job queues and reliable async execution for Node.js/TypeScript applications.

bun-development
Fast JavaScript/TypeScript development with the Bun runtime—built-in bundler, test runner, and optimized performance.