---
schema_version: "1"
id: 59a0f38d2ed748663fb1a491ea8e2b2c2d6046a22756f47ef3ca0435cd454c11
title: dev generate command
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforcedx/sfclireference/guides/dev/cli_reference_dev_generate_command.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-cli-reference/guide/cli_reference_dev_generate_command.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: f68547644b08f39abe6efe429d68bcd3bab3754eff577f86990d6adbfef9cec5
products:
  - Salesforce CLI Command Reference
  - salesforcedx
---
<!-- prettier-ignore-start -->

# dev generate command

Generate a new sf command.

## Description for dev generate command

You must run this command from within a plugin directory, such as the directory created with the "sf dev generate plugin" command.

The command generates basic source files, messages (\*.md), and test files for your new command. The Typescript files contain import statements for the minimum required Salesforce libraries, and scaffold some basic code. The new type names come from the value you passed to the --name flag.

The command updates the package.json file, so if it detects conflicts with the existing file, you're prompted whether you want to overwrite the file. There are a number of package.json updates required for a new command, so we recommend you answer "y" so the command takes care of them all. If you answer "n", you must update the package.json file manually.

## Flags

| Flag Name (Long) | Flag Name (Short) | Description |
|------------------|-------------------|-------------|
| <code>&#8209;&#8209;dry&#8209;run</code> | N/A | **Type:** Boolean<br><br>Display the changes that would be made without writing them to disk. |
| <code>&#8209;&#8209;flags&#8209;dir</code> | N/A | **Type:** Value<br><br>Import flag values from a directory. |
| <code>&#8209;&#8209;force</code> | N/A | **Type:** Boolean<br><br>Overwrite existing files. |
| <code>&#8209;&#8209;name</code> | <code>&#8209;n</code> | **Type:** Value<br>**Required**<br><br>Name of the new command. Use colons to separate the topic and command names. |
| <code>&#8209;&#8209;nuts</code> | N/A | **Type:** Boolean<br>**Default value:** `true`<br><br>Generate a NUT test file for the command. |
| <code>&#8209;&#8209;unit</code> | N/A | **Type:** Boolean<br>**Default value:** `true`<br><br>Generate a unit test file for the command. |

## Examples for dev generate command

Generate the files for a new "sf my exciting command":

```shell
sf dev generate command --name my:exciting:command
```
<!-- prettier-ignore-end -->
