sh-style-guide

Define POSIX sh syntax and safety rules for portable shell scripts.

7|Updated Feb 14, 2026
One-click install
npx skills add https://github.com/KentoShimizu/sw-agent-skills --skill sh-style-guide
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sh-style-guide
Source: https://github.com/KentoShimizu/sw-agent-skills/tree/main/skills/sh-style-guide
Command: npx skills add https://github.com/KentoShimizu/sw-agent-skills --skill sh-style-guide

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

POSIX sh scripts often suffer from portability and safety issues when moved across environments, CI workflows, or shells without Bash enhancements. This guide defines a portable baseline for style, readability, and robust behavior to reduce errors in shell automation.

Core Features & Use Cases

  • Portable syntax rules for POSIX sh across shells and environments.
  • Safety recommendations including set -eu, strict quoting, and explicit error handling.
  • Guidance for readability, maintainability, and CI-friendly scripting practices.

Quick Start

Align new and existing shell scripts to POSIX-compliant conventions and enable the recommended safety checks.

Frequently Asked Questions about sh-style-guide

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

FAQPage Schema
How do I make POSIX sh scripts portable across different environments and CI workflows?

To make POSIX sh scripts portable, enforce POSIX-only syntax and apply strict safety rules like set -eu and explicit error handling. This ensures shell scripts run consistently across different environments and CI workflows without relying on Bash enhancements.

What is the safest way to handle errors in shell scripting using POSIX sh?

The safest way to handle errors in POSIX sh scripting is using set -eu for strict error checking, applying strict quoting, and implementing explicit error handling. These practices prevent silent failures and maintain robust behavior in automation.

Does my shell script need to be POSIX compliant for cross-platform tooling?

Yes, shell scripts need POSIX compliance for cross-platform tooling to avoid portability issues. Without POSIX-only syntax, scripts moved across environments or shells without Bash enhancements often break, causing failures in cross-platform automation.

What's the best way to standardize readability and style for POSIX sh scripts?

The best way to standardize POSIX sh style and readability is aligning scripts to POSIX-compliant conventions. This includes portable syntax rules, standardized guidance, and CI-friendly scripting practices that reduce errors and improve maintainability.

Why does my sh script fail when moved to a different shell environment?

Your sh script fails across different shell environments due to non-portable syntax and missing safety checks. Applying POSIX compatibility, set -eu, and explicit error handling resolves these portability and safety issues in shell automation.