bash-scripting
Helps your agent write production-ready shell scripts. It includes defensive patterns, error handling, and testing for greater reliability.
What it does
This guide helps you create robust, production-ready automation scripts. It teaches you how to add safety, error handling, and testing to ensure your scripts work correctly.
When to use it
- ✓When you need to automate repetitive tasks on your computer.
- ✓When creating tools to manage systems.
- ✓To build scripts that help deploy or back up files.
Example of what to ask your AI
“Help me create a secure script to back up my important files.”
Want more? Open the sections below.
How to use
The easiest way: copy the message below and paste it into Claude, ChatGPT, Cursor or any AI. It reads the skill and follows the instructions.
Skill link
Ready-to-paste message
How it works
The guide is divided into steps, like planning the script, writing the core code, adding error handling, and testing everything. It suggests specific tools and commands for each step.
Installation
Easiest way: copy the skill link and paste it into Claude, ChatGPT or Cursor asking it to follow the instructions.
In the terminal (Claude Code, Codex, Cursor), in your project folder:
npx skills add sickn33/agentic-awesome-skills --skill bash-scriptingOr download just the file:
curl -L https://raw.githubusercontent.com/sickn33/agentic-awesome-skills/main/plugins/agentic-awesome-skills-claude/skills/bash-scripting/SKILL.md -o SKILL.mdTechnical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
Scope and execution
Choose the phases that match the user’s task; this document is an index, not an instruction to run every listed skill. Read a selected skill before using it. Respect repository and user constraints. Cloud calls, host configuration, publishing, destructive operations and spending require the applicable authorization; a workflow checklist does not grant it.
The template is a starting point, not a completed script: it does not implement argument parsing or rollback. Validate paths, quote expansions, test in a disposable directory, and make retries bounded and safe for the specific command. Never log credentials or imply strict mode catches every failure.
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
SCRIPT_NAME=$(basename -- "$0")
readonly SCRIPT_NAME
SCRIPT_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
readonly SCRIPT_DIR
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.
…
FAQ
What are 'defensive patterns'?
These are programming practices that make a script safer and less prone to errors, like checking if files exist before using them.
What is 'error handling'?
This is how the script deals with unexpected problems, like command failures, so it doesn't suddenly stop working and reports what went wrong.
Why test scripts?
Testing ensures the script does what it's supposed to do in different situations and that error handling works as expected before you use it for important tasks.
Details
Original description by the author
Bash scripting workflow for creating production-ready shell scripts with defensive patterns, error handling, and testing.
Popularity
- GitHub stars
- 48k
- Ranking position
- #2403
- License
- MIT
- Updated
- 10/15/2026
Comments
- …
More skills from this repository
00-andruia-consultant
Helps your agent start or improve AI projects. It analyzes code, suggests tools, and creates action plans in Spanish.
sickn33/agentic-awesome-skills
007
Lets your agent perform security audits and threat modeling. It's useful for protecting projects against attacks and vulnerabilities.
sickn33/agentic-awesome-skills
10-andruia-skill-smith
Helps your agent create or improve AI tools. It defines how tools work, writes documentation, and validates the structure.
sickn33/agentic-awesome-skills
20-andruia-niche-intelligence
Lets your agent create a summary about a specific industry. It's useful for understanding the context, rules, usage patterns, and risks of a project, using reliable sources.
sickn33/agentic-awesome-skills
Similar skills
benchmark-optimization-loop
Has your agent improve something's speed in a measured way. It tests multiple versions and chooses the fastest one that still works correctly.
affaan-m/ECC
change-impact
Helps your agent analyze the impact of code changes before making them. It compares the planned vs. actual results afterward, covering paths, data, tests, and documentation. Useful for risky or system-wide changes.
affaan-m/ECC
click-path-audit
Lets your agent trace all user buttons and interactions to find bugs. It finds issues where functions seem to work alone but fail together. Useful when bugs persist even after debugging.
affaan-m/ECC