Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

bash-script-writer

БесплатноБез исполняемых скриптовНе проверен

Write, review, and optionally test Bash and Zsh shell scripts following project coding standards. Use for ANY shell scripting task: (1) creating a new Bash or…

jim60105от jim60105★ 22 звезды на GitHub

Об этом скилле

Bash Script Writer

Write Bash (default) or Zsh scripts following project standards, and decide whether ShellSpec tests are warranted.

Workflow

  1. Choose the shell — see Step 1: Shell Selection. Bash unless the user confirms Zsh.
  2. Load Zsh guidance only if needed — when the chosen shell is Zsh, read references/zsh.md before writing any code. Do NOT load it for Bash work.
  3. Write the script following Script Structure and Coding Standards. For Zsh, apply the overrides in references/zsh.md.
  4. Decide on testing — see Step 4: Testing Decision. ShellSpec is optional, not the default.
  5. Verify — always run at least the lightweight checks in Verification.

Step 1: Shell Selection

Already decided — skip the decision

  • Editing an existing script: keep its current shell. Do not migrate it unless the user asks.
  • User explicitly named the shell ("write a zsh script", "make this a .zsh"): that counts as confirmation; use it.
  • The context dictates the shell: Dockerfile RUN, GitHub Actions run:, container entrypoints, Makefile recipes, CI images, or anything that runs where Zsh is not guaranteed to be installed → Bash, no suggestion.
  • Zsh plugins, .zshrc helpers, autoload functions, completion functions (_command) → Zsh is inherent; no confirmation needed.

Otherwise — prefer Bash, suggest Zsh only when it clearly pays off

Bash is the default: it is installed nearly everywhere and ShellCheck fully supports it (ShellCheck does not lint Zsh).

Suggest Zsh only when the script would make substantial use of one or more of these advantages:

Zsh advantage What it replaces in Bash
Glob qualifiers: *(.), *(/), *(om[1,5]), *(Lm+10), *(N) find ... -printf | sort | head pipelines, stat loops
Native floating-point arithmetic: (( x = 1.5 * y )), zsh/mathfunc Shelling out to bc / awk for every calculation
Parameter expansion flags: ${(s:,:)var} split, ${(j:,:)arr} join, ${(o)arr} sort, ${(u)arr} unique, ${(U)var} upper-case IFS juggling, sort -u, tr, subshells
No word-splitting of unquoted $var by default Defensive quoting everywhere (still recommended in Bash)
zparseopts with long options and arrays Hand-rolled while/case loops for --long options (getopts is short-only)
Loadable modules: zsh/datetime (strftime, $EPOCHREALTIME), zsh/stat, zsh/files, zsh/net/tcp External date, stat, nc calls
Nested/qualified recursive globbing **/*.jpg(.N) with filters shopt -s globstar nullglob plus manual filtering

Weigh against the costs:

  • Zsh may not be installed on servers, containers, CI runners, or teammates' machines.
  • No ShellCheck support.
  • Mixed shells in one project add cognitive load.

Decision rule:

  • One or two minor conveniences (e.g. a single split or a single glob) → use Bash, do not ask.
  • Several advantages used heavily, or an advantage that removes significant complexity or external dependencies, and the script runs on machines where Zsh is available → recommend Zsh and ask the user to confirm.

Asking for confirmation

When recommending Zsh, stop before writing code and ask the user. Present:

  1. The specific Zsh features the script would use and what they simplify (concrete, not generic).
  2. The costs that apply in this context (runtime availability, ShellCheck).
  3. A clear default: "I will write it in Bash unless you confirm Zsh."

Only proceed with Zsh after explicit confirmation. If the user declines or does not answer clearly, use Bash.

Script Structure

#!/usr/bin/env bash
# Copyright (C) 2026 Jim Chen <[email protected]>, licensed under GPL-3.0-or-later
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
# ==================================================================
#
# [Script description and usage information]

set -Eeuo pipefail
  • Use #!/usr/bin/env bash for portability (Bash lives in /usr/local/bin on macOS Homebrew and BSDs).
  • If the script lives inside a project with a different license, match that project's existing header convention instead of the GPL header.

Coding Standards

Strict Mode

  • Start with set -Eeuo pipefail.
  • Be aware of `set -
Полный SKILL.md на GitHub

Установить bash-script-writer в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/testing-shellspec.mdreferences/zsh.md

FAQ

Что делает скилл bash-script-writer?

Write, review, and optionally test Bash and Zsh shell scripts following project coding standards. Use for ANY shell scripting task: (1) creating a new Bash or Zsh script, (2) editing, fixing, or reviewing an existing .sh, .bash, or .zsh file, (3) adding error handling, dependency checks, or cleanup traps to shell scripts, (4) implementing API integration or file processing in shell, (5) writing or fixing ShellSpec tests (spec/*_spec.sh), or (6) deciding whether a script should be written in Bash or Zsh. Defaults to Bash; Zsh-specific guidance lives in a reference file that is loaded only when writing Zsh.

Как установить скилл bash-script-writer?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл bash-script-writer запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить bash-script-writer с