Bash Defensive Patterns

Master defensive Bash programming techniques for production-grade scripts. Use when writing robust shell scripts, CI/CD pipelines, or system utilities requiring fault tolerance and safety.

2,047 stars 295 forksDevOps & Cloud

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add rmyndharis/antigravity-skills --skill bash-defensive-patterns
Manual install
git clone --depth 1 https://github.com/rmyndharis/antigravity-skills.git /tmp/antigravity-skills
mkdir -p ~/.claude/skills
cp -r /tmp/antigravity-skills/skills/bash-defensive-patterns ~/.claude/skills/bash-defensive-patterns

Personal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.

From the SKILL.md

# Bash Defensive Patterns

Comprehensive guidance for writing production-ready Bash scripts using defensive programming techniques, error handling, and safety best practices to prevent common pitfalls and ensure reliability.

## Use this skill when

- Writing production automation scripts
- Building CI/CD pipeline scripts
- Creating system administration utilities
- Developing error-resilient deployment automation
- Writing scripts that must handle edge cases safely
- Building maintainable shell script libraries
- Implementing comprehensive logging and monitoring
- Creating scripts that must work across different platforms

## Do not use this skill when

- You need a single ad-hoc shell command, not a script
- The target environment requires strict POSIX sh only
- The task is unrelated to shell scripting or automation

## Instructions

1. Confirm the target shell, OS, and execution environment.
2. Enable strict mode and safe defaults from the start.
3. Validate inputs, quote variables, and handle files safely.
4. Add logging, error traps, and basic tests.

## Safety

- Avoid destructive commands without confirmation or dry-run flags.
- Do not run scripts as root unless strictly required.

Refer to `resources/implementation-playbook.md` for detailed patterns, checklists, and templates.

## Resources

- `resources/implementation-playbook.md` for detailed patterns, checklists, and templates.
Read the full skill on GitHub

Details

Skill name
bash-defensive-patterns
Path
skills/bash-defensive-patterns/SKILL.md
License
MIT
Repo updated
7 November 2026
Copies
Found in 3 GitHub repos

FAQ

What does the Bash Defensive Patterns skill do?

Master defensive Bash programming techniques for production-grade scripts. Use when writing robust shell scripts, CI/CD pipelines, or system utilities requiring fault tolerance and safety.

How do I install the Bash Defensive Patterns skill?

skills CLI (Claude Code, Cursor, Codex and more): npx skills add rmyndharis/antigravity-skills --skill bash-defensive-patterns. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.

Is Bash Defensive Patterns popular?

It lives in rmyndharis/antigravity-skills, which has 2,047 GitHub stars and 295 forks.

Related skills

Airflow Dag Patterns

2k

rmyndharis/antigravity-skills

Build production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.

Testing & QA295

Agent Orchestration Improve Agent

2k

rmyndharis/antigravity-skills

Systematic improvement of existing agents through performance analysis, prompt engineering, and continuous iteration.

AI, LLMs & Agents295

Agent Orchestration Multi Agent Optimize

2k

rmyndharis/antigravity-skills

Optimize multi-agent systems with coordinated profiling, workload distribution, and cost-aware orchestration. Use when improving agent performance, throughput, or reliability.

AI, LLMs & Agents295

Cloud Architect

2k

rmyndharis/antigravity-skills

Expert cloud architect specializing in AWS/Azure/GCP multi-cloud infrastructure design, advanced IaC (Terraform/OpenTofu/CDK), FinOps cost optimization, and modern architectural patterns. Masters serverless, microservices, security, compliance, and disaster recovery. Use for cloud architecture, cost optimization, migration planning, or multi-cloud strategies.

DevOps & Cloud295

Crw Self Host

1.3k

fastcrw/crw

Stand up your own fastCRW API server — single binary, Docker, or docker-compose with a bundled search-backend sidecar. Use when the user wants to run crw locally or on their own infra, configure renderers/proxies/ auth/LLM extraction, or understand the embedded vs proxy MCP modes.

DevOps & CloudIn 1 list102

Cost Optimization

2k

rmyndharis/antigravity-skills

Optimize cloud costs through resource rightsizing, tagging strategies, reserved instances, and spending analysis. Use when reducing cloud expenses, analyzing infrastructure costs, or implementing cost governance policies.

DevOps & Cloud295

Browse the most popular Claude skills, all devops & cloud skills, or write your own with the skills generator.