# Shell Scripting Guidelines

> Objective: Define standards for writing robust, portable, and safe shell scripts for automation, CI/CD pipelines, and developer tooling, covering safety flags, variables, portability, error handling, and cross-platform compatibility.

::: tip Source File
View the full rule: [`.agent/rules/shell.md`](https://github.com/snowdreamtech/template/blob/main/.agent/rules/shell.md)
:::

## Sections

- 1. Safety Flags & Script Header
- 1. Variables & Quoting
- 1. Functions & Structure
- 1. Portability & Best Practices
- 1. Error Handling & Tooling
- 1. Cross-Platform Delegation Pattern
- 1. Linting Requirements (All Script Types)
- 1. High-Performance & Robustness Patterns
- 1. Defensive Tool Installation Pattern (MANDATORY)
- 1. Language-Specific Best Practices
