shell-conventions

Enforce bash and zsh scripting conventions for .sh, .bash, and .zsh files.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/mojwang/macbook-dev-setup --skill shell-conventions-mojwang
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: shell-conventions
Source: https://github.com/mojwang/macbook-dev-setup/tree/main/.claude/skills/shell-conventions
Command: npx skills add https://github.com/mojwang/macbook-dev-setup --skill shell-conventions-mojwang

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Shell scripts often suffer from inconsistent practices, leading to errors and maintenance challenges. This skill defines a standardized set of conventions for Bash and Zsh to improve safety, readability, and reliability for scripts with .sh, .bash, or .zsh extensions.

Core Features & Use Cases

  • Enforces a proper script header with #!/usr/bin/env bash and set -e
  • Enforces timeouts for external commands and safe resource cleanup using traps
  • Enforces consistent variable quoting and safe substitutions
  • Encourages modular Zsh configuration and clear error handling
  • Useful for creating, reviewing, and auditing shell scripts in projects

Quick Start

Apply these conventions to your next script by ensuring the correct shebang, set -e, timeouts, and a trap-based cleanup.

Frequently Asked Questions about shell-conventions

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

FAQPage Schema
What are the standard conventions for safe bash scripting?

Safe bash scripting conventions require a proper shebang like #!/usr/bin/env bash, set -e for immediate error exit, consistent variable quoting, and trap-based cleanup to ensure reliable execution and maintainability.

How do I set up trap-based cleanup in shell scripts?

Trap-based cleanup in shell scripts uses the trap command to catch signals and errors, executing cleanup routines when a script exits, ensuring safe resource release and consistent state management across bash and zsh environments.

Does this shell scripting standard apply to both bash and zsh extensions?

Yes, these shell scripting standards apply to scripts with .sh, .bash, and .zsh extensions, enforcing consistent practices for both bash and zsh to improve safety, readability, and reliability across different shell environments.

Why do I need set -e and timeouts in shell scripts?

Using set -e and timeouts in shell scripts prevents silent failures and hanging processes. set -e forces immediate exit on errors, while timeouts restrict external command execution, improving overall script safety.

What is the best way to handle errors and modular configuration in zsh?

Handling errors and modular configuration in zsh involves applying trap-based cleanup, enforcing proper variable quoting, and organizing configurations into modular components to improve maintainability and reduce scripting errors.

When should I not use set -e in bash scripts?

While set -e is standard for bash scripts, it may not suit scripts intentionally designed to tolerate non-zero exit codes from specific commands, requiring careful error handling instead of immediate termination.