Claude Code hook

CC Hooks Ts

Define Claude Code hooks with full type safety.

39 stars 1 forksHooks Source

Install

From source
git clone https://github.com/sushichan044/cc-hooks-ts.git

From the README

cc-hooks-ts

Define Claude Code hooks with full type safety using TypeScript.

See examples for more usage examples.

- cc-hooks-ts
  - Installation
  - Basic Usage
    - Define a Hook
    - Configure Claude Code
  - Tool Specific Hooks
    - Custom Tool Types Support
  - Advanced Usage
    - Conditional Hook Execution
    - Advanced JSON Output
    - Async JSON Output (Experimental)
  - Documentation
  - Development
    - How to follow the upstream changes
      - If a Dependabot PR already exists
      - If no Dependabot PR exists
  - License
  - Contributing

Starting with versions 2.0.42, we will raise our version number to match Claude Code whenever Hook-related changes occur.
This ensures we can adopt newer type definitions while maintaining compatibility.

Installation

Basic Usage

Define a Hook

Configure Claude Code

Then, load defined hooks in your Claude Code settings at ~/.claude/settings.json.

Tool Specific Hooks

In PreToolUse, PostToolUse, PostToolUseFailure, PermissionRequest, and PermissionDenied events, you can define hooks specific to tools by specifying tool names in the trigger configuration.

For example, you can create a hook that only runs before the Read tool is used:

Then configure it in Claude Code settings:

The same trigger shape also works for permission hooks:

Custom Tool Types Support

You can add support for custom tools by extending the tool type definitions.

This is useful when you want to your MCP-defined tools to have type-safe hook inputs.

Advanced Usage

Conditional Hook Execution

You can conditionally execute hooks based on runtime logic using the shouldRun function.
If shouldRun returns false, the hook will be skipped.

Advanced JSON Output

Use context.json() to return structured JSON output with advanced control over…
Read the full README on GitHub

How hooks work

  • Hooks are shell commands Claude Code runs at fixed points: before or after a tool call, when you submit a prompt, when Claude stops, on notifications and at session start.
  • They are set in the hooks section of ~/.claude/settings.json (or .claude/settings.json for a project), or come bundled in a plugin.
  • A hook can block a tool call, add context, or run a formatter or test. Read the scripts before you install them: they run on your machine with your permissions.
Claude Code docs

Details

Type
Hooks
Language
TypeScript
License
MIT
Last updated
3 November 2026
Topics
claude-codetypescript

FAQ

What is CC Hooks Ts?

Define Claude Code hooks with full type safety. It is a hook for Claude Code, from sushichan044/cc-hooks-ts on GitHub.

How do I install CC Hooks Ts?

Clone sushichan044/cc-hooks-ts from GitHub and follow the setup steps in its README.

Is CC Hooks Ts popular?

sushichan044/cc-hooks-ts has 39 GitHub stars and 1 forks, and is included in 1 curated Claude Code list. It was last updated on 3 November 2026.

More hooks

Browse the most popular Claude Code mods, all hooks, or the skills and MCP server directories.