Skip to content
Development
Hook

Hooks

What claude-code-config runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

From plugin
claude-code-config
2.1k4 commands2 hooks

Where it lives

  • hooks/enforce-package-manager.shGitHub
    Read the script
    #!/bin/bash
    set -euo pipefail
    # EXAMPLE: PreToolUse hook — blocks npm in projects that use pnpm.
    # Adapt for any "use X not Y" convention (e.g., yarn vs npm, uv vs pip).
    CMD=$(jq -r '.tool_input.command // empty')
    [[ -z "$CMD" ]] && exit 0
    
    # Only enforce if this project uses pnpm
    [[ ! -f "${CLAUDE_PROJECT_DIR}/pnpm-lock.yaml" ]] && exit 0
    
    if echo "$CMD" | grep -qE '^npm\s'; then
      echo "BLOCKED: This project uses pnpm, not npm. Use pnpm instead." >&2
      exit 2
    fi
    exit 0
    
  • hooks/log-gam.shGitHub
    Read the script
    #!/bin/bash
    set -euo pipefail
    # EXAMPLE: PostToolUse hook — logs GAM (Google Apps Manager) write operations
    # to JSONL. Adapt the verb patterns for any CLI tool where you want an audit
    # trail of mutations. See README.md for wiring instructions.
    INPUT=$(cat)
    COMMAND=$(echo "${INPUT}" | jq -r '.tool_input.command // empty')
    
    [[ -z "${COMMAND}" ]] && exit 0
    [[ "${COMMAND}" != *'gam7/gam '* ]] && exit 0
    
    # Verb lists verified against GamCommands.txt v7.33.00
    READ_PATTERN='(print|show|info|get|list|report|check|version|help)'
    WRITE_PATTERN='(create|add|update|delete|remove|suspend|unsuspend|wipe|sync|move|transfer|trash|purge|enable|disable|deprovision)'
    
    GAM_ARGS="${COMMAND#*gam7/gam }"
    FIRST_WORD="${GAM_ARGS%% *}"
    
    # Skip read operations
    echo "${FIRST_WORD}" | grep -qiE "^${READ_PATTERN}$" && exit 0
    
    # Match write verb
    ACTION=$(echo "${GAM_ARGS}" | grep -oiE "(^|[[:space:]])${WRITE_PATTERN}([[:space:]]|$)" \
      | head -1 | tr -d ' ' || true)
    [[ -z "${ACTION}" ]] && exit 0
    
    # Log the mutation
    EXIT_CODE=$(echo "${INPUT}" | jq -r '.tool_result.exit_code // 0')
    [[ "${EXIT_CODE}" == "0" ]] && STATUS="success" || STATUS="failed"
    LOG_FILE="${CLAUDE_PROJECT_DIR}/google/.changelog-raw.jsonl"
    mkdir -p "$(dirname "${LOG_FILE}")"
    
    jq -nc \
      --arg ts "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
      --arg action "${ACTION}" \
      --arg command "${COMMAND}" \
      --arg status "${STATUS}" \
      '{timestamp: $ts, action: $action, command: $command, status: $status}' \
      >> "${LOG_FILE}"
    
    # Remind the operator
    if [[ "${STATUS}" == "success" ]]; then
      echo "GAM MUTATION: ${ACTION} — logged to ${LOG_FILE}"
    fi
    exit 0
    

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

@trailofbits
Ships withclaude-code-config

Opinionated defaults, documentation, and workflows for Claude Code at Trail of Bits. Covers sandboxing, permissions, hooks, skills, MCP servers, and usage patterns we've found effective across security audits, development, and research.

Stars on GitHub

Momentum

stars in total
2.1k
Star history of trailofbits/claude-code-config on GitHub, a chart by star-history.com

More plugins that ship hooks.

superpowers

superpowers

A development methodology for coding agents that makes the agent brainstorm before building, follow plans, run parallel work and finish branches in a disciplined way. You get fewer skipped steps and more consistent results from your coding assistant.

15 skills1 hook311k
@obra@obra
Install Plugin
ponytail

ponytail

A Claude Code plugin with skills for auditing a whole repo, reviewing a change, listing deferred shortcut comments, and showing measured savings and a quick command reference.

6 skills10 hooks188k
@dietrichgebert@dietrichgebert
Install Plugin
agent-skills

agent-skills

Walks a software change from a written spec through design, testing, code review, CI/CD, and release, applying the matching engineering skill at each stage. Useful for developers using Claude Code on full development workflows.

25 skills+3112k
@addyosmani@addyosmani
Install Plugin
planning-with-files

planning-with-files

Persistent file-based planning for AI coding agents on long-running, multi-step tasks. It keeps task_plan.md, findings.md and progress.md on disk, so work can resume after /clear or context compaction.

6 skills+228k
@othmanadi@othmanadi
Install Plugin
gsd-core

gsd-core

A spec-driven development workflow for Claude Code that guides a project through planning, phases, milestone audits and fixes. Includes skills to generate tests from UAT criteria and to audit completed work.

72 skills+311k
@open-gsd@open-gsd
Install Plugin
superpowers-zh

superpowers-zh

Chinese-language skill pack for Claude Code that adds workflow guidance for brainstorming, TDD, debugging, and code review, plus Chinese conventions for commits, documentation, and domestic Git platforms like Gitee and Coding.net.

21 skills1 hook8.5k
@jnmetacode@jnmetacode
Install Plugin
socraticode

socraticode

Gives Claude Code semantic search, dependency graph and architecture context over a codebase, so an AI assistant can explore and understand a project's code. Includes skills for indexing a project and managing its file watching.

2 skills+33.4k
@giancarloerra@giancarloerra
Install Plugin
cocoindex-code

cocoindex-code

A lightweight code search engine that uses AST-based semantic search with local embeddings and incremental indexing. It helps Claude Code users find code faster and more efficiently.

1 skill1 MCP+13k
@cocoindex-io@cocoindex-io
Install Plugin

Questions about the hooks in claude-code-config.

Which coding agents can use the hooks in claude-code-config?
The hooks in claude-code-config install in Claude Code and Cursor: each runs Claude Code hooks from .claude/settings.json, so copy the hooks there.