Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add skills/secondsky/claude-skills/claude-code-bash-patternsnpx skills add secondsky/claude-skills --skill claude-code-bash-patternsgit clone --depth 1 https://github.com/secondsky/claude-skillsWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/secondsky/claude-skills/claude-code-bash-patterns)<a href="https://agentmods.dev/skills/secondsky/claude-skills/claude-code-bash-patterns"><img src="https://agentmods.dev/badge/skills/secondsky/claude-skills/claude-code-bash-patterns.svg" alt="Measured on agentmods" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00052 | $0.02175 |
| Opus 5 | $0.00026 | $0.01087 |
| Sonnet 5 | $0.00010 | $0.00435 |
| Haiku 4.5 | $0.00005 | $0.00217 |
Grade B, and why
claude-code-bash-patterns scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletemediumDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
3. **Never run rm -rf without confirmation** Downgraded: this mod is about security review, or the phrase is quoted, so it is likely naming the pattern rather than instructing it.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
curl -H "Authorization: Bearer $API_KEY" api.example.com How it starts
The opening of the file, as written. The whole thing — 424 lines — stays where its author put it; the contents beside it link to each section on GitHub.
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
Use when: Long-running tasks
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 ✅
- Use && for sequential dependencies (not semicolons)
- Quote paths with spaces (
cd "path with spaces") - Check environment before destructive ops (rm, git push --force)
- Use specialized tools first (Read, Grep, Glob before Bash)
- Set timeouts for long operations (up to 10 minutes)
- Validate inputs before passing to shell commands
- Use hooks for repeated patterns (logging, validation)
- Maintain session state (export variables once)
- Handle errors explicitly (check exit codes)
- Document custom commands in .claude/commands/
What ships with it
13 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- references/cli-tool-integration.md 4.8 KB
- references/git-workflows.md 9.7 KB
- references/hooks-examples.md 6.7 KB
- references/security-best-practices.md 4.1 KB
- references/troubleshooting-guide.md 8.4 KB
- scripts/bash-audit-logger.sh 4.7 KB runs code
- scripts/dangerous-command-guard.py 6.4 KB runs code
- scripts/package-manager-enforcer.sh 2.3 KB runs code
- templates/.envrc.example 5.7 KB
- templates/custom-command-template.md 5.1 KB
- templates/dangerous-commands.json 2.9 KB
- templates/github-workflow.yml 3.1 KB
- templates/settings.json 3.1 KB
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 424 lines · 52 tokens per session scan B 1c1be2d7633e
claude-code-bash-patterns is a skill published in the GitHub repository secondsky/claude-skills (214 stars, last pushed 2d ago), licensed MIT. It adds 52 tokens to every session and 2,175 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it B with 2 findings (recursive force delete, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.
Other skills, from other repositories
promote
Turn a scratch script into a permanent tool this repo keeps. Use when a check, report, or analysis has proved worth running more than once.
remember
Record why something is the way it is — a decision and its reasoning, a lesson that cost time, or a standing constraint. Use when the reasoning behind a choice would be expensive to reconstruct later.
resume
Write down where this stretch of work stopped, so the next session continues instead of restarting. Use at the end of a working session, or when handing the repository to someone else.
bootstrap
Set up chamnan in this repository for the first time — build the architecture index, measure how well the code describes itself, fill in missing file comments, and record a baseline. Run once per repo.
milestone
Record a change that reshaped the repository — what moved, why it was worth doing, and which areas it touched. Use after a migration, a rewrite, or a decision that changed how part of the system works.
capture
Write down a procedure worth keeping — a multi-step process, a trap that cost real time, or something that has now come up three times. Use it the moment you finish such a task, while the details are still exact.