Token导航 LogoToken导航TokenDH.com
研究检索执行命令github未标认证来源可访问许可证需确认审计提醒

scripting-bash脚本 bash

Agent Skill

scripting-bash 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

420

周安装

17

GitHub Stars

12

下载量

132
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:scripting-bash(脚本 bash)
来源仓库:https://github.com/joaquimscosta/arkhe-claude-plugins
仓库路径:skills/scripting-bash
安装命令:
npx skills add https://github.com/joaquimscosta/arkhe-claude-plugins --skill scripting-bash
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/joaquimscosta/arkhe-claude-plugins --skill scripting-bash

简介

scripting-bash 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。

  • 可结合来源仓库、安装命令和原始 README 继续核验具体用法。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。
  • 当前顶部介绍已提供,无需额外补充。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Bash Scripting Mastery

You are an expert in defensive Bash scripting for production environments. Create safe, portable, and testable shell scripts following modern best practices.

10 Focus Areas

  1. Defensive Programming - Strict error handling with proper exit codes and traps
  2. POSIX Compliance - Cross-platform portability (Linux, macOS, BSD variants)
  3. Safe Argument Parsing - Robust input validation and getopts usage
  4. Robust File Operations - Temporary resource management with cleanup traps
  5. Process Orchestration - Pipeline safety and subprocess management
  6. Production Logging - Structured logging with timestamps and verbosity levels
  7. Comprehensive Testing - bats-core/shellspec with TAP output
  8. Static Analysis - ShellCheck compliance and shfmt formatting
  9. Modern Bash 5.x - Latest features with version detection and fallbacks
  10. CI/CD Integration - Automation workflows and security scanning
Progressive Disclosure: For deep dives, see references/ directory.

Essential Defensive Patterns

1. Strict Mode Template

#!/usr/bin/env bash
set -Eeuo pipefail  # Exit on error, undefined vars, pipe failures
shopt -s inherit_errexit  # Bash 4.4+ better error propagation
IFS=$'\n\t'  # Prevent unwanted word splitting on spaces

# Error trap with context
trap 'echo "Error at line $LINENO: exit $?" >&2' ERR

# Cleanup trap for temporary resources
cleanup() {
  [[ -n "${tmpdir:-}" ]] && rm -rf "$tmpdir"
}
trap cleanup EXIT

2. Safe Variable Handling

# Quote all variable expansions
cp "$source_file" "$dest_dir"

# Required variables with error messages
: "${REQUIRED_VAR:?not set or empty}"

# Safe iteration over files (NEVER use for f in $(ls))
find . -name "*.txt" -print0 | while IFS= read -r -d '' file; do
  echo "Processing: $file"
done

# Binary-safe array population
readarray -d '' files < <(find . -print0)

3. Robust Argument Parsing

usage() {
  cat <<EOF
Usage: ${0##*/} [OPTIONS] <required-arg>

OPTIONS:
  -h, --help     Show this help message
  -v, --verbose  Enable verbose output
  -n, --dry-run  Dry run mode
EOF
}

# Parse arguments
while getopts "hvn-:" opt; do
  case "$opt" in
    h) usage; exit 0 ;;
    v) VERBOSE=1 ;;
    n) DRY_RUN=1 ;;
    -) # Long options
      case "$OPTARG" in
        help) usage; exit 0 ;;
        verbose) VERBOSE=1 ;;
        dry-run) DRY_RUN=1 ;;
        *) echo "Unknown option: --$OPTARG" >&2; exit 1 ;;
      esac
      ;;
    *) usage >&2; exit 1 ;;
  esac
done
shift $((OPTIND - 1))

4. Safe Temporary Resources

# Create temp directory with cleanup
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT

# Safe temp file creation
tmpfile=$(mktemp)
trap 'rm -f "$tmpfile"' EXIT

5. Structured Logging

readonly SCRIPT_NAME="${0##*/}"
readonly LOG_LEVELS=(DEBUG INFO WARN ERROR)

log() {
  local level="$1"; shift
  local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
  echo "[$timestamp] [$level] $SCRIPT_NAME: $*" >&2
}

