ts-native-hook-reuse

Reuse TsHookSchema and execTsHook to add new TS/JS hook types.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/liuyu520/cc_source --skill ts-native-hook-reuse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ts-native-hook-reuse
Source: https://github.com/liuyu520/cc_source/tree/main/.claude/skills/ts-native-hook-reuse
Command: npx skills add https://github.com/liuyu520/cc_source --skill ts-native-hook-reuse

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill helps developers create and extend TS/JS native hooks by reusing the existing TsHookSchema, execTsHook executor, and hook dispatch integration, enabling consistent behavior across new hook types and easier debugging of path resolution.

Core Features & Use Cases

  • Reuse the TsHookSchema to define new hook types with a discriminated union, ensuring strong type safety.
  • Reuse the in-process TS hook executor (execTsHook) with the same 10-step pattern and lazy dispatch loading to minimize overhead.
  • Extend the hook dispatch flow by adding new branches, inject timing data into attachments, and keep UI display text in sync with new hook types.
  • Debug and validate path resolution, security checks, and timeout handling when integrating new TS hooks, reducing integration risk.

Quick Start

Create a new TS hook module that exports a default async function and register it in settings.json under PreToolUse.

Frequently Asked Questions about ts-native-hook-reuse

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extend TypeScript native hooks with new serializable types?

Reusing existing TS native hook schemas involves leveraging the TsHookSchema discriminated union and the execTsHook executor's 10-step pattern, enabling consistent behavior across new hook types and easier debugging of path resolution.

Why does my TypeScript hook execution fail during path resolution?

TypeScript hook execution can fail during path resolution due to misconfigured lazy dispatch loading or security checks; reusing the established integration pattern helps debug and validate these paths to reduce integration risk.

What's the best way to add a new TypeScript hook without increasing overhead?

To add a new TypeScript hook, create a new module exporting a default async function, register it in settings.json under PreToolUse, and update the display text and docs to keep the UI in sync with the new hook type.

Do I need to update the hook dispatch flow when adding new TypeScript hook types?

You can ensure strong type safety for custom TypeScript hooks by reusing the TsHookSchema to define new hook types with a discriminated union, which guarantees consistent behavior across the hook pipeline.

Can I reuse existing TypeScript hook executors for new hook types?

Reusing existing TS native hook executors is suitable for projects needing consistent behavior across new hook types, provided you follow the schema definition, lazy-imported executor implementation, and dispatch integration pattern.

What are the limitations of lazy-imported executors in TypeScript hook dispatch?

Lazy-imported executors provide an alternative approach to TypeScript hook dispatch by minimizing loading overhead through lazy dispatch loading, differing from direct execution by deferring module loading until the hook is actually dispatched.