Back to Blog
Feature ReleaseClaude CodeHooksAutomation

PRPM Now Supports Claude Code Hooks

Install automation scripts as packages—no JSON editing required

By PRPM TeamNovember 12, 20257 min read

You can now install Claude Code hooks as packages. One command replaces manual JSON configuration. No copy-pasting, no hunting through settings files.

$ prpm install @prpm/prettier-on-save
✓ Installed @prpm/prettier-on-save@1.0.0
  Merged hook into .claude/settings.json
  Hook will trigger on: PostToolUse (Edit, Write)

What Are Claude Hooks?

Hooks are automated scripts that run during Claude Code operations. Think git hooks, but for your AI assistant. When Claude writes a file, runs a test, or starts a session, hooks let you inject custom logic.

Common use cases:

  • Run prettier after Claude edits code
  • Log all bash commands Claude executes
  • Block writes to sensitive files like .env
  • Send desktop notifications when Claude needs input
  • Validate code before it gets written

Claude Code supports 9 hook events:

EventTrigger Point
PreToolUseBefore Claude calls a tool
PostToolUseAfter a tool completes
UserPromptSubmitWhen you submit a message
SessionStartWhen Claude Code starts
SessionEndWhen Claude Code shuts down

The Problem: Manual Setup

Before PRPM hook support, installing a Claude hook required multiple error-prone steps:

  1. Find the hook code (GitHub, docs, Twitter)
  2. Open ~/.claude/settings.json or .claude/settings.json
  3. Understand the JSON structure
  4. Copy-paste the hook config
  5. Fix syntax errors (forgot a comma? start over)
  6. Repeat for every project

Want to share a hook with your team? Send them JSON and hope they paste it correctly. Want to update a hook? Manually edit every project's settings file.

The Fix: Hooks as Packages

Install a hook like any other package:

$ prpm install @prpm/prettier-on-save
✓ Installed @prpm/prettier-on-save@1.0.0
  Merged hook into .claude/settings.json
  Hook will trigger on: PostToolUse (Edit, Write)

PRPM merges the hook into your existing settings without clobbering custom config. Multiple hooks in the same event? No problem—they run in parallel.

Where Hooks Install

Hooks install to your project's .claude/settings.json file:

$ prpm install @prpm/prettier-on-save

# Installs to: .claude/settings.json (project directory)

Each project gets its own hooks. Commit .claude/settings.json to git so your team shares the same automation.

Tracking and Uninstalling

Each package in .claude/settings.json includes tracking metadata:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|Write",
        "hooks": [{
          "type": "command",
          "command": "prettier --write ${file}"
        }],
        "__prpm_hook_id": "@prpm/prettier-on-save@1.0.0"
      }
    ]
  }
}

The __prpm_hook_id field tracks which package installed the hook. When you uninstall, PRPM removes only that hook's config—your other hooks stay intact.

$ prpm uninstall @prpm/prettier-on-save
✓ Removed hook from .claude/settings.json
  Cleaned up PostToolUse event (now empty)

Hook Collections

Want a full workflow? Install a collection:

$ prpm install @prpm/secure-coding

# Installs:
# - @prpm/block-env-writes
# - @prpm/validate-credentials
# - @prpm/audit-file-deletes
# - @prpm/sensitive-data-scanner

✓ Installed 4 hooks

Collections bundle related hooks. One command sets up your entire security policy.

Publishing Hooks

Creating a hook package:

$ mkdir my-hook && cd my-hook
$ prpm init

Format: claude
Subtype: hook
Name: my-awesome-hook

Write your hook in the package file (JSON format):

{
  "hooks": {
    "PreToolUse": [
      {
        "matcher": "Bash",
        "hooks": [{
          "type": "command",
          "command": "echo \"Running: $(echo $CLAUDE_TOOL_INPUT | jq -r .command)\""
        }]
      }
    ]
  }
}

Publish:

$ prpm publish
✓ Published @yourname/my-awesome-hook@1.0.0

Now anyone can install it: prpm install @yourname/my-awesome-hook

Real Examples

Here are hooks you can install right now:

Auto-format on edit:

prpm install @prpm/prettier-on-save

Log all bash commands:

prpm install @prpm/command-logger

Block sensitive file writes:

prpm install @prpm/protect-env-files

Desktop notifications:

prpm install @prpm/desktop-alerts

Full security suite:

prpm install @prpm/secure-coding

Try It Now

# Install PRPM
npm install -g prpm

# Install a hook
prpm install @prpm/command-logger

# See it in action
# (next time Claude runs a bash command, it logs to ~/claude-commands.log)

Browse available hooks at prpm.dev/search?format=claude&subtype=hook

What's Next

  • Hook templates - Starter templates for common patterns
  • Hook testing tools - Test hooks before deploying
  • Hook marketplace - Curated collection of verified hooks
  • Hook analytics - See which hooks save you the most time

Want to write hooks? Check out Claude Code Hooks Best Practices.