> For the complete documentation index, see [llms.txt](https://learn.onpop.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.onpop.io/chains/guides/create-a-new-pallet.md).

# Create a new pallet

Use the interactive prompt to scaffold a pallet:

```bash
pop new pallet
```

If you run `pop new` without a subcommand, Pop CLI prompts you to choose between chain, pallet, and contract. You can also use the top-level alias `pop n`.

## Command overview

```bash
pop new pallet
pop new pallet <PATH>
pop new pallet advanced
```

## Options

| Argument/Flag         | Type   | Default        | Description                                                          |
| --------------------- | ------ | -------------- | -------------------------------------------------------------------- |
| `<PATH>`              | string | interactive    | Path or name for the pallet. If omitted, Pop CLI prompts for a path. |
| `--authors`, `-a`     | string | `Anonymous`    | Author name(s) for the pallet metadata.                              |
| `--description`, `-d` | string | `Frame Pallet` | Pallet description.                                                  |

### JSON mode

Use global `--json` for non-interactive generation:

```bash
pop --json new pallet my-pallet
```

JSON mode requirements:

* Pallet name/path is required.
* `advanced` mode must include one or more advanced flags (interactive advanced prompts are disabled).
* Existing destination paths are not overwritten in JSON mode.

## Advanced mode

Use `advanced` to unlock more customization:

```bash
pop new pallet <PATH> advanced
```

If you do not pass any advanced flags, Pop CLI runs an interactive prompt. If you pass any advanced flags, Pop CLI skips prompts and uses your inputs.

| Flag                          | Type    | Default | Description                                                                            |
| ----------------------------- | ------- | ------- | -------------------------------------------------------------------------------------- |
| `--config-common-types`, `-c` | list    | none    | Add common config types to the config trait. Pass multiple values separated by spaces. |
| `--default-config`, `-d`      | boolean | `false` | Add default config implementation (requires at least one config common type).          |
| `--storage`, `-s`             | list    | none    | Add storage items to the pallet. Pass multiple values separated by spaces.             |
| `--genesis-config`, `-g`      | boolean | `false` | Add a genesis config.                                                                  |
| `--custom-origin`, `-o`       | boolean | `false` | Add a custom origin.                                                                   |

Run `pop new pallet advanced --help` to see the available values for `--config-common-types` and `--storage`.

## Behavior notes

* If the pallet path is inside a Rust workspace, Pop CLI adds the pallet to the workspace manifest.
* Pop CLI runs `cargo fmt --all` after generation. If formatting fails, the pallet is still generated.

## Examples

```bash
# Interactive pallet creation
pop new pallet

# Create a pallet in the current directory
pop new pallet my-pallet

# Create a pallet in a nested directory
pop new pallet pallets/my-pallet

# Advanced interactive mode
pop new pallet my-pallet advanced

# Advanced non-interactive mode
pop new pallet my-pallet advanced --config-common-types runtime-origin currency --storage storage-value storage-map --default-config --genesis-config --custom-origin
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://learn.onpop.io/chains/guides/create-a-new-pallet.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.
