shell-scripting

Guidelines for writing shell scripts that work across macOS, Linux, Windows, and related environments.

In plain words
What is it for?
Use it when creating, refactoring, or extending shell scripts, including scripts that detect the operating system or send desktop notifications.
Why use it?
It reduces common scripting problems such as unsafe variable handling, missing error checks, and platform-specific failures.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/mylee04/code-notify/shell-scripting
Any agent
npx skills add mylee04/code-notify --skill shell-scripting
Clone the repo
git clone --depth 1 https://github.com/mylee04/code-notify

Made for: Claude Code, Codex.

Per session 13 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 911 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00013 $0.00911
Opus 5 $0.00006 $0.00456
Sonnet 5 $0.00003 $0.00182
Haiku 4.5 $0.00001 $0.00091

Measured yesterday against content hash 51d95f7f4b17, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

shell-scripting scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.claude/skills/shell-scripting/SKILL.md · 216 lines

How it starts

The opening of the file, as written. The whole thing — 216 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Shell Scripting Standards

When to Use

  • Writing new shell scripts
  • Refactoring existing scripts
  • Adding new functions

Script Structure

1. File Header

#!/bin/bash

# Script description
# https://github.com/mylee04/code-notify

set -e  # Exit on error

2. Constants (UPPER_CASE)

VERSION="1.2.0"
CONFIG_DIR="$HOME/.claude"
DEFAULT_SOUND="Glass"

3. Functions (snake_case)

# Description of function
# Arguments: $1 = name, $2 = optional value
function_name() {
    local name="$1"
    local value="${2:-default}"

    # Function body
}

4. Main Logic

# Main execution
main() {
    validate_args "$@"
    do_work
    cleanup
}

main "$@"

Best Practices

Variable Handling

# Good - quoted variables
echo "$message"
path="$HOME/.config"

# Bad - unquoted
echo $message
path=$HOME/.config

Conditionals

# Good - double brackets
if [[ -n "$var" ]]; then
    echo "not empty"
fi

# Bad - single brackets
if [ -n "$var" ]; then
    echo "not empty"
fi

Command Existence Check

# Good
if command -v terminal-notifier &> /dev/null; then
    terminal-notifier -message "Hello"
fi

# Bad
if which terminal-notifier; then
    terminal-notifier -message "Hello"
fi

Error Handling

# Good - explicit error handling
if ! some_command; then
    echo "Error: command failed" >&2
    exit 1
fi

# Good - trap for cleanup
cleanup() {
    rm -f "$temp_file"
}
trap cleanup EXIT

Local Variables in Functions

# Good
my_function() {
    local input="$1"
    local result
    result=$(process "$input")
    echo "$result"
}

# Bad - pollutes global scope
my_function() {
    input="$1"
    result=$(process "$input")
    echo "$result"
}

Common Patterns

OS Detection

detect_os() {
    case "$(uname -s)" in
        Darwin*)    echo "macos" ;;
        Linux*)     echo "linux" ;;
        CYGWIN*|MINGW*|MSYS*) echo "windows" ;;
        *)          echo "unknown" ;;
    esac
}

Read the full file on GitHub · 216 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 216 lines · 13 tokens per session scan A 51d95f7f4b17

Subscribe to this mod's changes

shell-scripting is a skill published in the GitHub repository mylee04/code-notify (288 stars, last pushed 3d ago), licensed MIT. It adds 13 tokens to every session and 911 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

claude-api

Build, debug, and optimize Claude API / Anthropic SDK apps. Apps built with this skill should include prompt caching. Also handles migrating existing Claude API code between Claude model versions (4.5 → 4.6, 4.6 → 4.7, retired-model replacements). TRIGGER when: code imports anthropic/@anthropic-ai/sdk; user asks for…

warpdotdev/warp · 193 tokens

gui-onboarding-verification-skill

GUI desktop app only. Launch two parallel Oz cloud agents with computer use to download and install the latest stable Linux Warp build, capture screenshots while walking through first-time onboarding in both logged-out and logged-in states, then selectively fan out follow-up cloud agents for distinct onboarding…

warpdotdev/warp · 98 tokens

create-skill

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

warpdotdev/warp · 64 tokens

gui-integration-test

GUI desktop app only. Writes, runs, and debugs Warp integration tests using the custom Builder/TestStep framework in crates/integration. Use when adding a new integration test, fixing a failing integration test, wiring a test into the manual runner or nextest suite, or verifying end-to-end UI and terminal behavior in…

warpdotdev/warp · 72 tokens

gui-settings-ui

GUI desktop app only. How to build a Settings page in the Warp client (app/src/settingsview) so its widgets and settings search behave correctly — picking a PageType, deciding whether a heading belongs in the page-title slot or inside a widget, gating a widget, and scoping searchterms per widget. Use when adding or…

warpdotdev/warp · 86 tokens

logging-and-error-reporting

How and when to log (log:: levels, safe macros) and report errors to Sentry (reporterror!) in the Warp codebase. Use when adding or reviewing any logging or error reporting — picking a log level, deciding log vs. reporterror!, keeping sensitive data out of logs, or surfacing an error to Sentry.

warpdotdev/warp · 75 tokens