secondsky/claude-skills / plugins/claude-code-bash-patterns/skills/claude-code-bash-patterns
claude-code-bash-patterns
FlaggedClaude 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 8.4 KB |
| references/cli-tool-integration.md | markdown | 4.8 KB |
| references/git-workflows.md | markdown | 9.7 KB |
| references/hooks-examples.md | markdown | 6.7 KB |
| references/security-best-practices.md | markdown | 4.1 KB |
| references/troubleshooting-guide.md | markdown | 8.4 KB |
| scripts/bash-audit-logger.shexecutable | script | 4.7 KB |
| scripts/dangerous-command-guard.pyexecutable | script | 6.4 KB |
| scripts/package-manager-enforcer.shexecutable | script | 2.3 KB |
| templates/.envrc.example | other | 5.7 KB |
| templates/custom-command-template.md | markdown | 5.1 KB |
| templates/dangerous-commands.json | config | 2.9 KB |
| templates/github-workflow.yml | config | 3.1 KB |
| templates/settings.json | config | 3.1 KB |
templates/settings.json
View on GitHub{
"_comment_WARNING": "OPT-IN TEMPLATE. This file is a template shipped inside the claude-code-bash-patterns skill. Copying it verbatim to ~/.claude/settings.json ENABLES the hooks described below for every session. Review each hook before adopting. The SessionStart hook below will source .envrc ONLY if you create an explicit opt-in sentinel file (see comment).",
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "python3 ~/.claude/hooks/dangerous-command-guard.py",
"description": "Block dangerous bash commands (rm -rf /, git push --force main, etc.)"
},
{
"type": "command",
"command": "~/.claude/hooks/bash-audit-logger.sh",
"description": "Log all bash commands to ~/.claude/bash-audit.log"
},
{
"type": "command",
"command": "~/.claude/hooks/package-manager-enforcer.sh",
"description": "Enforce package manager consistency (pnpm/yarn/npm)"
}
]
},
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.tool_input.file_path // empty'); if echo \"$FILE\" | grep -qE '(^|\\/)(production\\.env|\\.env\\.production|prod\\.config)$'; then echo 'ERROR: Cannot modify production config files' >&2; exit 2; fi",
"description": "Prevent modification of production config files"
}
]
}
],
"PostToolUse": [
{
"matcher": "Write|Edit",
"hooks": [
{
"type": "command",
"command": "FILE=$(echo \"$CLAUDE_TOOL_INPUT\" | jq -r '.tool_input.file_path'); [ -f \"$FILE\" ] && prettier --write \"$FILE\" > /dev/null 2>&1 || true",
"description": "Auto-format files after editing (if prettier is available)"
}
]
}
],
"SessionStart": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "# SessionStart env loader (opt-in).\n# WARNING: sourcing .envrc executes ARBITRARY SHELL from the project directory.\n# It is OFF by default. To opt in, create a sentinel file at the project root:\n# touch .claude-enable-envrc\n# Claude Code already exposes any env var you set in your shell or via\n# `claude config`; you do NOT need to dump `env` into $CLAUDE_ENV_FILE.\nif [ -f .claude-enable-envrc ] && [ -f .envrc ]; then\n set -a; . ./.envrc; set +a\nfi\n",
"description": "Opt-in .envrc loader (requires .claude-enable-envrc sentinel). Never dumps env."
}
]
}
]
},
"allowedTools": [
"Read",
"Write",
"Edit",
"Glob",
"Grep",
"Bash(git *)",
"Bash(gh *)",
"Bash(npm *)",
"Bash(pnpm *)",
"Bash(npx *)",
"Bash(node *)",
"Bash(python*)",
"Bash(wrangler *)",
"Bash(ls *)",
"Bash(cat *)",
"Bash(echo *)",
"Bash(which *)",
"Bash(chmod *)",
"Bash(mkdir *)",
"Bash(touch *)"
]
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 468k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |