claude-code-bash-patterns

Solid

Claude Code Bash tool patterns with hooks, automation, git workflows. Use for PreToolUse hooks, command chaining, CLI orchestration, custom commands, or encountering bash permissions, command failures, security guards, hook configurations.

AI & Automation 162 stars 25 forks Updated 2 weeks ago MIT

Install

View on GitHub

Quality Score: 88/100

Stars 20%
74
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Claude Code Bash Patterns **Status**: Production Ready ✅ | **Last Verified**: 2025-11-18 --- ## Quick Start ### Basic Command ```bash ls -la ``` ### Command Chaining ```bash bun install && bun run build && bun test ``` ### Hooks Create `.claude-hook-pretooluse.sh`: ```bash #!/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 ```bash 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 ```bash # 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 **Use when**: Long-running tasks ```bash npm run dev & # Get PID with $! ``` --- ### 5. Hooks for Automation **Use when**: Need pre/post command logic **Load `references/hooks-examples.md` for all hook types.** --- ## Critical Rules ### Always Do ✅ 1. **Use && for sequential dependencies** (not semicolons...

Details

Author
secondsky
Repository
secondsky/claude-skills
Created
6 months ago
Last Updated
2 weeks ago
Language
TypeScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

claude-code-hooks

Claude Code hook system for pre/post tool execution. Triggers on: hooks, PreToolUse, PostToolUse, hook script, tool validation, audit logging.

335 Updated today
aiskillstore
AI & Automation Listed

claude-hooks

Claude Code hooks configuration specialist. Use when creating hooks for tool validation, logging, notifications, or custom automation in Claude Code.

335 Updated today
aiskillstore
AI & Automation Listed

hook-recipes

Curated collection of ready-to-use Claude Code hook recipes for safety, automation, formatting, logging, and context injection. Use when configuring hooks, setting up safety guards, automating workflows, or when user mentions 'hooks', 'PreToolUse', 'PostToolUse', 'guard', 'automation', 'claude hooks'.

62 Updated today
Tibsfox
AI & Automation Solid

hook-development

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

29,021 Updated today
anthropics
AI & Automation Solid

hook-development

This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.

27,705 Updated today
davila7