Skip to content
Agent Orchestration
Hook

Hooks

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

From plugin
bigpowers
29280 skills1 hook1 MCP

Claude Code

$ npx -y skills add danielvm-git/bigpowers --agent claude-code

Where it lives

  • hooks/pre-tool-use.shGitHub
    Read the script
    #!/usr/bin/env bash
    # bigpowers — pre-tool-use.sh
    # Harness-agnostic Git Safety Hook for Claude Code, Cursor, and Gemini CLI.
    # Enforces:
    # 1. Block dangerous commands (force push, reset --hard, etc.)
    # 2. Enforce Conventional Commits for 'git commit'
    # 3. Block direct commits/pushes to protected branches (main, master)
    #    unless GIT_BIGPOWERS_LAND=1 (scripts/land-branch.sh only)
    
    set -euo pipefail
    
    # Configuration
    PROTECTED_BRANCHES=("main" "master")
    # Last-resort literals, used only when the normalizer is unreachable.
    LEGACY_DANGEROUS=(
      "git reset --hard"
      "git clean -f"
      "git branch -D"
      "push --force"
      "push -f"
    )
    CONVENTIONAL_COMMITS_REGEX='^(feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert)(\(.+\))?!?:[[:space:]].+'
    LAND_MODE="${GIT_BIGPOWERS_LAND:-}"
    
    # Detect mode from environment (for Gemini/Claude/Cursor parity)
    # GIT_GUARDRAILS_MODE: claude (default) | cursor | gemini
    MODE="${GIT_GUARDRAILS_MODE:-claude}"
    
    # --- Normalized git argv (BUG-2026-11-03-guard-git-flag-normalize, #184) ------
    # Literal substring matching cannot see a global flag in front of the subcommand
    # or a flag between the subcommand and the destructive option: the destructive
    # tokens are all still there, only their position changed. The rules live in
    # scripts/lib/git-argv.py and are mirrored in extensions/omp-hooks.ts;
    # scripts/test-guard-git-normalize.sh fails if the two disagree on any fixture.
    SELF_PATH="${BASH_SOURCE[0]}"
    # Only pay for realpath when the hook actually is a symlink (installed copies).
    # This hook runs on every tool call, so a spawn per invocation is real latency.
    if [ -L "$SELF_PATH" ] && command -v python3 >/dev/null 2>&1; then
      SELF_PATH="$(python3 -c 'import os,sys;print(os.path.realpath(sys.argv[1]))' "$SELF_PATH" 2>/dev/null || echo "$SELF_PATH")"
    fi
    GUARD_ROOT="$(cd "$(dirname "$SELF_PATH")/.." 2>/dev/null && pwd -P || true)"
    GIT_ARGV="$GUARD_ROOT/scripts/lib/git-argv.py"
    
    # classify_git_argv <command>: echoes "block: <reason>" or nothing.
    # Fast path: a command with no "git" token cannot contain a git invocation, so
    # the helper (a python start) is skipped. Falls back to the legacy literal
    # patterns when the helper is unreachable (hook symlinked outside the package).
    classify_git_argv() {
      local cmd="$1" out=""
      case "$cmd" in
        *git*) ;;
        *) return 0 ;;
      esac
      if command -v python3 >/dev/null 2>&1 && [ -f "$GIT_ARGV" ]; then
        out="$(python3 "$GIT_ARGV" --command "$cmd" 2>/dev/null || true)"
        case "$out" in
          block:*) printf '%s' "$out"; return 0 ;;
          *) return 0 ;;
        esac
      fi
      return 0
    }
    
    deny() {
      local reason="$1"
      if [ "$MODE" = "gemini" ]; then
        jq -nc --arg reason "$reason" '{decision: "deny", reason: $reason}'
      else
        echo "$reason" >&2
        exit 2
      fi
    }
    
    # Read input from stdin
    INPUT=$(cat)
    
    # Extract command and file path using jq (standard in bigpowers)
    COMMAND=$(echo "$INPUT" | jq -r '.command // .tool_input.command // empty')
    FILE_PATH=$(echo "$INPUT" | jq -r '.file_path // .tool_input.file_path // .path // .tool_input.path // .target_file // .tool_input.target_file // empty')
    TOOL_NAME=$(echo "$INPUT" | jq -r '.tool // .name // .tool_name // empty')
    # Session working directory from the hook payload. The hook process can start in a
    # different checkout than the session (a git worktree session runs from its own
    # folder while the harness runs the hook elsewhere), so the branch check below must
    # read the session's repo, not the hook's own cwd.
    HOOK_CWD=$(echo "$INPUT" | jq -r '.cwd // .tool_input.cwd // empty')
    
    # 0. Check file editing rules
    if [ -n "$FILE_PATH" ]; then
      # e86s01: Generated paths are blocked at edit time
      if [[ "$FILE_PATH" =~ ^\.cursor/rules/ ]] || [[ "$FILE_PATH" =~ ^\.gemini/extensions/ ]] || [[ "$FILE_PATH" =~ ^\.windsurf/ ]]; then
        deny "BLOCKED: Generated file '$FILE_PATH' cannot be edited directly. Edit the source SKILL.md instead and run bash scripts/sync-skills.sh."
      fi
    
      # e86s02: Tests are locked during fix_bug flow after RED commit
      if [[ "$FILE_PATH" =~ (^|/)test/ ]] || [[ "$FILE_PATH" =~ (^|/)tests/ ]] || [[ "$FILE_PATH" =~ \.test\.[^/]+$ ]] || [[ "$FILE_PATH" =~ _test\.[^/]+$ ]] || [[ "$FILE_PATH" =~ (^|/)test_[^/]+$ ]]; then
        if [ -f specs/state.yaml ] && grep -qE "active_flow:[[:space:]]*fix_bug" specs/state.yaml 2>/dev/null; then
          if git rev-parse --git-dir >/dev/null 2>&1; then
            recent_log=$(git log -n 5 --format=%s 2>/dev/null || true)
            if echo "$recent_log" | grep -qE '^test(\(.+\))?:'; then
              deny "BLOCKED: Test files ($FILE_PATH) are locked during fix_bug after the RED commit. Write the fix in production code (src/), not in tests."
            fi
          fi
        fi
      fi
    fi
    
    if [ -z "$COMMAND" ]; then
      [ "$MODE" = "gemini" ] && echo '{"decision":"allow"}'
      exit 0
    fi
    
    # 1. Normalized git argv (git push is NOT blanket-blocked)
    GIT_VERDICT="$(classify_git_argv "$COMMAND")"
    if [ -n "$GIT_VERDICT" ]; then
      deny "BLOCKED: ${GIT_VERDICT#block: }. Use a safer approach or ask the user."
    fi
    if [ ! -f "$GIT_ARGV" ]; then
      for p in "${LEGACY_DANGEROUS[@]}"; do
        if echo "$COMMAND" | grep -qE "$p"; then
          deny "BLOCKED: '$COMMAND' matches dangerous pattern '$p'. Use a safer approach or ask the user."
        fi
      done
    fi
    
    # 2. Check for git commit / git push
    if [[ "$COMMAND" =~ git[[:space:]]+commit ]] || [[ "$COMMAND" =~ git[[:space:]]+push ]]; then
      if [ -n "$HOOK_CWD" ] && [ -d "$HOOK_CWD" ]; then
        CURRENT_BRANCH=$(git -C "$HOOK_CWD" rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
      else
        CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown")
      fi
    
      # Push to protected branches. Judge only the push segment (up to the next
      # command separator): a protected name in trailing prose or a later command
      # must not block an unrelated feature push
      # (BUG-2026-11-03-guard-push-target-matches-text).
      if [[ "$COMMAND" =~ git[[:space:]]+push ]]; then
        PUSH_SEG="${COMMAND%%[;&|]*}"
        PUSH_TARGETS_PROTECTED=f

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.

@danielvm-git
Ships withbigpowers

Agent skills synthesizing 17 years of software engineering discipline — from Clean Code to AI-native architecture — into a single, prescriptive methodology for solo developers.

29280 skills1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
292
Star history of danielvm-git/bigpowers on GitHub, a chart by star-history.com

More plugins that ship hooks.

oh-my-claudecode

oh-my-claudecode

Splits a complex task across several specialized Claude Code agents working in parallel, then keeps going until the result is checked. You describe what you want in plain language instead of memorizing commands.

84 skills+441k
@yeachan-heo@yeachan-heo
Install Plugin
ouroboros

ouroboros

Turns a rough feature idea into a written spec through guided questions, then has the agent build it and checks the result against that spec. Instead of hand-checking whether the work is finished, you get an automatic evaluation gate that runs in your coding agent.

26 skills+36.4k
@q00@q00
Install Plugin
myclaude

myclaude

A plugin that runs coding tasks through multiple AI backends (Codex, Claude, Gemini, OpenCode) with a structured development workflow, parallel execution, browser automation and multi-session task checkpointing.

11 skills+32.8k
@stellarlinkco@stellarlinkco
Install Plugin
harmonist

harmonist

Coordinates AI agents with mechanical protocol enforcement, a workflow gate, memory validation and a session hook. Includes a catalog of specialist agents and has no runtime dependencies.

199 agents+12.1k
@gammalabtechnologies@gammalabtechnologies
Install Plugin
bernstein

bernstein

Bernstein is a Claude Code plugin for orchestrating AI agents. It adds skills to list and inspect agents, review and approve tasks, create tasks, track costs and budgets, and show alerts for failed or stalled work.

26 skills+41.2k
@sipyourdrink-ltd@sipyourdrink-ltd
Install Plugin
fablize

fablize

A Claude Code plugin that enforces finishing multi-step tasks with evidence and verification at each stage. It works as a procedure for Opus or any Claude model, not as chance.

1 skill+2891
@fivetaku@fivetaku
Install Plugin
super-board

super-board

Autonomous GitHub Project build → QA → review loop for Claude Code. One-line install.

10 skills7 hooks697
@erictechpro@erictechpro
Install Plugin
hello2cc

hello2cc

Adjusts how third-party models behave inside Claude Code so they run closer to a native Opus session, covering subagent lifecycle, session hooks and tool interception. It does not replace your gateway, provider mapping or account setup.

1 agent11 hooks688
@hellowind777@hellowind777
Install Plugin

Questions about the hooks in bigpowers.

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