Skip to content
Development
Skill

/writing-shell

Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI

From plugin
cc-thingz
3828 skills6 agents

Claude Code

$ npx -y skills add alexei-led/cc-thingz --skill writing-shell --agent claude-code

SKILL.md

writing-shell.SKILL.md
description: Idiomatic shell development for POSIX sh, Bash, Zsh, Fish, hooks, CI
  shell steps, and scriptable CLI glue. Use when writing or changing `.sh`, `.bash`,
  `.zsh`, `.fish`, `.bats`, shell functions, shell pipelines, CI `run:` shell bodies,
  or command-runner recipes. Emphasizes portability, quoting, safe filesystem/process
  handling, non-TUI CLI tools, ShellCheck, shfmt, Bats, and ShellSpec. NOT for Python,
  Rust, TypeScript, Go, web code, or GitHub Actions workflow/job/permissions semantics;
  use operating-infra.
name: writing-shell

Shell Development

In GitHub Actions, this skill owns the shell inside `run:` blocks; operating-infra owns the workflow YAML around it (jobs, permissions, actions, secrets, caching). Mixed changes use both.

Shell Choice

  • Follow the existing shebang and tooling. New portable scripts: POSIX `sh` for simple logic; Bash when you need arrays, `pipefail`, `[[ ]]`, or regex.
  • Zsh and Fish only for existing files, interactive config, or explicit requests.
  • Never rely on the agent's own shell. Name the shell in the shebang, and invoke it explicitly in tests.
  • Shell is glue. Move data modeling, business logic, or CPU-heavy work to the project's real language.

Safety and Portability

  • Bash: `set -euo pipefail`, knowing it does not fire inside conditionals or `&&`/`||` lists. POSIX sh: `set -eu` and explicit pipeline checks.
  • Build commands with arrays, never strings plus `eval`. Put `--` before user-controlled operands.
  • NUL- or newline-safe loops for filenames; never parse `ls` or use `for x in $(cmd)`.
  • `mktemp` plus a cleanup `trap` for temp files, locks, and partial outputs.
  • No `curl | sh`: download, verify, then run.
  • Destructive actions list their targets first and require confirmation unless the script runs non-interactively with explicit inputs.
  • macOS/BSD vs GNU: avoid `sed -i`, `date -d`, `readlink -f`, and GNU-only `grep` flags unless the dependency is documented. Prefer `printf` to `echo`.
  • Every `shellcheck disable` carries a short reason.

CLI Tools

  • Use non-interactive, pipe-friendly tools with stable stdout and exit codes: no TUI, pager, color, or prompts when output is consumed.
  • Parse structured data with `jq`, `yq`, `mlr`, or `dasel`, not `grep`/`sed` scraping. Search with `rg` and `fd`.
  • Preview replacements before applying them (`sd -p`, `rg --replace`).
  • Check for non-standard tools and fail with a clear message. Never install them silently.
  • Look up exact flags with looking-up-docs instead of guessing.

References

  • [testing.md](references/testing.md): gate commands (shfmt, ShellCheck, checkbashisms, Bats, ShellSpec) and test design; read when adding tests or choosing checks.

Done when the relevant build/test/lint checks pass on what you changed, or you name each check that did not run and why.

Read more
@alexei-led
Ships withcc-thingz

Portable skills, agents, hooks, and Pi-native extensions for Claude Code, Codex CLI, GitHub Copilot, Cursor, Grok, and Pi. Gemini is retired.

3828 skills6 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
38
Star history of alexei-led/cc-thingz on GitHub, a chart by star-history.com

Other skills on cc-thingz.

releasing-code

releasing-code

Prepare, publish, or repair a software release and write its release notes. Use for cutting a versioned release or editing…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills13d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react4d252k
@facebook@facebookInstall Skill

Questions about writing-shell.

Which coding agents can use writing-shell?
writing-shell installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.