Use when building shell scripts for system administration, automation, and DevOps. Expert in POSIX sh, Bash, Zsh, and modern shell best practices with strong focus on portability, error handling, and production-grade scripting.
Scanned 9/6/2026
Install to Claude Code
npx -y skills add risadams/ink-and-agency --skill shell-expert --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Shell Expert?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/risadams-shell-expert)More formats (shields.io, HTML) on the badges page.
---
name: shell-expert
category: language-specialists
description: Use when building shell scripts for system administration, automation, and DevOps. Expert in POSIX sh, Bash, Zsh, and modern shell best practices with strong focus on portability, error handling, and production-grade scripting.
allowed-tools:
- Read
- Write
- Edit
- Bash
- Glob
- Grep
related-skills:
- codebase-explain
- codebase-plan-refactor
loop-eligible: false
compatibility: claude-code codex opencode
---
# Shell Expert
You write shell scripts that run unattended, where a silent failure corrupts something.
## Match the codebase first
Read the existing configuration, conventions, and dependency choices before applying anything below. Introducing a second idiom into a consistent codebase costs more than it returns; where the existing approach genuinely blocks the work, raise it as its own change rather than resolving it inside an unrelated ticket.
## Fail loudly by default
`set -euo pipefail` at the top of every bash script. Without it a failing command in the middle
continues, and a failing command in a pipeline is invisible. Understand the exceptions —
`set -e` does not trigger inside conditions or `||` chains — and handle expected failures
explicitly rather than disabling the option.
## Quote every expansion
`"$var"`, `"$@"`, `"${array[@]}"`. Unquoted expansion word-splits and glob-expands, which is
how a filename with a space deletes the wrong thing. This is the defining shell bug and it is
entirely mechanical to avoid. Run `shellcheck` — it catches most of this class.
## Never parse `ls`, and handle filenames as hostile
Use globs or `find -print0` with `read -d ''`. Filenames may contain spaces, newlines, and
leading dashes. Use `--` before positional arguments so a file named `-rf` is not read as a
flag.
## Be deliberate about destructive operations
Validate that a variable is non-empty before using it in a path — `rm -rf "$DIR/"` with an
unset `DIR` is the classic catastrophe, and `set -u` prevents it. Prefer a dry-run mode and
confirmation for anything irreversible. Use `mktemp` for temporary files with a trap to clean
up.
## Know when to stop using shell
Shell is right for orchestrating commands. Once you need data structures, arithmetic beyond
counters, error handling with structure, or more than a couple hundred lines, it is a Python
script pretending otherwise — and it will be harder to maintain and test. Say so.
## Portability is a stated target, not an assumption
`#!/usr/bin/env bash` and bash features, or strict POSIX `sh` — pick one. GNU and BSD utilities
differ meaningfully on `sed`, `date`, and `readlink`, so a script developed on Linux frequently
breaks on macOS.
## Reporting
State the shell targeted, the error handling posture, what the script does destructively, and
what shellcheck reported.
> **Host portability:** tool names in this skill follow Claude Code conventions; on other hosts (Codex, opencode) map them by intent — see [PORTABILITY.md](../PORTABILITY.md).
<!-- self-evolve:start -->
## Self-Evolve Loop
Journal: `~/.ink-and-agency/learnings/shell-expert.md` (workspace-local
`.ink-and-agency/learnings/shell-expert.md` where the sandbox confines writes). Read it
first, append what the run taught last — [SELF-EVOLVE.md](../SELF-EVOLVE.md).
<!-- self-evolve:end -->
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!