본문으로 건너뛰기
cccskills
무료GitHub에 공개

bash-script-template

Generate bash script templates with best practices including error handling, argument parsing, logging, and portability considerations.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md4.2 KB
  • README.md801 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Bash Script Template

Generate bash script templates with best practices.

Capabilities

  • Generate robust bash script templates
  • Set up proper error handling
  • Implement argument parsing with getopts
  • Create logging utilities
  • Configure strict mode settings
  • Generate reusable function libraries

Usage

Invoke this skill when you need to:

  • Create new bash scripts with best practices
  • Set up proper error handling patterns
  • Implement argument parsing
  • Create portable shell scripts

Inputs

ParameterTypeRequiredDescription
scriptNamestringYesScript name
descriptionstringYesScript description
argumentsarrayNoScript arguments
functionsarrayNoFunctions to include

Generated Template

#!/usr/bin/env bash
#
# <scriptName> - <description>
#
# Usage: <scriptName> [options] <arguments>
#

set -euo pipefail
IFS=$'\n\t'

# Script directory
readonly SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly SCRIPT_NAME="$(basename "${BASH_SOURCE[0]}")"

# Colors (if terminal supports)
if [[ -t 1 ]]; then
    readonly RED='\033[0;31m'
    readonly GREEN='\033[0;32m'
    readonly YELLOW='\033[0;33m'
    readonly BLUE='\033[0;34m'
    readonly NC='\033[0m'
else
    readonly RED='' GREEN='' YELLOW='' BLUE='' NC=''
fi

# Logging functions
log_info() { echo -e "${BLUE}[INFO]${NC} $*"; }
log_success() { echo -e "${GREEN}[OK]${NC} $*"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $*" >&2; }
log_error() { echo -e "${RED}[ERROR]${NC} $*" >&2; }
die() { log_error "$*"; exit 1; }

# Cleanup on exit
cleanup() {
    # Add cleanup tasks here
    :
}
trap cleanup EXIT

# Usage
usage() {
    cat <<EOF
Usage: ${SCRIPT_NAME} [options] <argument>

<description>

Options:
    -h, --help      Show this help message
    -v, --verbose   Enable verbose output
    -d, --dry-run   Show what would be done
    -f, --force     Force operation
    -o, --output    Output file path

Arguments:
    argument        Required argument description

Examples:
    ${SCRIPT_NAME} -v input.txt
    ${SCRIPT_NAME} --output result.txt input.txt
EOF
}

# Parse arguments
parse_args() {
    local OPTIND opt
    while getopts ":hvdfo:-:" opt; do
        case "${opt}" in
            h) usage; exit 0 ;;
            v) VERBOSE=true ;;
            d) DRY_RUN=true ;;
            f) FORCE=true ;;
            o) OUTPUT="${OPTARG}" ;;
            -)
                case "${OPTARG}" in
                    help) usage; exit 0 ;;
                    verbose) VERBOSE=true ;;
                    dry-run) DRY_RUN=true ;;
                    force) FORCE=true ;;
                    output=*) OUTPUT="${OPTARG#*=}" ;;
                    *) die "Unknown option: --${OPTARG}" ;;
                esac
                ;;
            :) die "Option -${OPTARG} requires an argument" ;;
            ?) die "Unknown option: -${OPTARG}" ;;
        esac
    done
    shift $((OPTIND - 1))

    # Required arguments
    if [[ $# -lt 1 ]]; then
        usage
        die "Missing required argument"
    fi

    ARGUMENT="$1"
}

# Defaults
VERBOSE=${VERBOSE:-false}
DRY_RUN=${DRY_RUN:-false}
FORCE=${FORCE:-false}
OUTPUT=${OUTPUT:-}

# Main function
main() {
    parse_args "$@"

    if [[ "${VERBOSE}" == true ]]; then
        log_info "Verbose mode enabled"
    fi

    if [[ "${DRY_RUN}" == true ]]; then
        log_warn "Dry run mode - no changes will be made"
    fi

    log_info "Processing: ${ARGUMENT}"

    # Main logic here

    log_success "Done!"
}

main "$@"

Target Processes

  • shell-script-development
  • cross-platform-cli-compatibility
  • cli-application-bootstrap

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Provide implementations of advanced data structures

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Fresh adversarial code review with binary PASS/FAIL verdicts, evidence citations, and anchoring bias prevention via fresh reviewer spawning.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

WASM-based instant code transforms for simple tasks, achieving 352x speedup over LLM inference with zero cost.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Coordinate Crew (persistent) and Polecat (transient) agents using Gas Town's hook-based work distribution and GUPP principle.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Generate visual representations of algorithm execution

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

Hierarchical coordination and drift detection with frequent checkpoints, shared memory coherence validation, role specialization enforcement, and short task cycles.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

a5c-ai/babysitter1.9천2026년 9월 17일 업데이트

a5c-ai의 스킬 모두 보기

이 스킬의 문제 신고