
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.
$ npx -y skills add secondsky/claude-skills --skill claude-code-bash-patterns --agent claude-codeInstalls into .claude/skills of the current project.
Status: Production Ready ✅ | Last Verified: 2025-11-18
ls -la
bun install && bun run build && bun test
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.
Use when: Each command depends on previous success
git add . && git commit -m "message" && git push
Why: Stops chain if any command fails
Use when: Commands are independent
Message with multiple Bash tool calls in parallel
Load references/cli-tool-integration.md for parallel patterns.
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
Sponsors