---
url: /api/packages/plugin-kit/src/functions/validatePlugin.md
---
[pantoken-root](../../../../index.md) / [packages/plugin-kit/src](../index.md) / validatePlugin

# Function: validatePlugin()

> **validatePlugin**(`plugin`): `void`

Beta

Assert that a plugin has a valid structure: non-empty name, all hooks are functions,
and no hook key falls outside the recognised stage set.

Called automatically by [definePlugin](definePlugin.md). Export it so hand-authored plugins can
be validated before passing them to a stage runner.

## Parameters

### plugin

[`PantokenPlugin`](../../../core/src/interfaces/PantokenPlugin.md)

## Returns

`void`

## Throws

When the plugin fails structural validation.

## Example

**Validate a hand-authored plugin**

```ts
import { validatePlugin } from "@pantoken/plugin-kit";

validatePlugin({ name: "brand", css: () => ({}) }); // ok
validatePlugin({ name: "", css: () => ({}) });      // throws
```
