> ## 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.

# Quickstart

> Build a Claude Code hook processor in minutes

**1. Install the Package**

Add ClaudeEssentials to your project:

```bash .NET CLI theme={null}
dotnet add package ClaudeEssentials
```

```powershell Package Manager theme={null}
Install-Package ClaudeEssentials
```

> [!TIP]
>
> For AOT publishing, ensure your project targets .NET 8+ and has `PublishAot` enabled.

**2. Create a Hook Processor**

Create a console app that reads JSON from stdin and writes the response to stdout:

```csharp Program.cs theme={null}
using CloudNimble.ClaudeEssentials.Hooks;
using CloudNimble.ClaudeEssentials.Hooks.Enums;
using CloudNimble.ClaudeEssentials.Hooks.Outputs;

// Read hook input from stdin
var inputJson = Console.In.ReadToEnd();

// Deserialize the input
var input = ClaudeHooksSerializer.DeserializePreToolUseInput(inputJson);

// Create your response
var output = new PreToolUseHookOutput<object>
{
    Continue = true,
    HookSpecificOutput = new PreToolUseSpecificOutput<object>
    {
        PermissionDecision = PermissionDecision.Allow,
        PermissionDecisionReason = "Auto-approved by policy"
    }
};

// Write JSON to stdout
Console.WriteLine(ClaudeHooksSerializer.SerializePreToolUseOutput(output));
```

**3. Configure Claude Code**

Add your hook to Claude Code's `settings.json`:

```json settings.json theme={null}
{
  "hooks": {
    "PreToolUse": [{
      "command": "dotnet run --project /path/to/your/project"
    }]
  }
}
```

> [!NOTE]
>
> For production, publish your app as a native executable for faster startup:
>
> ```bash theme={null}
> dotnet publish -c Release
> ```

**4. Test It Out**

Start a Claude Code session. Your hook will now intercept tool calls and apply your custom logic.

> [!TIP]
>
> You're ready to customize Claude's behavior with strongly-typed C# code!

## Common Patterns

> **Auto-approve safe tools**
>
> ```csharp theme={null}
> if (input.ToolName is "Read" or "Glob" or "Grep")
> {
>     return new PreToolUseHookOutput<object>
>     {
>         Continue = true,
>         HookSpecificOutput = new PreToolUseSpecificOutput<object>
>         {
>             PermissionDecision = PermissionDecision.Allow
>         }
>     };
> }
> ```

> **Block dangerous commands**
>
> ```csharp theme={null}
> var command = input.ToolInput?.ToString() ?? "";
> if (command.Contains("rm -rf"))
> {
>     return new PreToolUseHookOutput<object>
>     {
>         Continue = true,
>         HookSpecificOutput = new PreToolUseSpecificOutput<object>
>         {
>             PermissionDecision = PermissionDecision.Deny,
>             PermissionDecisionReason = "Dangerous command blocked"
>         }
>     };
> }
> ```

> **Add context after tool execution**
>
> ```csharp theme={null}
> return new PostToolUseHookOutput
> {
>     Continue = true,
>     HookSpecificOutput = new PostToolUseSpecificOutput
>     {
>         AdditionalContext = "Remember to run tests after making changes."
>     }
> };
> ```

## Next Steps

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

> **[Hook Inputs](https://ai.easyaf.dev/claudeessentials/api-reference/CloudNimble/ClaudeEssentials/Hooks/Inputs.md)**
>
> Learn about input models for each hook type


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