jpskill.com
💬 コミュニケーション コミュニティ

shell-scripts

Use when writing or reviewing Bash scripts and shell snippets, especially for shebang selection, quoting, parameter expansion ("${VAR}" style), test expressions ([ ] vs [[ ]]), ShellCheck-guided fixes, and portability decisions across POSIX sh, Bash, and zsh compatibility targets.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o shell-scripts.zip https://jpskill.com/download/10644.zip && unzip -o shell-scripts.zip && rm shell-scripts.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/10644.zip -OutFile "$d\shell-scripts.zip"; Expand-Archive "$d\shell-scripts.zip" -DestinationPath $d -Force; ri "$d\shell-scripts.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して shell-scripts.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → shell-scripts フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

Writing Shell Scripts

Overview

Write shell code with an explicit portability target first, then apply strict quoting and a bounded ShellCheck remediation loop. Default to Bash readability and safety; switch to POSIX-only mode when the user asks for strict portability.

Invocation Notice

  • Inform the user when this skill is being invoked by name: shell-scripts.

When to Use

  • Creating or refactoring Bash scripts.
  • Reviewing shell snippets for correctness and safety.
  • Standardizing shebangs, quoting, variable expansion style, and test syntax.
  • Deciding between POSIX-compliant syntax and Bash-specific features.
  • Improving compatibility with zsh environments.

When NOT to use:

  • The task is strictly fish, powershell, or Windows batch.
  • The user explicitly wants pure POSIX sh and no Bash features (use POSIX mode from references/compatibility-matrix.md).

Workflow

  1. Select the target mode from references/compatibility-matrix.md: POSIX strict, Bash-first, or Bash-with-zsh-compatibility.
  2. Start from assets/script-template.sh or pull focused snippets from:
    • assets/usage-template.txt
    • assets/logging-template.sh
    • assets/getopts-template.sh
  3. Apply style defaults:
    • Shebang per target mode.
    • Prefer ${VAR} expansion form for clarity.
    • Quote expansions unless intentionally relying on shell splitting/pattern behavior.
    • In Bash mode, prefer arrays for argument vectors and list handling; in POSIX mode, avoid arrays.
    • Use [[ ... ]] for Bash conditionals; use [ ... ] when POSIX compatibility is required.
    • For command execution, verify resolution with command -v / type -a when shadowing is possible.
  4. Validate syntax and lint:
    • bash -n path/to/script.sh
    • shellcheck -x path/to/script.sh (if available)
  5. ShellCheck remediation budget:
    • Do at most two fix rounds.
    • Round 1: fix correctness/safety and high-confidence issues.
    • Round 2: re-run and fix remaining practical issues.
    • Stop after round 2 and report remaining findings with rationale.
  6. For advanced logic and portability traps, load:
    • references/advanced-patterns.md
    • references/command-resolution-and-os-portability.md
    • references/quoting-and-expansion.md
    • references/tests-and-conditionals.md
    • references/shellcheck-workflow.md

Output

  • A script (or patch) with explicit target shell assumptions.
  • Consistent quoting/expansion style and conditional style.
  • ShellCheck findings reduced within the two-pass budget, with unresolved items documented.

References

  • references/compatibility-matrix.md
  • references/quoting-and-expansion.md
  • references/tests-and-conditionals.md
  • references/shellcheck-workflow.md
  • references/advanced-patterns.md
  • references/command-resolution-and-os-portability.md
  • references/shellcheck-codes.md