Token导航 LogoToken导航TokenDH.com
运维和基础设施敏感数据github未标认证来源可访问clear审计异常

claude-code-bash-patternsClaude 代码 bash 模式

Agent Skill

claude-code-bash-patterns 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

4,128

周安装

167

GitHub Stars

128

下载量

1,296
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:claude-code-bash-patterns(Claude 代码 bash 模式)
来源仓库:https://github.com/secondsky/claude-skills
仓库路径:skills/claude-code-bash-patterns
安装命令:
npx skills add https://github.com/secondsky/claude-skills --skill claude-code-bash-patterns
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/secondsky/claude-skills --skill claude-code-bash-patterns

简介

claude-code-bash-patterns 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。

  • 它可协助梳理仓库结构、追踪 Issue 进展、分析 Pull Request 变更,以及辅助代码协作流程管理。
  • 通过 npx skills add 命令从指定仓库安装,具体用法请参考原始 README 和项目文档。
  • 安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

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 ✅

  1. Use && for sequential dependencies (not semicolons)
  2. Quote paths with spaces (cd "path with spaces")
  3. Check environment before destructive ops (rm, git push --force)
  4. Use specialized tools first (Read, Grep, Glob before Bash)
  5. Set timeouts for long operations (up to 10 minutes)
  6. Validate inputs before passing to shell commands
  7. Use hooks for repeated patterns (logging, validation)
  8. Maintain session state (export variables once)
  9. Handle errors explicitly (check exit codes)
  10. Document custom commands in.claude/commands/

Never Do ❌

  1. Never use; for dependent commands (use &&)
  2. Never skip quoting paths with spaces
  3. Never run rm -rf without confirmation
  4. Never expose secrets in command output
  5. Never ignore timeout limits (max 10 min)
  6. Never use bash for file operations when specialized tools exist
  7. Never chain with newlines (use && or; explicitly)
  8. Never force-push to main without explicit user request
  9. Never skip hooks (--no-verify) without user request
  10. Never use interactive commands (git rebase -i, git add -i)

Git Workflows

Basic Commit

git add . && git commit -m "feat: add feature"

Commit with Testing

npm test && git add . && git commit -m "fix: bug fix" && git push

Pull Request

git checkout -b feature/new && git add . && git commit -m "feat: new feature" && git push -u origin feature/new

Load references/git-workflows.md for complete workflows including:

  • Feature branch workflow
  • PR creation automation
  • Commit message conventions
  • Pre-commit validation

Hooks: Advanced Automation

PreToolUse Hook

.claude-hook-pretooluse.sh:

#!/usr/bin/env bash
COMMAND="$1"

# Log all commands
echo "[$(date)] Running: $COMMAND" >> ~/claude-commands.log

# Block dangerous patterns
if [[ "$COMMAND" =~ rm\ -rf\ / ]]; then
    echo "❌ Blocked dangerous command"
    exit 1
fi

Hook Types

  • pretooluse - Before every Bash command
  • stop - Before conversation ends
  • user-prompt-submit - After user submits message

Load references/hooks-examples.md for all hook types and examples.


CLI Tool Integration

npm/bun

bun install && bun run build

wrangler (Cloudflare)

bunx wrangler deploy

gh (GitHub CLI)

gh pr create --title "Fix bug" --body "Description"

Load references/cli-tool-integration.md for complete tool patterns.


Custom Commands

Create .claude/commands/deploy.md:

---
description: Deploy to production
---

Run these steps:
1. Run tests: `npm test`
2. Build: `npm run build`
3. Deploy: `wrangler deploy`

User can invoke with: /deploy

Load templates/custom-command-template.md for template.


Security

Allowlisting Tools

settings.json:

{
  "dangerousCommandsAllowList": [
    "git push --force"
  ]
}

Secrets Management

# ✅ Good: Use environment variables
export API_KEY="$SECURE_VALUE"

# ❌ Bad: Hardcode secrets
curl -H "Authorization: Bearer sk-abc123..."

Load references/security-best-practices.md for complete security guide.


Common Use Cases

Use Case 1: Test Before Commit

npm test && git add . && git commit -m "message"

Use Case 2: Deploy with Validation

npm run lint && npm test && npm run build && bunx wrangler deploy

Use Case 3: Multi-Repo Operations

cd repo1 && git pull && cd ../repo2 && git pull

Use Case 4: Background Process

npm run dev &

Load references/cli-tool-integration.md for more patterns.


Troubleshooting

Issue: Command times out

Solution: Increase timeout or use background mode

# Background mode
npm run dev &

Issue: Path with spaces fails

Solution: Quote the path

cd "path with spaces/file.txt"

Issue: Hook blocks command

Solution: Check hook logic in .claude-hook-pretooluse.sh

Load references/troubleshooting-guide.md for all issues.


When to Load References

Load references/git-workflows.md when:

  • Setting up git automation
  • Creating PRs programmatically
  • Need commit message conventions
  • Want pre-commit validation patterns

Load references/hooks-examples.md when:

  • Creating custom hooks
  • Need hook templates
  • Want validation patterns
  • Implementing logging/security

Load references/cli-tool-integration.md when:

  • Orchestrating multiple CLI tools
  • Need tool-specific patterns
  • Want parallel execution examples
  • Troubleshooting tool integration

Load references/security-best-practices.md when:

  • Configuring security guards
  • Setting up allowlisting
  • Managing secrets
  • Preventing dangerous operations

Load references/troubleshooting-guide.md when:

  • Debugging command failures
  • Encountering timeouts
  • Hooks behaving unexpectedly
  • Session state issues

Using Bundled Resources

References (references/)

  • git-workflows.md - Complete git automation patterns
  • hooks-examples.md - All hook types with examples
  • cli-tool-integration.md - Tool orchestration patterns
  • security-best-practices.md - Security configuration guide
  • troubleshooting-guide.md - Common issues and solutions

Templates (templates/)

  • custom-command-template.md - Custom command template
  • settings.json - Security settings example
  • .envrc.example - Environment variables example
  • github-workflow.yml - GitHub Actions integration
  • dangerous-commands.json - Dangerous patterns list

Examples

Feature Development Workflow

git checkout -b feature/oauth && \
  npm test && \
  git add . && \
  git commit -m "feat(auth): add OAuth support" && \
  git push -u origin feature/oauth

CI/CD Pipeline

npm run lint && \
  npm test && \
  npm run build && \
  bunx wrangler deploy

Multi-Project Update

cd project1 && bun install && cd ../project2 && bun install

Official Documentation


Questions? Issues?

  1. Check references/troubleshooting-guide.md for common issues
  2. Review references/git-workflows.md for git patterns
  3. See references/hooks-examples.md for automation
  4. Load references/security-best-practices.md for security

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

28.42%
按下载量换算368

windsurf

22.73%
按下载量换算295

Cursor

18.47%
按下载量换算239

Claude Code

12.47%
按下载量换算162

pi

8.11%
按下载量换算105

openclaw

3.28%
按下载量换算43

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills