shell

Enforce Bash scripting best practices for macOS portability and readability.

16|1|Updated Jun 26, 2025
One-click install
npx skills add https://github.com/bendrucker/claude --skill shell
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shell
Source: https://github.com/bendrucker/claude/tree/main/.claude/skills/shell
Command: npx skills add https://github.com/bendrucker/claude --skill shell

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill ensures shell scripts are readable, maintainable, and compatible with macOS environments, preventing common cross-platform issues.

Core Features & Use Cases

  • Readability: Promotes --long-flags for clearer command-line arguments.
  • macOS Compatibility: Guides towards using macOS-native commands, avoiding GNU tool dependencies.
  • Use Case: When automating a task on your Mac, this Skill helps you write robust Bash scripts that work seamlessly without unexpected errors due to tool differences.

Quick Start

Example of using long flags for clarity

ls --almost-all --human-readable

Example of macOS compatible command

Use 'sed -i ""' for in-place edit on macOS

sed -i "" 's/old/new/g' myfile.txt

Frequently Asked Questions about shell

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write Bash scripts that work on macOS without GNU tool errors?

Bash scripts on macOS require awareness of BSD vs. GNU tool differences. This Skill enforces macOS-compatible practices like using `sed -i ""` for in-place edits and avoiding GNU-only flags, ensuring scripts run reliably without unexpected failures across macOS environments.

Why should I use long-form flags in shell scripts?

Long-form flags like `--almost-all` instead of `-a` improve readability and maintainability of shell scripts. They make command intent explicit and reduce errors when scripts are revisited or shared, especially critical for complex automation tasks on macOS.

What are shell scripting best practices for automation on macOS?

Shell scripting best practices include explicit error handling, thorough inline documentation, consistent indentation, proper quoting, and portability considerations across BSD/GNU tools. These practices ensure automated Bash scripts are readable, maintainable, and function reliably on macOS.

Can I use the same shell commands across macOS and Linux systems?

Not always—macOS uses BSD tools while Linux typically uses GNU equivalents, causing command syntax differences. This Skill guides you toward portable constructs and macOS-native commands, helping you write scripts that account for these cross-platform variations.

How do I structure Bash scripts for readability and maintainability?

Structure Bash scripts through clear indentation, meaningful variable names, explicit quoting to prevent word splitting, and thorough inline documentation explaining intent. These conventions make scripts easier to debug, modify, and maintain over time.