Skip to content
secondsky avatar

Claude Code Bash Patterns

Bash command patterns, PreToolUse hooks, and git workflows for Claude Code, with security guardrails and CLI integration.

CCM score
46 of 100
skills.sh installs
417
GitHub stars
257
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers sequential and parallel command chaining, session persistence, background processes, and custom slash commands
  • Includes 5 reference guides (git-workflows.md, hooks-examples.md, cli-tool-integration.md, security-best-practices.md, troubleshooting-guide.md) and 5 templates
  • Enforces rules such as && for dependent commands, quoted paths, no --no-verify or force-push without request, and a dangerous-command blocklist
  • Designed for developers configuring hooks, allowlists, and automated git, npm, bun, and wrangler workflows in Claude Code

Install

$ npx -y skills add secondsky/claude-skills --skill claude-code-bash-patterns -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Claude Code Bash Patterns

Status: Production Ready ✅ | Last Verified: 2025-11-18


Quick Start

Basic Command

ls -la

Command Chaining

bun install && bun run build && bun test

Hooks

Create .claude-hook-pretooluse.sh:

#!/usr/bin/env bash
# PreToolUse hook - runs before every Bash command

echo "Running: $1"

Load references/hooks-examples.md for complete hook patterns.


The Five Core Patterns

1. Sequential Operations (&&)

Use when: Each command depends on previous success

git add . && git commit -m "message" && git push

Why: Stops chain if any command fails


2. Parallel Operations (Multiple tool calls)

Use when: Commands are independent

Message with multiple Bash tool calls in parallel

Load references/cli-tool-integration.md for parallel patterns.


3. Session Persistence

Use when: Need to maintain state across commands

# Set environment variable
export API_KEY="sk-..."

# Use in later commands (same session)
curl -H "Authorization: Bearer $API_KEY" api.example.com

4. Background Processes

Details

Repository
github.com/secondsky/claude-skills
Categories
CLI & Terminal, Git & Releases
First seen
Jun 3, 2026

Questions

What does the claude-code-bash-patterns skill do?

The claude-code-bash-patterns skill gives Claude Code patterns for the Bash tool, covering PreToolUse hooks, command chaining, git workflows, custom commands and security guards. It also covers handling bash permission errors, command failures and hook configurations.

How do I install the claude-code-bash-patterns skill?

Run npx -y skills add secondsky/claude-skills --skill claude-code-bash-patterns -y in your project. After that, the claude-code-bash-patterns skill lets the agent follow its Bash rules, such as chaining dependent commands with && and quoting paths with spaces.

Who is the claude-code-bash-patterns skill for?

The claude-code-bash-patterns skill is for developers who use Claude Code and want to automate shell work safely. It suits anyone writing PreToolUse hooks, orchestrating CLI tools or adding custom commands in .claude/commands.

Does the claude-code-bash-patterns skill need any accounts or API keys?

The claude-code-bash-patterns skill itself needs no account. Its security guidance tells you to pass API keys through environment variables rather than hardcoding them in commands.

More from secondsky/claude-skills

All 116

Similar to Claude Code Bash Patterns

More CLI & Terminal