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

# Custom Extensions

> Build your own extension behavior with custom hooks

```typescript theme={null}
import { createCustomHook } from '@armory-sh/extensions';

const customHook = createCustomHook({
  key: 'my-extension',
  handler: async (context) => {
    if (!context.payload) {
      return;
    }

    context.payload.extensions = {
      ...(context.payload.extensions ?? {}),
      'my-extension': { enabled: true }
    };
  },
  priority: 75
});
```

## Best Practices

* Add extension data only if the server requested it
* Keep extension payloads small and deterministic
* Version extension data when schema changes
