shell-scripting
Shell scripting best practices for bash and other shells. Use when writing shell scripts, bash functions, or command-line automation.
When & Why to Use This Skill
This Claude skill provides comprehensive best practices for shell scripting, focusing on Bash and other command-line environments. It ensures your automation scripts are robust, maintainable, and error-resistant by implementing industry-standard techniques like Shellcheck validation, proper variable quoting, and strict error handling (set -e, set -u). Ideal for developers and DevOps engineers looking to streamline CI/CD pipelines and system configurations.
Use Cases
- Automating System Maintenance: Create reliable scripts for backups, log rotation, and system monitoring with built-in error handling.
- CI/CD Pipeline Optimization: Write clean, portable shell scripts for build and deployment processes in GitHub Actions, GitLab CI, or Jenkins.
- Environment Setup and Configuration: Develop idempotent scripts to automate the provisioning of developer environments and server configurations.
- Legacy Script Refactoring: Modernize existing bash scripts by applying best practices like proper variable scoping and Shellcheck-compliant syntax.
| name | shell-scripting |
|---|---|
| description | Shell scripting best practices for bash and other shells. Use when writing shell scripts, bash functions, or command-line automation. |
Shell Scripting Skill
When to Use
- Writing bash scripts
- Creating shell functions
- Automating command-line tasks
- Setting up environment configurations
- Writing CI/CD scripts
Guidelines
Comprehensive shell scripting best practices: @general.md
Key Principles
- Use shellcheck for validation
- Handle errors with set -e and set -u
- Quote variables properly
- Use meaningful variable names
- Document complex logic
- Test scripts thoroughly