> ## Documentation Index
> Fetch the complete documentation index at: https://ai.easyaf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why ClaudeEssentials?

> The motivation behind ClaudeEssentials and what makes it different

## The Problem

Claude Code hooks communicate via JSON over stdin/stdout. Building hook processors means:

* Manually crafting JSON schemas that match Claude's expectations
* Handling snake\_case property names and nullable fields
* Ensuring your code works with AOT compilation for fast startup
* Testing serialization round-trips to catch subtle bugs

ClaudeEssentials solves all of this with a single NuGet package.

## Design Principles

> **AOT-First**
>
> Source-generated serialization means zero reflection at runtime. Your hooks start instantly.

> **Type-Safe**
>
> Strongly-typed models catch errors at compile time, not when Claude calls your hook.

> **Zero Dependencies**
>
> Only requires System.Text.Json. No bloat, no conflicts, no surprises.

> **Predictable**
>
> Every input deserializes correctly. Every output serializes to valid JSON. Guaranteed by tests.

## What's Included

### Input Models

Strongly-typed classes for every hook event Claude Code can trigger:

* `PreToolUseHookInput<T>` — Tool name, input parameters, permission mode
* `PostToolUseHookInput<T, R>` — Tool input plus the response
* `StopHookInput` — Session context when Claude wants to stop
* `SessionStartHookInput` — Project path, source (startup vs resume)
* And more: `Notification`, `UserPromptSubmit`, `PreCompact`, `SessionEnd`

### Output Models

Response types with all the fields Claude Code expects:

* `PreToolUseHookOutput<T>` — Allow, deny, or ask for permission
* `PostToolUseHookOutput` — Add context for Claude to consider
* `StopHookOutput` — Block stopping or add a warning
* `SessionStartHookOutput` — Inject project context

### Serialization Helpers

`ClaudeHooksSerializer` provides typed methods that use the pre-compiled `ClaudeHooksJsonContext`:

```csharp theme={null}
// Deserialize input
var input = ClaudeHooksSerializer.DeserializePreToolUseInput(json);

// Serialize output
var json = ClaudeHooksSerializer.SerializePreToolUseOutput(output);
```

## Use Cases

> **Enforce Team Policies**
>
> Auto-approve read-only tools while requiring confirmation for file modifications. Block dangerous commands entirely.

> **Quality Gates**
>
> Use Stop hooks to ensure tests pass before Claude completes a task. Warn about uncommitted changes.

> **Context Injection**
>
> Detect project type on SessionStart and inject relevant context—framework version, test commands, team guidelines.

> **Audit & Logging**
>
> Log every tool call for compliance. Track what Claude does across sessions.

## Get Started

> **[Quickstart](https://ai.easyaf.dev/claudeessentials/quickstart.md)**
>
> Build your first hook processor

> **[API Reference](https://ai.easyaf.dev/claudeessentials/api-reference)**
>
> Explore all available types


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.