bash-cli-best-practices

Community

Build safer bash CLIs that don’t break in prod.

Authorsaintgo7
Version1.0.0
Installs0

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 mv to a timestamped _trash instead of rm -rf, plus PID files with kill -0 to avoid duplicate starts and zombie PID files.
  • Operational readiness checks and backgrounding: provides a curl-based health-check polling loop and a setsid nohup approach 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 required

Components

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.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 471,000+ vetted skills library on demand.