> ## Documentation Index
> Fetch the complete documentation index at: https://docs.duckie.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Snippets

> Reusable instruction fragments for runbooks

Snippets are reusable blocks of instructions that can be embedded in multiple runbooks. Create them once, then insert them wherever the same procedure should appear.

## What are Snippets?

Snippets are instruction fragments you can include in any runbook. They're perfect for procedures that appear in multiple contexts:

| Snippet | Used In |
| - | - |
| "Verify Customer Identity" | Password Reset, Account Recovery, Billing Dispute, Order Cancellation |
| "Check Subscription Status" | Billing Questions, Feature Access, Upgrade Requests |
| "Standard Closing" | All customer-facing runbooks |

When you insert a snippet into a runbook, Duckie keeps it as a snippet embed so you can recognize and manage the shared procedure.

## Why Use Snippets?

### Consistency

The same procedure is executed the same way everywhere.

### Efficiency

Write once, use in many runbooks.

### Maintenance

Keep common instructions in one place instead of rewriting them in every runbook.

### Organization

Keep runbooks focused on their specific purpose.

## Creating Snippets

**1. Navigate to Snippets**

Go to **Build → Snippets** in your dashboard.

**2. Click Create Snippet**

Click **Create Snippet** to open the editor.

**3. Name Your Snippet**

Use a clear, action-oriented name:

* Good: "Verify Customer Identity", "Process Refund"
* Avoid: "Snippet 1", "Identity"

**4. Write Instructions**

Write the reusable instructions. These can include:

* Steps
* Conditional logic
* Tool references

**5. Save**

Click **Save** to save your snippet.

## Example Snippets

### Verify Customer Identity

```
### Identity Verification

Before proceeding, verify the customer's identity:

1. Ask for their registered email address
2. Look up the account using [Account Search]
3. Ask them to confirm the last 4 digits of their payment method on file
4. If the digits match, proceed with the request
5. If verification fails after 2 attempts:
   - Thank them for their patience
   - Escalate to the security team with context
   - Provide expected follow-up timeline
```

### Check Subscription Status

```
### Subscription Check

Use [Subscription Lookup] to check the customer's subscription:

- **Active:** Proceed with the request
- **Past Due:** Mention the payment issue and offer to help resolve
- **Cancelled:** Explain their subscription has ended and offer reactivation
- **Trial:** Note trial expiration date if relevant to their question
```

### Standard Closing

```
### Closing the Conversation

After resolving the issue:

1. Summarize what was done
2. Ask: "Is there anything else I can help you with today?"
3. If no: Thank them for reaching out and wish them a great day
4. If yes: Continue helping with the new request
```

## Using Snippets in Runbooks

Insert snippets from the runbook editor:

```
After greeting the customer:

Type @, choose Snippets, and select "Verify Customer Identity".

Once verified, proceed with the password reset process.
```

The inserted snippet appears as an embedded block in the runbook editor:

## Managing Snippets

### Viewing Usage

Each snippet shows which runbooks use it:

### Editing Snippets

When you edit a snippet from the Snippets page:

1. Changes save immediately
2. New runbook inserts use the updated snippet content
3. Existing runbook embeds keep the content already saved in that runbook

> [!WARNING]
>
> Be careful when editing an embedded snippet from inside a runbook. Saving it back to the source snippet can update other runbooks that reference the same snippet.

### Deleting Snippets

Before deleting:

1. Check which runbooks use the snippet
2. Remove or replace the snippet references
3. Then delete the snippet

## Best Practices

### When to Create a Snippet

Create a snippet when:

* The same instructions appear in 2+ runbooks
* The procedure needs to be consistent everywhere
* You want to update the procedure in one place

### Snippet Scope

Keep snippets focused:

* **Good:** "Verify Customer Identity" — one clear purpose
* **Avoid:** "Handle Customer" — too broad

### Naming

Use action-oriented names that describe what the snippet does:

* "Verify Customer Identity"
* "Check Order Status"
* "Process Refund Request"
* "Standard Closing"

### Documentation

Add comments in your snippet explaining:

* When to use it
* What it accomplishes
* Any prerequisites

## Next Steps

> [card] [Create Runbooks](https://docs.duckie.ai/runbooks/creating-runbooks.md)
>
> Build runbooks using snippets

> [card] [Tools](https://docs.duckie.ai/tools/overview.md)
>
> Reference tools in snippets


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.