Claude Code Hooks SDK — Git skill for Claude Code
by beyondcode - A Laravel-inspired PHP SDK for building Claude Code hook responses with a clean, fluent API.
How to install Claude Code Hooks SDK
This entry records only its repository, not the path inside it, so there is no
exact command to give. Open beyondcode/claude-hooks-sdk and copy the folder into
~/.claude/skills/, or the file into ~/.claude/agents/.
What Claude Code Hooks SDK does
[](https://packagist.org/packages/beyondcode/claude-hooks-sdk) [](https://github.com/beyondcode/claude-hooks-sdk/actions/workflows/run-tests.yml) [](https://packagist.org/packages/beyondcode/claude-hooks-sdk)
Alternatives in Git
- Copilot API — Turns GitHub Copilot into an OpenAI/Anthropic API compatible server, usable with Claude Code 3.1k ★
- Tâches Claude Code Resources — by TÂCHES - A well-balanced, "down-to-Earth" set of sub agents, skills, and commands, that are well-organized 1.6k ★
- Push And Release — Git pull, resolve conflicts, push, fix hook errors, then release 1.6k ★
README
Claude Hooks SDK
[](https://packagist.org/packages/beyondcode/claude-hooks-sdk) [](https://github.com/beyondcode/claude-hooks-sdk/actions/workflows/run-tests.yml) [](https://packagist.org/packages/beyondcode/claude-hooks-sdk)
A Laravel-inspired PHP SDK for building Claude Code hook responses with a clean, fluent API. This SDK makes it easy to create structured JSON responses for Claude Code hooks using an expressive, chainable interface.
Claude Code hooks are user-defined shell commands that execute at specific points in Claude Code's lifecycle, providing deterministic control over its behavior. For more details, see the [Claude Code Hooks documentation](https://docs.anthropic.com/en/docs/claude-code/hooks).
Installation
You can install the package via composer:
composer require beyondcode/claude-hooks-sdk
Usage
Creating a Claude Hook
Here's how to create a PHP script that Claude Code can use as a hook:
Step 1: Create your PHP hook script
Create a new PHP file (e.g., `validate-code.php`) using the SDK:
toolName() === 'Bash') {
$command = $hook->toolInput('command', '');
// Check for potentially dangerous commands
if (str_contains($command, 'rm -rf')) {
// Block the tool call with feedback
$hook->response()->block('Dangerous command detected. Use caution with rm -rf commands.');
}
}
// Allow other tool calls to proceed
$hook->success();
Step 2: Register your hook in Claude Code
- Run the
/hookscommand in Claude Code - Select the
PreToolUsehook event (runs before tool execution) - Add a matcher (e.g.,
Bashto match shell commands)
...
Related Skills
Copilot Proxy API
Self-hosted GitHub Copilot bridge for Claude Code and Codex CLI with OpenAI Responses, Anthropic Messages, str
Claude Agent Sdk.Github.Io
Claude Agent SDK questions answered honestly: where claude.com sends developers, why subscription and API bill
TypeScript Quality Hooks
by bartolli - Quality check hook for Node.js TypeScript projects with TypeScript compilation. ESLint auto-fixi
Claude Command Center
-- Production-tested workspace template with session hooks, structured memory (4 types), multi-domain routing,
Polyglot Idiom
Run a per-language idiom review against a diff, PR, or branch for Java, C++, C#, Ruby, or PHP code — checkpoin
Learn Faster Kit
by Hugo Lau - A creative educational framework for Claude Code, inspired by the "FASTER" approach to self-teac
Related Agents
Laravel Reviewer
Laravel 13 and PHP 8.3+ (8.5 recommended) code review specialist — Actions pattern, Pest PHP, Eloquent, Sanctu
Java API Compat Reviewer
easy-extension SDK 公共 API 兼容性审查专家。在改动可能涉及 public 类/方法/接口/异常时使用,仅审查 git diff 中的公共 API 变更。
Laravel Backend Developer
Senior PHP/Laravel backend developer. Use for controllers, models, services, middleware, Eloquent ORM, databas