一键导入
bash-script-writing
// Write clean, modular bash scripts with proper error handling. Triggers on 'write a script', 'bash script', 'shell script', or 'automate with bash'.
// Write clean, modular bash scripts with proper error handling. Triggers on 'write a script', 'bash script', 'shell script', or 'automate with bash'.
Build Ruby CLI tools with Thor and Zeitwerk. Use for new Ruby CLI gems, adding commands, refactoring, or 'Thor CLI', 'command-line tool in Ruby'.
Read, send input to, or spawn other tmux panes, windows, and sessions - including agents (Claude Code, Codex), REPLs, and TUIs running in them. Use when the user references another pane, window, or agent.
Convert markdown to PDF using Chrome. Triggers on 'markdown to pdf', 'render to pdf', 'pdf from markdown', 'print this markdown'.
Fetch secrets and create/manage 1Password items via CLI. Use when needing API keys, tokens, or credentials, or storing new secrets. Ask for the op://Vault/Item/field reference, not the secret itself.
Rigorous code review of completed implementation before committing. Use for features, refactors, and critical-path changes — not trivial changes (this is expensive).
Assess and improve codebase architecture via layered analysis and guided restructuring. Triggers on architecture review, structural assessment, design patterns, modularity, coupling, framework alignment.
| name | bash-script-writing |
| description | Write clean, modular bash scripts with proper error handling. Triggers on 'write a script', 'bash script', 'shell script', or 'automate with bash'. |
Follow this structure when writing bash scripts.
Place main() immediately after variables so the workflow is visible at file top.
#!/usr/bin/env bash
set -euo pipefail
################################################################################
# Script Title
################################################################################
#
# OVERVIEW
# --------
# Brief description of what this script does
#
# USAGE
# -----
# script-name arg1 arg2
#
# CONFIGURATION
# -------------
# Environment variables or config requirements
#
################################################################################
# Colors
green='\033[0;32m'
blue='\033[0;34m'
yellow='\033[1;33m'
red='\033[0;31m'
nc='\033[0m'
# Configuration
VAR_ONE=${VAR_ONE:-default}
VAR_TWO=${VAR_TWO:?VAR_TWO is required}
################################################################################
# Main Orchestration
################################################################################
main() {
parse_arguments "$@"
step_one
step_two
log "Complete!"
}
################################################################################
# Helper Functions
################################################################################
log() { echo -e "${green}==>${nc} ${1}"; }
info() { echo -e "${blue}Info:${nc} ${1}"; }
warn() { echo -e "${yellow}Warning:${nc} ${1}"; }
error() { echo -e "${red}Error:${nc} ${1}" >&2; exit 1; }
################################################################################
# Core Functions
################################################################################
function_name() {
log "What this function does..."
# Implementation
log "Complete"
}
################################################################################
# Script Execution
################################################################################
main "$@"
setup_directory, validate_config)log "...", end with status#### dividers between logical groups