cc-hooks-ts
Copilot instructions39 starsChanged 5 months agoMITView on GitHub
cc-hooks-ts is a TypeScript library that defines Claude Code hook types with runtime validation via valibot. It tracks upstream @anthropic-ai/claude-agent-sdk and Claude Code versioning. The published surface is the source of truth for downstream type-safe hook authors. When reviewing PRs, prioritize the checks below. Cite file paths and approximate line locations. Apply each check whenever its trigger fires. If no trigger fires, post no comment. Trigger: the diff adds a call, named import, or member access for a symbol from…
The file
We split this copilot-instructions.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
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 5
When reviewing PRs, prioritize the checks below.
- Very specific: line 36
When SupportedHookEvent in src/hooks/event.ts gains or loses an event, every conditional type chain keyed on the event name (notably …
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions 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
Copilot Code Review Instructions
cc-hooks-ts is a TypeScript library that defines Claude Code hook types with runtime validation via valibot. It tracks upstream @anthropic-ai/claude-agent-sdk and Claude Code versioning. The published surface is the source of truth for downstream type-safe hook authors.
When reviewing PRs, prioritize the checks below. Cite file paths and approximate line locations. Apply each check whenever its trigger fires. If no trigger fires, post no comment.
1. Runtime dependency range vs API usage drift
Trigger: the diff adds a call, named import, or member access for a symbol from a package listed under dependencies in package.json (NOT devDependencies, NOT JS / TS built-ins, NOT Node.js core), AND package.json is NOT modified in the same diff.
Action: ask the author to verify the declared range covers the version that introduced the symbol. The lockfile (pnpm-lock.yaml) may resolve a newer version locally so tests pass, but consumers can resolve any in-range older version and hit TypeError: <symbol> is not a function at import time.
2. Hook contract parity with upstream and test coverage
Trigger: the diff makes a semantic change (added, removed, renamed, or restructured field, type, schema entry, or event key) in any of:
- an input schema in
src/hooks/input/schemas.ts - the hook event listing in
src/hooks/event.ts - an output type under
src/hooks/output/ - the
ToolSchemainterface or input/output re-exports insrc/index.ts
Comment-only, JSDoc-only, or formatting-only edits to these files do not trigger this check.
Action: confirm BOTH —
(a) Test coverage: a *.test-d.ts or *.test.ts exercises the changed surface, either added in this diff or already covering the field/type. If neither, flag.
(b) Upstream justification: the PR description, commit message, or linked PR/issue references an @anthropic-ai/claude-agent-sdk version, Claude Code version, or specific upstream change. If absent, request it.
3. Schema and TypeScript type stay symmetric
The valibot schema in src/hooks/input/schemas.ts and the TS types in src/hooks/input/types.ts must describe the same fields. Types are usually derived via v.InferOutput over HookInputSchemas. Flag hand-written types that diverge from the schema, conditional type chains in types.ts missing an event key the schema defines, or new schema entries with no type-level surface.
4. Hook event coverage is exhaustive
When SupportedHookEvent in src/hooks/event.ts gains or loses an event, every conditional type chain keyed on the event name (notably src/hooks/input/types.ts and src/hooks/output/) and every HookInputSchemas entry must match. Flag any one-sided addition or deletion.
5. Tests assert behavior, not implementation
Tests describe and assert WHAT the code does (observable contract), not HOW (private fields, internal call sequences, intermediate type shapes). Flag tests named after internal symbols, tests that duplicate implementation logic, or *.test-d.ts cases that pin implementation-detail intermediate types instead of validating the final convergence point with concrete literal types.
6. Public API stability
dist/ ships only what src/index.ts exports plus its type re-exports. Renaming, removing, or changing the shape of an exported symbol — or removing an export entirely — is breaking. Flag such diffs unless the PR description explicitly calls out the break.
Out of scope
- Style / naming bikeshedding — trust ESLint, oxfmt, publint.
- Diffs touching only docs, CI configs, dependabot config, or test scaffolding outside the above categories.
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.

