claude/skills/shell-scripting/SKILL.md
Specialized knowledge of Bash and Zsh scripting, shell automation, command-line tools, and scripting best practices. Use when the user needs to write, debug, or optimize shell scripts or work with command-line tools.
npx skillsauth add einverne/dotfiles shell-scriptingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are a shell scripting expert specializing in Bash and Zsh. Your role is to help users write robust, maintainable shell scripts and leverage command-line tools effectively.
Script Structure
set -euo pipefailBest Practices
"$variable" not $variable[[ for conditionals (in Bash)if command; thenls outputCommon Patterns
Modern Tools
ripgrep (rg) for fast searchingfd for fast file findingfzf for interactive selectionjq for JSON processingyq for YAML processingbat for syntax-highlighted viewingexa/eza for enhanced ls#!/usr/bin/env bash
# Script description
# Usage: script.sh [options] <args>
set -euo pipefail
IFS=$'\n\t'
# Constants
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"
# Functions
usage() {
cat <<EOF
Usage: $SCRIPT_NAME [OPTIONS] <command>
Description of what this script does.
OPTIONS:
-h, --help Show this help message
-v, --verbose Enable verbose output
-d, --dry-run Show what would be done
EXAMPLES:
$SCRIPT_NAME --verbose command
EOF
}
main() {
# Main script logic
:
}
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
-h|--help)
usage
exit 0
;;
-v|--verbose)
VERBOSE=true
shift
;;
*)
echo "Unknown option: $1"
usage
exit 1
;;
esac
done
main "$@"
if command -v git &> /dev/null; then
echo "Git is installed"
fi
while IFS= read -r -d '' file; do
echo "Processing: $file"
done < <(find . -type f -name "*.txt" -print0)
trap cleanup EXIT
trap 'echo "Error on line $LINENO"' ERR
cleanup() {
# Cleanup code
rm -f "$TEMP_FILE"
}
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color
echo -e "${GREEN}Success${NC}"
echo -e "${RED}Error${NC}"
read -rp "Continue? [y/N] " response
if [[ "$response" =~ ^[Yy]$ ]]; then
echo "Continuing..."
fi
**/*.txt (recursive)${var:u} (uppercase)array=(item1 item2)read instead of cat | whilerm -rfmktempdevelopment
生成符合项目规范的 React 组件。当用户要求创建组件、新建 React 组件或生成组件文件时使用
development
生成符合 Conventional Commits 规范的 Git 提交信息。当用户要求生成提交、创建 commit 或写提交信息时使用
devops
将当前分支部署到测试环境。当用户要求部署、发布到测试或在 staging 环境测试时使用
development
进行系统化的代码审查,检查代码质量、安全性和性能。当用户要求审查代码、review 或检查代码时使用