cc-hooks-ts
AGENTS.md39 starsChanged 5 months agoMITView on GitHub
A TypeScript library for defining Claude Code hooks with type safety. Provides runtime validation and strongly-typed definitions for hook configurations. YOU MUST RUN vp check && vp test --run && vp pack to run all quality checks before completing any tasks. See the same section in README.md to follow upstream changes from @anthropic-ai/claude-agent-sdk.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
The file
We split this AGENTS.md into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 50
Import vitest API explicitly
- Very specific: line 51
Prefer describe(target) { it(behavior) } structures over test()
- Distinctive: line 55
Convergence Point Validation: Test complex conditional type chains at final output with concrete literal types
- Distinctive: line 57
Contract-Focused: Test usage patterns (contract boundaries) rather than implementation details
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
A TypeScript library for defining Claude Code hooks with type safety. Provides runtime validation and strongly-typed definitions for hook configurations.
Development Commands
YOU MUST RUN vp check && vp test --run && vp pack to run all quality checks before completing any tasks.
vp check- Run all checks (lint, format, typecheck)vp check --fix- Auto-fix lint and format issuesvp test --run- Run testsvp pack- Build
How to follow the upstream changes
See the same section in README.md to follow upstream changes from @anthropic-ai/claude-agent-sdk.
Repository Structure
Source Code (src/)
- Root files - Core library APIs (hook definition, execution, context)
hooks/- Hook event definitions, input validation schemas, output typesutils/- Shared utility functions for strings, types, and validation
Other Directories
docs/- Documentation and guidesdist/- Build output (generated)
When to Touch What
| Goal | Where to Work |
| Add new hook event / Backport upstream hook type change | src/hooks/ |
| Modify input validation | src/hooks/input/ |
| Change output types | src/hooks/output/ |
| Update tool schema definitions | src/index.ts |
| Add utility functions | src/utils/ |
| Update documentation | docs/ |
Coding Goodies
Vitest
- Import vitest API explicitly
- Prefer
describe(target) { it(behavior) }structures overtest()
Type System Design Philosophy
- Convergence Point Validation: Test complex conditional type chains at final output with concrete literal types
- Boundary Design: Validate TypeScript inference at abstract→concrete type transformation points
- Contract-Focused: Test usage patterns (contract boundaries) rather than implementation details
- Inference Proof: Prove complex type operation combinations with concrete type results
- Resilience Design: Choose validation points that resist internal implementation changes
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

