bash-cli-best-practices
CommunityBuild safer bash CLIs that don’t break in prod.
System Documentation
What problem does it solve?
This Skill prevents common production failures in bash-based operational CLIs by enforcing robust error handling, safe deletion, reliable subcommand routing, and SQL-injection-resistant database access.
Core Features & Use Cases
- Production-grade bash CLI patterns: applies a tested combination of
set -euo pipefail, strict quoting, and centralized subcommand dispatch to reduce silent failures and argument bugs. - Safe operations and lifecycle management: uses
mvto a timestamped_trashinstead ofrm -rf, plus PID files withkill -0to avoid duplicate starts and zombie PID files. - Operational readiness checks and backgrounding: provides a curl-based health-check polling loop and a
setsid nohupapproach so services survive shell exit. - SQL injection safety for sqlite from bash: recommends running sqlite queries via Python prepared statements with parameter binding (using environment variables to avoid unsafe interpolation).
- Use cases: starting/stopping supervisor-like service stacks, admin CLIs for user/quota management, and health monitor scripts for deployment recovery and incident response.
Quick Start
Ask an AI to generate a bash operational CLI for your service by following the eight patterns in bash-cli-best-practices, including set -euo pipefail, case-based subcommand dispatch, _trash-based safe deletion, curl health polling, setsid nohup backgrounding, and sqlite access via Python ? prepared statements.
Dependency Matrix
Required Modules
None requiredComponents
Standard package💻 Claude Code Installation
Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.
Please help me install this Skill: Name: bash-cli-best-practices Download link: https://github.com/saintgo7/claude-skills/archive/main.zip#bash-cli-best-practices Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
Agent Skills Search Helper
Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.