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

bash-expert

Expert Bash help for writing, debugging, and optimizing safe, portable shell one-liners and scripts on macOS/Linux. Use when users ask for Bash or POSIX sh commands, script reviews, ShellCheck fixes, quoting/pipeline issues, process/file automation, or converting requirements into shell scripts.

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

설치 방법 보기

포함된 파일(2)

  • SKILL.md3.2 KB
  • references/bash_patterns.md2.2 KB

SKILL.md(원문)

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

Bash Expert

Overview

  • Write safe Bash scripts and one-liners with correct quoting, piping, and error handling.
  • Produce portable code for macOS/Linux; call out GNU vs BSD differences and POSIX-only paths when needed.
  • Debug issues (tracing, ShellCheck) and propose tests/dry-runs before destructive actions.

Quick Start

  1. Confirm shell/OS/permissions. Note macOS ships Bash 3.2 (no associative arrays); prefer Bash 4+ when available.
  2. Choose shebang: /usr/bin/env bash for Bash 4+, /bin/sh for POSIX-only requirements.
  3. Default safety (non-interactive):
    set -euo pipefail
    IFS=$'\n\t'
    shopt -s nullglob
    
    Avoid strict mode when partial failures are expected.
  4. Quote everything ("${var}"), prefer printf over echo, and avoid word-splitting in loops.

Workflow for Script Requests

  1. Clarify goal, inputs, side effects, and scale (file counts, data size).
  2. Identify tools (find, grep, sed, awk, jq, tar, rsync, etc.) and portability constraints.
  3. Scaffold with logging and cleanup:
    #!/usr/bin/env bash
    set -euo pipefail
    IFS=$'\n\t'
    trap 'cleanup' EXIT
    cleanup(){ :; }
    log(){ printf '%s\n' "$*" >&2; }
    die(){ log "error: $*"; exit 1; }
    
  4. Add argument parsing (getopts), sanity checks, and dry-run mode before mutating data.
  5. Use safe loops (while IFS= read -r line; do ...; done < file) and null-delimited traversal (find ... -print0 | while IFS= read -r -d '' path; do ...; done).
  6. Validate (bash -n, shellcheck -x), run with representative inputs, then present final command plus usage notes/rollback guidance.

One-Liners & Pipelines

  • Keep pipelines fail-fast with set -o pipefail or bash -o pipefail -c 'cmd'.
  • Prefer process substitution over temp files when possible: diff <(cmd1) <(cmd2).
  • Use xargs -0 -r with find -print0; avoid for f in $(...).
  • Set LC_ALL=C for deterministic greps/sorts; specify PATH explicitly for cron/CI runs.

Portability & Performance

  • Bash-only features: arrays, [[ ]], brace expansion, ** globstar. Offer POSIX alternatives when /bin/sh is requested.
  • BSD vs GNU flags: sed -E vs -r, date vs gdate, stat vs gstat; note fallbacks for macOS.
  • Prefer built-ins where possible; for large data sets, use awk/perl instead of large Bash loops.

Debugging & Validation

  • Trace with set -x (or bash -x script.sh); use PS4='+ ${BASH_SOURCE}:${LINENO}: ' for context.
  • shellcheck script.sh for linting; address quoting and word-splitting warnings first.
  • Log intermediates with printf '%s\n' "msg: $var"; disable tracing after debug.
  • Provide dry-run flags and confirmation prompts before destructive actions.

References

See references/bash_patterns.md for ready-to-use snippets: script skeletons, getopts template, safe find/xargs, mktemp + traps, heredocs, array handling, and bats test scaffolding. Load it only when deeper examples are needed.

리뷰

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

댓글

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

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

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

0 / 1,000자

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

같은 저장소의 스킬

Add an iOS App Clip target to an Expo app. Use when the user mentions App Clip, AASA, apple-app-site-association, appclips, smart app banner, or wants to ship a lightweight iOS Clip invoked from a URL alongside their parent app.

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

heyAyushh/stacc32026년 9월 21일 업데이트

Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

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

heyAyushh/stacc32026년 9월 21일 업데이트

Add Agentation visual feedback toolbar to a Next.js project

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

heyAyushh/stacc32026년 9월 21일 업데이트

Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.

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

heyAyushh/stacc32026년 9월 21일 업데이트

Derive and implement first-principles audio-coupled haptic and kinetic UI feedback. Use when designing, reviewing, or coding haptics/audio for mobile apps, native iOS/Android, React Native/Expo, SwiftUI, games, detent pickers, toggles, sliders, page curls, scroll gestures, wallet/signature flows, Solana transactions, backend/realtime state changes, confirmations, settlements, and semantic UI events where feedback should follow signal math instead of ad hoc vibration calls.

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

heyAyushh/stacc32026년 9월 21일 업데이트

Babysit a GitHub pull request during a user-approved monitoring window by polling review comments, CI checks/workflow runs, and mergeability state. Diagnose failures, retry likely flaky failures up to 3 times, auto-fix/push branch-related issues when appropriate, and report fresh review feedback. Use when the user asks Codex to monitor a PR, watch CI, handle review comments, or keep an eye on failures and feedback on an open PR.

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

heyAyushh/stacc32026년 9월 21일 업데이트

heyAyushh의 스킬 모두 보기

이 스킬의 문제 신고