> AI agents: this is one page from Mammoth Analytics documentation. The index of all pages as Markdown is https://mammoth.io/docs/llms.txt. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get Markdown.

# mammoth snippet

> All 8 mammoth snippet commands with examples, arguments and confirmation flags: Manage reusable snippets.

> Generated from mammoth-cli 2.4.2, released 2026-11-02: `mammoth schema list`, `mammoth capability list` and the CLI's own `--help`. Do not edit by hand; run `npm run docs:capabilities`.

Manage reusable snippets. 8 commands.

Every command also takes the [global flags](https://mammoth.io/docs/build/cli/global-flags/) (`--output`, `--yes`, `--confirm`, `--dry-run`, `--input`, `--profile`, ...), which are not repeated below. `--input` takes a JSON or YAML document of the input fields; `mammoth schema get COMMAND_ID` prints a command's full input schema.

**Confirmation.** Commands marked `--yes --confirm TARGET` or `--yes` always need those flags, even at a terminal: they never prompt. Commands marked "`--yes` or prompt" ask at an interactive terminal (table output, no `--no-input`) and otherwise need `--yes`. `--dry-run` skips confirmation and sends nothing.

## Summary

| Command | What it does | Effect | Confirmation |
|---|---|---|---|
| [`snippet create`](#mammoth-snippet-create) | Create a snippet. Name comes from a positional or the 'name' field. | Benign mutation | — |
| [`snippet delete`](#mammoth-snippet-delete) | Delete one snippet by id. Prompt or '--yes' required. | Destructive | `--yes` or prompt |
| [`snippet dependencies`](#mammoth-snippet-dependencies) | Report dependencies for one snippet by id. | Read | — |
| [`snippet duplicate`](#mammoth-snippet-duplicate) | Duplicate one snippet by id. | Benign mutation | — |
| [`snippet get`](#mammoth-snippet-get) | Get one snippet by id. | Read | — |
| [`snippet list`](#mammoth-snippet-list) | List snippets in the active project. | Read | — |
| [`snippet rerun`](#mammoth-snippet-rerun) | Rerun one snippet by id. | Benign mutation | — |
| [`snippet update`](#mammoth-snippet-update) | Update a snippet's fields. Snippet id is positional; fields come from '--input'. | Benign mutation | — |

## snippet commands

### mammoth snippet create

Create a snippet. Name comes from a positional or the 'name' field.

```bash
mammoth snippet create 'Revenue report' --input '{"code": "SELECT * FROM orders", "language": "sql"}'
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `NAME` | positional | no | — | `str` | Name of the new snippet; or pass it via the 'name' input field. Or the `name` input field. |
| `name` | `--input` field | no | — | `str` |  |
| `code` | `--input` field | yes | — | `str` |  |
| `language` | `--input` field | yes | — | `str` |  |
| `description` | `--input` field | no | — | `str` |  |
| `group_id` | `--input` field | no | — | `int` |  |
| `scope` | `--input` field | no | `project` | `str` |  |

- **Effect:** Benign mutation, scope `project` · **Confirmation:** none
- **Id:** `snippet.create` · **Result:** `SnippetCreateResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.create`, API `POST /workspaces/{workspace_id}/snippets` (CreateSnippet)

### mammoth snippet delete

Delete one snippet by id. Prompt or '--yes' required.

```bash
mammoth snippet delete 123 --yes
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `SNIPPET_ID` | positional | yes | — | `int` | ID of the snippet. |

- **Effect:** Destructive, scope `project` · **Confirmation:** `--yes`, or answer the prompt at an interactive terminal
- **Preconditions:** Required inputs: SNIPPET_ID.
- **Id:** `snippet.delete` · **Result:** `SnippetDeleteResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.delete`, API `DELETE /workspaces/{workspace_id}/snippets/{snippet_id}` (DeleteSnippet)

### mammoth snippet dependencies

Report dependencies for one snippet by id.

```bash
mammoth snippet dependencies 123
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `SNIPPET_ID` | positional | yes | — | `int` | ID of the snippet. |

- **Effect:** Read, scope `project` · **Confirmation:** none
- **Preconditions:** Required inputs: SNIPPET_ID.
- **Id:** `snippet.dependencies` · **Result:** `SnippetDependenciesResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.dependencies`, API `GET /workspaces/{workspace_id}/snippets/{snippet_id}/dependencies` (GetSnippetDependencies)

### mammoth snippet duplicate

Duplicate one snippet by id.

```bash
mammoth snippet duplicate 123
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `SNIPPET_ID` | positional | yes | — | `int` | ID of the snippet. |

- **Effect:** Benign mutation, scope `project` · **Confirmation:** none
- **Preconditions:** Required inputs: SNIPPET_ID.
- **Id:** `snippet.duplicate` · **Result:** `SnippetDuplicateResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.duplicate`, API `POST /workspaces/{workspace_id}/snippets/{snippet_id}/duplicate` (DuplicateSnippet)

### mammoth snippet get

Get one snippet by id.

```bash
mammoth snippet get 123
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `SNIPPET_ID` | positional | yes | — | `int` | ID of the snippet. |

- **Effect:** Read, scope `project` · **Confirmation:** none
- **Preconditions:** Required inputs: SNIPPET_ID.
- **Id:** `snippet.get` · **Result:** `SnippetGetResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.get`, API `GET /workspaces/{workspace_id}/snippets/{snippet_id}` (GetSnippetDetail)

### mammoth snippet list

List snippets in the active project.

```bash
mammoth snippet list
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `limit` | `--input` field | no | — | `int` |  |
| `offset` | `--input` field | no | — | `int` |  |
| `search` | `--input` field | no | — | `str` |  |
| `group_id` | `--input` field | no | — | `int` |  |
| `sort` | `--input` field | no | — | `str` |  |

- **Effect:** Read, scope `project` · **Confirmation:** none · **Pages:** `single_page`
- **Id:** `snippet.list` · **Result:** `SnippetListResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.list`, API `GET /workspaces/{workspace_id}/snippets` (ListSnippets)

### mammoth snippet rerun

Rerun one snippet by id.

```bash
mammoth snippet rerun 123
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `SNIPPET_ID` | positional | yes | — | `int` | ID of the snippet. |

- **Effect:** Benign mutation, scope `project` · **Confirmation:** none
- **Preconditions:** Required inputs: SNIPPET_ID.
- **Id:** `snippet.rerun` · **Result:** `SnippetRerunResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.rerun`, API `POST /workspaces/{workspace_id}/snippets/{snippet_id}/rerun` (RerunSnippet)

### mammoth snippet update

Update a snippet's fields. Snippet id is positional; fields come from '--input'.

```bash
mammoth snippet update 123
```

| Name | Passed as | Required | Default | Type | Notes |
|---|---|---|---|---|---|
| `SNIPPET_ID` | positional | yes | — | `int` | ID of the snippet. |
| `name` | `--input` field | no | — | `str` |  |
| `code` | `--input` field | no | — | `str` |  |
| `language` | `--input` field | no | — | `str` |  |
| `description` | `--input` field | no | — | `str` |  |
| `group_id` | `--input` field | no | — | `int` |  |

- **Effect:** Benign mutation, scope `project` · **Confirmation:** none
- **Preconditions:** Required inputs: SNIPPET_ID.
- **Id:** `snippet.update` · **Result:** `SnippetUpdateResult` · **Backed by:** SDK `mammoth.api.snippets.SnippetsAPI.update`, API `PATCH /workspaces/{workspace_id}/snippets/{snippet_id}` (UpdateSnippet)

---
Source: https://mammoth.io/docs/build/cli/snippet.md · Updated: 2026-11-02
