# Add features to your plugin

The `create-plugin` tool provides two commands that change an existing plugin:

* `update` applies every pending tooling change for your version of the tool. Refer to [Automate your plugin updates](https://grafana.com/developers/plugin-tools/how-to-guides/updating-a-plugin.md).
* `add` applies one named, optional feature that you choose.

Use `add` when you want to adopt something new, such as a different bundler configuration or code generation for a Grafana app plugin.

## Find the available additions[​](#find-the-available-additions "Direct link to Find the available additions")

Each optional feature is an addition. To list the additions in your version of the tool, run `add` without a name:

```shell
npx @grafana/create-plugin@latest add

```

To apply one, pass its name:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest add <addition>

```

```shell
yarn dlx @grafana/create-plugin@latest add <addition>

```

```shell
pnpm dlx @grafana/create-plugin@latest add <addition>

```

## Before you run the add command[​](#before-you-run-the-add-command "Direct link to Before you run the add command")

The command stops if there are uncommitted changes in the repository. This is deliberate: it means that `git diff` after the command shows you exactly what changed, so you can review the result before you commit it.

To run the command anyway, use the `--force` flag. The diff then also contains your own uncommitted work.

The command never commits anything. Accepting the change is always a separate step that you control.

## Additions that an AI agent applies[​](#additions-that-an-ai-agent-applies "Direct link to Additions that an AI agent applies")

Some changes cannot be automated reliably, because they depend on code that you wrote. Porting your own components to a new API is one example. For these, an addition ships natural-language instructions instead of, or in addition to, a script.

An addition can take one of three forms:

| Form   | What happens                                                                            |
| ------ | --------------------------------------------------------------------------------------- |
| Script | A codemod makes the change. No agent runs.                                              |
| Prompt | An agent applies a Markdown instructions file.                                          |
| Hybrid | A codemod makes the deterministic part of the change, then an agent completes the rest. |

### Use an installed agent[​](#use-an-installed-agent "Direct link to Use an installed agent")

If an addition includes instructions and you have a supported agent CLI installed, `create-plugin` asks whether to use it. Supported agents are Claude Code and OpenAI Codex.

Before it asks, `create-plugin` names each agent it found and the path of the program it runs. The agent runs on your own account, and it can edit files and run commands in your repository.

`create-plugin` finds agents on your `PATH`, so it can't see a shell function or alias that wraps one. If the path isn't the program you expect, pass the right one with the `--agent` flag.

The agent runs in your terminal, so you can watch what it does and redirect it. It reports a summary when it finishes.

To select an agent without the question, use the `--agent` flag:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest add <addition> --agent=claude-code

```

```shell
yarn dlx @grafana/create-plugin@latest add <addition> --agent=claude-code

```

```shell
pnpm dlx @grafana/create-plugin@latest add <addition> --agent=claude-code

```

The flag also accepts a path, which lets you use an agent installed outside your `PATH`:

```shell
npx @grafana/create-plugin@latest add <addition> --agent="$HOME/.claude/local/claude"

```

note

An agent does not produce the same result every time, unlike a script. Review the changes before you commit them. Because the command requires a clean repository and never commits, `git diff` always shows you the agent's work, and `git restore` discards it.

### Apply the instructions yourself[​](#apply-the-instructions-yourself "Direct link to Apply the instructions yourself")

To skip the agent, use the `--no-agent` flag:

* npm
* Yarn
* pnpm

```shell
npx @grafana/create-plugin@latest add <addition> --no-agent

```

```shell
yarn dlx @grafana/create-plugin@latest add <addition> --no-agent

```

```shell
pnpm dlx @grafana/create-plugin@latest add <addition> --no-agent

```

The command applies the automated part of the addition, if there is one, and then prints the path to the instructions file. Every instructions file works as manual instructions, so you can read it and make the changes yourself.

If an addition needs an agent and none is available, the command stops before it writes anything and tells you how to continue.

### Run add from inside an agent session[​](#run-add-from-inside-an-agent-session "Direct link to Run add from inside an agent session")

If you ask your own coding agent to add a feature to your plugin, `create-plugin` detects that it is running inside an agent session. It does not start a second agent. Instead, it applies the automated part of the addition and passes the instructions to the agent that is already running.

To prevent this and get the instructions yourself, use the `--no-agent` flag.

### Review what the agent couldn't apply[​](#review-what-the-agent-couldnt-apply "Direct link to Review what the agent couldn't apply")

Instructions ask the agent to mark anything it couldn't apply with a `TODO(<addition>):` comment, and to keep the build passing. When an agent that `create-plugin` started finishes, `create-plugin` searches your repository for these comments and lists them, so that you can follow them up.

Some additions also list checks, such as your `typecheck` and `build` scripts. When the agent finishes, `create-plugin` runs these checks itself, so the result doesn't depend only on the agent's own report. If a check fails, or your `package.json` doesn't have the script, `create-plugin` shows a warning instead of a success message.

## Reference[​](#reference "Direct link to Reference")

For the full list of flags, refer to [CLI commands](https://grafana.com/developers/plugin-tools/reference/cli-commands.md).
