Skip to content
Skills Library
Programming · Building & coding

shell-scripting

/shell-scripting

Write robust, safe bash/shell scripts and one-liners, and explain or fix existing ones. Use when users want a shell script, a command pipeline, automation glue, or ask why a bash snippet misbehaves (quoting, globbing, exit codes). Triggers on mentions of bash, shell script, .sh, command line, pipe, one-liner, cron job command, 脚本, 命令行, 管道, shell.

Repository
microclaw ↗
Licence
MIT
Last repository change
26.10.2026

Assessment and security

100/ 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.
Content35 / 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
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

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

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Write robust, safe bash/shell scripts and one-liners, and explain or fix existing ones. Use when users want a shell script, a command pipeline, automation glue, or ask why a bash snippet misbehaves (quoting, globbing, exit codes). Triggers on mentions of bash, shell script, .sh, command line, pipe, one-liner, cron job command, 脚本, 命令行, 管道, shell.

Original author description

Write robust, safe bash/shell scripts and one-liners, and explain or fix existing ones. Use when users want a shell script, a command pipeline, automation glue, or ask why a bash snippet misbehaves (quoting, globbing, exit codes). Triggers on mentions of bash, shell script, .sh, command line, pipe, one-liner, cron job command, 脚本, 命令行, 管道, shell.

How it works

  1. Start every script with a strict header
  2. Quoting & safety (the top source of bugs)
  3. Common patterns
  4. Guidance
Original SKILL.md headings · 43 lines, 223 words
SKILL.md preview
---
name: shell-scripting
description: "Write robust, safe bash/shell scripts and one-liners, and explain or fix existing ones. Use when users want a shell script, a command pipeline, automation glue, or ask why a bash snippet misbehaves (quoting, globbing, exit codes). Triggers on mentions of bash, shell script, .sh, command line, pipe, one-liner, cron job command, 脚本, 命令行, 管道, shell."
license: Proprietary. LICENSE.txt has complete terms
compatibility: "No external dependencies. Works on macOS, Linux, and Windows (WSL/Git Bash)."
---

# Shell Scripting

Write scripts that fail loudly and safely, not ones that silently do the wrong thing.

## Start every script with a strict header

```bash
#!/usr/bin/env bash
set -euo pipefail   # exit on error, error on unset var, fail a pipeline if any stage fails
IFS=$'\n\t'
```

## Quoting & safety (the top source of bugs)

- Always quote expansions: `"$var"`, `"${arr[@]}"`, `"$(cmd)"` — unquoted values word-split and glob.
- Use `[[ ... ]]` over `[ ... ]` for tests; `(( ... ))` for arithmetic.
- Prefer `"$(cmd)"` over backticks. Check `mkdir -p`, `rm -rf` paths twice.
- Handle filenames with spaces/newlines: `find ... -print0 | xargs -0`, or `while IFS= read -r line`.

## Common patterns

```bash
# Args with defaults
name="${1:-world}"

# Loop over files safely
for f in ./*.log; do [[ -e "$f" ]] || continue; echo "$f"; done

# Trap cleanup on exit
tmp="$(mktemp)"; trap 'rm -f "$tmp"' EXIT

# Check a command exists
command -v jq >/dev/null 2>&1 || { echo "jq required" >&2; exit 1; }
```

## Guidance

- Run `shellcheck script.sh` if available — it catches most real bugs.
- Make scripts idempotent where possible; print what they're doing.
- Don't parse `ls` output; glob or use `find`. Don't `eval` untrusted input.
- For anything beyond ~50 lines of logic, consider Python instead.

Versions

RepositoryScoreLicence
This page · microclaw/microclaw100MIT
iuliandita/skills100MIT
xobotyi/cc-foundry100MIT
sammcj/agentic-coding95Apache-2.0
tmj-90/gaffer90Apache-2.0

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

  • 100overview
    Cross-language CLI and scripting guidance for IT automation, system administration, and DevOps workflows: language selection (Bash vs PowerShell vs Python vs Node.js), pipes, exit codes, environment variables, argument parsing, error handling, and cross-platform scripting best…
  • 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.
  • 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".
  • 100shell-expert
    Shell scripting expertise, command-line tools, automation, and cross-platform scripting best practices. Covers shell script development, CLI tool usage, and system automation with bash, zsh, and POSIX shell. Use when user mentions shell scripts, bash, zsh, CLI commands, pipes,…
  • 100bash-scripting-expert
    Expert Bash scripting: robust, safe, portable shell scripts. Trigger keywords: bash, shell script, sh, quoting, word splitting, set -euo pipefail, trap, IFS, getopts, mktemp, shellcheck, POSIX, CLI, automation. Use for writing/debugging shell scripts and automation, or fixing…
  • 95bash-script-generator
    Creates bash scripts with argument parsing, error handling, logging, and input validation following current standards. Use when creating new bash or shell scripts, .sh files, CLI tools, scripting automation, text processing workflows (grep/awk/sed pipelines), or building…

Feedback and reports

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