Bash/Shell Cursor Rules

April 15, 2026

Bash/Shell Cursor Rules

Code Style

  • 2 spaces indentation
  • snake_case for functions/variables
  • .sh extension for scripts
  • 100 char line limit

Best Practices

  • Use set -euo pipefail at top
  • Always quote variables
  • Use [[ ]] for tests
  • Use local for function variables
  • Use traps for cleanup
  • Log to stderr

AI Instructions

  • Include shebang (#!/usr/bin/env bash)
  • Add error handling and logging
  • Include usage/help function
  • Add example usage in comments