Skip to content
Skills Library
Programming · Building & coding

shell-scripts

/shell-scripts

Use when writing or reviewing Bash scripts and shell snippets, especially for shebang selection, quoting, parameter expansion ("${VAR}" style), test expressions (`[ ]` vs `[[ ]]`), ShellCheck-guided fixes, and portability decisions across POSIX sh, Bash, and zsh compatibility targets.

Repository
skills ↗
Licence
CC0-1.0
Last repository change
20.10.2026

Assessment and security

90/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content25 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
13
Scripts
3
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 20.10.2026, without references to retired models or APIs.

Licence

CC0-1.0, otwarta.

What to check before installing
  • 3 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: assets/getopts-template.sh, assets/logging-template.sh, assets/script-template.sh

What it does and when to use it

Use when writing or reviewing Bash scripts and shell snippets, especially for shebang selection, quoting, parameter expansion ("${VAR}" style), test expressions (`[ ]` vs `[[ ]]`), ShellCheck-guided fixes, and portability decisions across POSIX sh, Bash, and zsh compatibility targets.

Triggers from the description

${VAR}
Original author description

Use when writing or reviewing Bash scripts and shell snippets, especially for shebang selection, quoting, parameter expansion ("${VAR}" style), test expressions (`[ ]` vs `[[ ]]`), ShellCheck-guided fixes, and portability decisions across POSIX sh, Bash, and zsh compatibility targets.

How it works

  1. Overview
  2. When to Use
  3. Invocation Notice
  4. Workflow
  5. Output
  6. References
Original SKILL.md headings · 73 lines, 394 words
SKILL.md preview
---
name: shell-scripts
description: |-
  Use when writing or reviewing Bash scripts and shell snippets, especially for shebang selection, quoting, parameter expansion ("${VAR}" style), test expressions (`[ ]` vs `[[ ]]`), ShellCheck-guided fixes, and portability decisions across POSIX sh, Bash, and zsh compatibility targets.
---

# Writing Shell Scripts

## Overview

Write shell code with an explicit portability target first, then apply strict quoting and a bounded ShellCheck remediation loop.
Default to Bash readability and safety; switch to POSIX-only mode when the user asks for strict portability.

## When to Use

- Creating or refactoring Bash scripts.
- Reviewing shell snippets for correctness and safety.
- Standardizing shebangs, quoting, variable expansion style, and test syntax.
- Deciding between POSIX-compliant syntax and Bash-specific features.
- Improving compatibility with zsh environments.

**When NOT to use:**

- The task is strictly `fish`, `powershell`, or Windows batch.
- The user explicitly wants pure POSIX `sh` and no Bash features (use POSIX mode from `references/compatibility-matrix.md`).

## Invocation Notice

- Tell the user when this skill is running: `shell-scripts`.
  Skip the notice when the user asked for the skill by name or slash command; spelling and spacing need not match.
  A phrase from this skill's own trigger list is not a name — naming the work is not naming the skill.

## Workflow

1. Select the target mode from `references/compatibility-matrix.md`:
   POSIX strict, Bash-first, or Bash-with-zsh-compatibility.
2. Start from `assets/script-template.sh` or pull focused snippets from:
   - `assets/usage-template.txt`
   - `assets/logging-template.sh`
   - `assets/getopts-template.sh`
3. Apply style defaults:
   - Shebang per target mode.
   - Prefer `${VAR}` expansion form for clarity.
   - Quote expansions unless intentionally relying on shell splitting/pattern behavior.
   - In Bash mode, prefer arrays for argument vectors and list handling; in POSIX mode, avoid arrays.
   - Use `[[ ... ]]` for Bash conditionals; use `[ ... ]` when POSIX compatibility is required.
   - For command execution, verify resolution with `command -v` / `type -a` when shadowing is possible.
4. Validate syntax and lint:
   - `bash -n path/to/script.sh`
   - `shellcheck -x path/to/script.sh` (if available)
5. ShellCheck remediation budget:
   - Do at most two fix rounds.
   - Round 1: fix correctness/safety and high-confidence issues.
   - Round 2: re-run and fix remaining practical issues.
   - Stop after round 2 and report remaining findings with rationale.
6. For advanced logic and portability traps, load:
   - `references/advanced-patterns.md`
   - `references/command-resolution-and-os-portability.md`
   - `references/quoting-and-expansion.md`
   - `references/tests-and-conditionals.md`
   - `references/shellcheck-workflow.md`

## Output

- A script (or patch) with explicit target shell assumptions.
- Consistent quoting/expansion style and conditional style.
- ShellCheck findings reduced within the two-pass budget, with unresolved items documented.

## References

- `references/compatibility-matrix.md`
- `references/quoting-and-expansion.md`
- `references/tests-and-conditionals.md`
- `references/shellcheck-workflow.md`
- `references/advanced-patterns.md`
- `references/command-resolution-and-os-portability.md`
- `references/shellcheck-codes.md`
Files in this package (13)
  • ATTRIBUTION.md 1 KB
  • SKILL.md 3 KB
  • assets/getopts-template.sh 1 KB
  • assets/logging-template.sh 1 KB
  • assets/script-template.sh 2 KB
  • assets/usage-template.txt 1 KB
  • references/advanced-patterns.md 3 KB
  • references/command-resolution-and-os-portability.md 3 KB
  • references/compatibility-matrix.md 3 KB
  • references/quoting-and-expansion.md 2 KB
  • references/shellcheck-codes.md 43 KB
  • references/shellcheck-workflow.md 2 KB
  • references/tests-and-conditionals.md 1 KB

Versions

The database has no other skills named shell-scripts.

Database snapshot: 13.11.2026 · package version ff5320ed9b46 (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

  • 100shell-scripting
    Bash, Zsh, POSIX sh, Fish scripts, one-liners, dotfiles, completions. Use for quoting or globbing bugs, shellcheck warnings, porting between shells.
  • 100bash-expert
    Expert Bash help for writing, debugging, and optimizing safe, portable shell one-liners and scripts on macOS/Linux. Use when users ask for Bash or POSIX sh commands, script reviews, ShellCheck fixes, quoting/pipeline issues, process/file automation, or converting requirements into shell scripts.
  • 90shell-scripting-guide
    Use when writing or editing POSIX shell or Bash automation. Triggers on `.sh` files, `#!/usr/bin/env bash` shebangs, and prompts about scripting CI tasks, build helpers, devops automation, or one-off pipelines, even when the user doesn't say 'shell'. Apply for strict mode,…
  • 100shell-script-reviewer
    Reviews Bash, Zsh, and Fish shell scripts for bugs, security vulnerabilities, portability issues, and style violations against the Google Shell Style Guide, ShellCheck, BashPitfalls, and shell-specific idiom conventions. Use when the user asks to review, audit, lint, or improve…
  • 100shell-expert
    Shell scripting: bash, zsh, POSIX, CLI tools, cross-platform automation. Use when writing shell scripts, pipes, command-line automation, or portable shell code.
  • 95bash
    Use when writing shell scripts or working with Bash, Zsh, or POSIX-compatible shells on macOS and Linux. Covers scripting fundamentals, variables, control flow, functions, pipes, process management, and common patterns for automation and developer tooling. USE FOR: Bash, Zsh,…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.