# How to Create Custom Plugin

### (WIP)

Plugins are a way to extend the functionality of the framework. You can create your own plugins and use them in your projects.

### Plugin Structure

A plugin is a folder with the following structure:

```
plugin-name
├── index.js
├── package.json
```

### How easy is it to create a Plugin with Hayde

You can also create your plugin with Hayde. First, you need to create `.hayde.json` file in your project root. Then, add `createPlugin` **only** to the plugins array.

```json
{
  "plugins": [
    "createPlugin"
  ]
}
```

After that, you can run the following command to create your plugin.

```bash
npx hayde
```

#### index.js

This file is the entry point of the plugin. It should export;

* `pluginName`: Name of the plugin
* `initPlugin`: Init function of the plugin
* `runPlugin`: Run function of the plugin after everything is ready to go for parsing the component


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.haydejs.com/docs/how-to-create-custom-plugin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
