shell-scripting-2

shell-scripting-2 is a skill for Claude Code, Codex from cass-2003/local-workflow-skill. It costs 97 tokens per session (2,092 once invoked), scanned D, original, MIT.

A guide to writing reliable Bash and Zsh scripts for deployment, automation, system administration, and text processing.

In plain words
What is it for?
It is for creating build and deployment scripts, scheduled jobs, system-management commands, and shell-based text processing.
Why use it?
It helps prevent common script failures caused by unsafe variable handling, missing error checks, fragile temporary files, and non-repeatable commands.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit It is for creating build and deployment scripts, scheduled jobs, system-management commands, and shell-based text processing.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cass-2003/local-workflow-skill/shell-scripting-2
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.

Any agent
npx skills add cass-2003/local-workflow-skill --skill shell-scripting-2
Clone the repo
git clone --depth 1 https://github.com/cass-2003/local-workflow-skill

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for shell-scripting-2

README.md
[![agentmods](https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/shell-scripting-2/github.svg)](https://agentmods.dev/skills/cass-2003/local-workflow-skill/shell-scripting-2)
Your own site
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/shell-scripting-2"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/shell-scripting-2/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for shell-scripting-2

Your own site · 80×15
<a href="https://agentmods.dev/skills/cass-2003/local-workflow-skill/shell-scripting-2"><img src="https://agentmods.dev/badge/skills/cass-2003/local-workflow-skill/shell-scripting-2.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,092 The whole file, excluding the scripts and references it only reads on demand.
Security scan D 2 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00097 $0.02092
Opus 5 $0.00048 $0.01046
Sonnet 5 $0.00019 $0.00418
Haiku 4.5 $0.00010 $0.00209

Measured 8d ago against content hash 21b0d17379ab, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade D, and why

shell-scripting-2 scanned grade D with 2 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 8d ago.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

ssh "$REMOTE_HOST" "sudo systemctl restart $SERVICE_NAME" || die "重启失败"

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

> **[安全三禁]** ❌`eval "$user_input"` ❌无引号变量展开 ❌`rm -rf /`或`rm -rf $VAR/`(VAR可能为空)
skills/engineering-core/codex/shell-scripting-2/SKILL.md · 209 lines

How it starts

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

Shell脚本开发技能 (Shell Scripting Skill)

快速规则(日常开发时自动加载,只需读到这里)

[Shell核心清单] ① 脚本首行#!/usr/bin/env bash+set -euo pipefail ② 变量必须"$var"双引号包裹防止分词 ③ 路径用"$(cd "$(dirname "$0")" && pwd)"获取脚本所在目录 [安全三禁]eval "$user_input" ❌无引号变量展开 ❌rm -rf /rm -rf $VAR/(VAR可能为空) [健壮性铁律] 命令失败必须有处理(set -e或显式检查$?),临时文件用mktemp+trap清理

写/改Shell脚本时,强制遵守:

  1. Shebang+严格模式#!/usr/bin/env bash + set -euo pipefail(-e:命令失败即退出 -u:未定义变量报错 -o pipefail:管道中任一命令失败即失败)
  2. 引号规则:变量展开必须双引号"$var",防止空格/通配符导致分词。路径变量尤其重要
  3. 错误处理:关键命令后检查返回值,或用|| { echo "失败"; exit 1; }
  4. 临时文件mktemp创建 + trap 'rm -f "$tmpfile"' EXIT清理,禁止硬编码/tmp/xxx
  5. 日志输出:用函数统一日志格式log() { echo "[$(date '+%H:%M:%S')] $*"; },错误输出到stderr
  6. 可移植性:优先POSIX兼容语法,用command -v检查依赖是否存在
  7. 幂等设计:脚本重复执行不应产生副作用(mkdir -p / cp而非追加写入)

脚本模板

标准脚本骨架

#!/usr/bin/env bash
set -euo pipefail

# 脚本所在目录(解析符号链接)
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# 日志函数
log()  { echo "[$(date '+%H:%M:%S')] $*"; }
err()  { echo "[$(date '+%H:%M:%S')] ERROR: $*" >&2; }
die()  { err "$@"; exit 1; }

# 依赖检查
for cmd in go rsync ssh; do
    command -v "$cmd" >/dev/null 2>&1 || die "缺少依赖: $cmd"
done

# 清理函数
cleanup() {
    # 清理临时文件等
    :
}
trap cleanup EXIT

# 主逻辑
main() {
    log "开始执行..."
    # ...
    log "完成"
}

main "$@"

部署脚本模板

#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REMOTE_HOST="user@server"
REMOTE_DIR="/path/to/deploy"
SERVICE_NAME="myservice"

log() { echo "[$(date '+%H:%M:%S')] $*"; }
die() { echo "[$(date '+%H:%M:%S')] ERROR: $*" >&2; exit 1; }

# 构建
log "构建中..."
cd "$SCRIPT_DIR"
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o "build/${SERVICE_NAME}" . || die "构建失败"

# 上传
log "上传到 $REMOTE_HOST..."
rsync -az "build/${SERVICE_NAME}" "$REMOTE_HOST:$REMOTE_DIR/" || die "上传失败"

# 重启
log "重启服务..."
ssh "$REMOTE_HOST" "sudo systemctl restart $SERVICE_NAME" || die "重启失败"

# 验证
log "等待服务启动..."
sleep 2
ssh "$REMOTE_HOST" "systemctl is-active $SERVICE_NAME" || die "服务未正常启动"

log "部署完成 ✓"

Read the full file on GitHub · 209 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. 8d ago First seen · 209 lines · 97 tokens per session scan D 21b0d17379ab

Subscribe to this mod's changes

shell-scripting-2 is a skill published in the GitHub repository cass-2003/local-workflow-skill (12 stars, last pushed 2mo ago), licensed MIT. It adds 97 tokens to every session and 2,092 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it D with 2 findings (asks for root, recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

local-ai-agents

Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…

microsoft/ai-agents-for-beginners · 200 tokens

next-cache-components-adoption

Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…

vercel/next.js · 95 tokens

insight-error-page

Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…

vercel/next.js · 83 tokens

next-cache-components-optimizer

Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…

vercel/next.js · 170 tokens

next-partial-prefetching-adoption

Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…

vercel/next.js · 103 tokens