bash-script
/bash-script
Use when writing or editing a Bash script (a `.sh` file or one with a Bash shebang). Covers the template, conventions, and required patterns.
- Author
- LandonSchropp ↗
- Repository
- agent-toolkit ↗
- Licence
- MIT
- Last repository change
- 27.10.2026
Assessment and security
- Files in this package
- 4
- Scripts
- 2
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.
MIT, open: use and modify while retaining author attribution.
- 2 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: assets/template-complex.sh, assets/template-simple.sh
What it does and when to use it
Use when writing or editing a Bash script (a `.sh` file or one with a Bash shebang). Covers the template, conventions, and required patterns.
Original author description
Use when writing or editing a Bash script (a `.sh` file or one with a Bash shebang). Covers the template, conventions, and required patterns.
How it works
- Template
- Conventions
- Required patterns
- References
SKILL.md preview
--- name: bash-script description: Use when writing or editing a Bash script (a `.sh` file or one with a Bash shebang). Covers the template, conventions, and required patterns. --- ## Template Two templates cover the two kinds of scripts. Copy the right one exactly and fill in the specific logic. - **Simple:** Scripts intended to be run directly by a user. These typically take either no arguments or a single positional argument. Start from [`assets/template-simple.sh`](assets/template-simple.sh). It shows the one-argument form; if the script takes no arguments, delete the argument check and keep the top comment. - **Complex:** Scripts capable of taking multiple arguments via flags. Skill scripts should _always_ be considered complex scripts. Start from [`assets/template-complex.sh`](assets/template-complex.sh). These always support `--help`. ## Conventions - File: `<name>.sh` with kebab-case (e.g., `extract-pr-number.sh`) - Make the file executable (`chmod +x`) - Flag-based arguments using `--flag-name` (kebab-case). Only use positional args for very simple cases. - Arguments are always required. Never make script arguments optional unless the user _explicitly_ asks for it. - Full variable names (`directory`, not `dir`) - Call other commands with their long flags (`--session=main`, not `-s main`), so the call reads without knowing the command - Exit `0` for success, `1` for errors - stdout for primary output, stderr for errors/warnings/progress messages - Run `shellcheck` on the script when you finish editing it, not after every change - Let a call fail and exit via `set -euo pipefail` instead of wrapping it in `if ! cmd; then`. Only add an explicit check when the failure is actually likely or **needs** a clearer message than the default crash (most don't). ## Required patterns Always: - `set -euo pipefail` at the top of every script - All error messages must start with `Error: ` and go to stderr (`>&2`) - Always quote variable expansions (`"$variable"`) Simple scripts: - A top comment describing what the script does - No `--help` flag - If it takes an argument, print a usage message to stderr and exit `1` when the argument is missing Complex scripts: - `print_help()` function for help output - `--help` flag must be the first case in argument parsing - Always print help to stderr when validation fails or unknown options are provided - Validate required flags after the parsing loop completes - Invalid options must print `Error: The option <option> is invalid.` ## References For colored terminal output, see [`references/colored-echo.md`](references/colored-echo.md).
Files in this package (4)
- SKILL.md 3 KB
- assets/template-complex.sh 1 KB
- assets/template-simple.sh 1 KB
- references/colored-echo.md 1 KB
Versions
The database has no other skills named bash-script.
Database snapshot: 13.11.2026 · package version 9a796123ea43 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 0 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 92write-script-bash
MUST use when writing Bash scripts. - 100bash-script-tests
Use together with bash-script-kiss when the user asks for tests for a bash script: a bats file in tests/ and fake external commands in tests/stubs/. - 90bun-script
Use when writing a TypeScript script with Bun. Covers the template, conventions, and required patterns. - 95bash-script-validator
Comprehensive toolkit for validating, linting, and optimizing bash and shell scripts. Use this skill when working with shell scripts (.sh, .bash), validating script syntax, detecting unquoted variables, checking POSIX compliance, identifying unsafe command substitutions,… - 100linux-bash-scripting
Defensive Bash scripting for Linux: safe foundations, argument parsing, production patterns, ShellCheck compliance. Use when writing "bash script", "shell script", "linux automation", "system script", "cron job", "deployment script", "CLI tool in bash", or "automate with bash". - 100bash-script-helper
Configure with bash script helper operations. Auto-activating skill for DevOps Basics. Triggers on: bash script helper, bash script helper Part of the DevOps Basics skill category. Use when working with bash script helper functionality. Trigger with phrases like "bash script…