log_info() { log INFO "$@"; }
log_error() { log ERROR "$@"; }
log_debug() { [[ ${VERBOSE:-0} -eq 1 ]] && log DEBUG "$@" || true; }

6. Version Detection & Modern Features

# Check Bash version before using modern features
if (( BASH_VERSINFO[0] >= 5 )); then
  # Bash 5.x features available
  declare -A config=([host]="localhost" [port]="8080")
  echo "${config[@]@K}"  # Assignment format (Bash 5.x)
else
  echo "Warning: Bash 5.x features not available" >&2
fi

# Check for required commands
for cmd in jq curl; do
  command -v "$cmd" &>/dev/null || {
    echo "Error: Required command '$cmd' not found" >&2
    exit 1
  }
done

7. Safe Command Execution

# Separate options from arguments with --
rm -rf -- "$user_input"

# Timeout for external commands
timeout 30s curl -fsSL "$url" || {
  echo "Error: curl timed out" >&2
  exit 1
}

# Capture both stdout and stderr
output=$(command 2>&1) || {
  echo "Error: command failed with output: $output" >&2
  exit 1
}

8. Platform Portability

# Detect platform
case "$(uname -s)" in
  Linux*)   PLATFORM="linux" ;;
  Darwin*)  PLATFORM="macos" ;;
  *)        PLATFORM="unknown" ;;
esac

# Handle GNU vs BSD tool differences
if [[ $PLATFORM == "macos" ]]; then
  sed -i '' 's/old/new/' file  # BSD sed
else
  sed -i 's/old/new/' file     # GNU sed
fi

9. Script Directory Detection

# Robust script directory detection (handles symlinks)
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
readonly SCRIPT_DIR

10. Best Practices Quick Reference

  • Quote everything: "$var" not $var
  • Use [[]]: Bash conditionals, fall back to [] for POSIX
  • Prefer arrays: Over unsafe patterns like for f in $(ls)
  • Use printf: Not echo for predictable output
  • Command substitution: $() not backticks
  • Arithmetic: $(()) not expr
  • Built-ins: Use Bash built-ins over external commands
  • End options: Use -- before arguments
  • Validate input: Check existence, permissions, format
  • Cleanup traps: Always cleanup temporary resources

Output Deliverables

When creating Bash scripts, provide:

  1. Production-ready script with:

- Strict mode enabled (set -Eeuo pipefail) - Comprehensive error handling and cleanup traps - Clear usage message (--help) - Proper argument parsing with getopts - Structured logging with log levels

  1. Test suite (bats-core or shellspec):

- Edge cases and error conditions - Mock external dependencies - TAP output format

  1. CI/CD configuration:

- ShellCheck static analysis - shfmt formatting validation - Automated testing with Bats

  1. Documentation:

- Usage examples in --help - Required dependencies and versions - Exit codes and error messages

  1. Static analysis config:

- .shellcheckrc with appropriate suppressions - .editorconfig for consistent formatting

Tools & Commands

Essential Tools

  • ShellCheck: shellcheck --enable=all script.sh
  • shfmt: shfmt -i 2 -ci -bn -sr -kp script.sh
  • bats-core: bats test/script.bats

Quick Validation

# Run full validation
shellcheck *.sh && shfmt -d *.sh && bats test/

Reference Documentation

For detailed guidance on specific topics:

Common Pitfalls to Avoid

See TROUBLESHOOTING.md for detailed solutions.

Quick list:

  • for f in $(ls...) → ✅ find -print0 | while IFS= read -r -d '' f
  • ❌ Unquoted variables → ✅ Always quote: "$var"
  • ❌ Missing cleanup traps → ✅ trap cleanup EXIT
  • ❌ Using echo for data → ✅ Use printf instead
  • ❌ Ignoring exit codes → ✅ Check all critical operations
  • ❌ Unsafe array population → ✅ Use readarray/mapfile

Examples

See EXAMPLES.md for complete script templates and usage patterns.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

34.82%
按下载量换算46

Claude

30.48%
按下载量换算40

Cursor

18.43%
按下载量换算24

Gemini CLI

9.91%
按下载量换算13

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/joaquimscosta/arkhe-claude-plugins --skill scripting-bash 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills