
Claude Code Bash Patterns
A systematic reference for orchestrating bash commands in Claude Code through hooks, command chaining, and session persistence. You're getting patterns for the five core scenarios (sequential with &&, parallel tool calls, stateful sessions, background processes, and PreToolUse hooks), plus git workflow automation and CLI tool integration. The 55% token savings comes from teaching you when to chain commands versus fire parallel tool calls, and the hooks let you inject logging or security checks before every bash execution. Load this when you're setting up automated workflows, need to understand why your commands are timing out, or want to stop re-explaining that git operations should chain with && instead of semicolons.
- skills.sh installs
- 408
- GitHub stars
- 248
- last updated
- Aug 21, 2026
Install
$ npx -y skills add secondsky/claude-skills --skill claude-code-bash-patterns --agent claude-codeInstalls into .claude/skills of the current project.
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
Sponsors
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Frontend Development, Security, Git & Pull Requests, Automation & Workflows, CLI & Terminal
- First seen
- Jun 3, 2026
More from secondsky/claude-skills
All 146- Claude Hook Writer408
- Logging Best Practices408
- Cloudflare Manager407
- Plan Interview406
- Ml Pipeline Automation402
- Nuxt Core401
- Nuxt Data400
- Microservices Patterns398
- Multi Ai Consultant397
- Graphql Implementation393
- Mcp Management393
- Model Deployment393
- Jest Generator391
- Cloudflare Agents389
- Cloudflare Mcp Server388
- Thesys Generative Ui384
- Access Control Rbac381
- Maz Ui380
- React Best Practices380
- Woocommerce Backend Dev379
- Woocommerce Code Review379
- Bun Hono Integration376
- Bun Test Basics375
- Woocommerce Copy Guidelines374