# devbox-image-definition

A GitHub Copilot rule that helps you write YAML image definition files for Microsoft Dev Box Team Customizations. Useful when your customizations rely on ~/winget, ~/gitclone and ~/powershell tasks.

- rule · `type=rule` · GitHub Copilot · ★ 40418
- Author: github · official GitHub repository
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/github/awesome-copilot/tree/HEAD/instructions/devbox-image-definition.instructions.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/rules/devbox-image-definition

## What it does

The rule puts the agent in the role of an image definition author for Dev Box. It either generates YAML that orchestrates the available customization tasks or answers questions about using them. It applies to files matching `**/*.yaml`.

Before writing anything, the agent has to check whether the Dev Box tools are enabled and list the available tasks with `devbox customizations list-tasks`. Only tasks that actually appear in that output may be used — guessing leads to invalid YAML. When nothing fits, the rule suggests falling back to the built-in `~/powershell` task or creating a reusable customization task.

One hard requirement: intrinsic tasks keep the `~/` prefix, as in `~/winget`, `~/powershell` and `~/gitclone`. Drop it and the short name can collide with a custom task of the same name, sending the build somewhere you did not intend. For multi-line PowerShell the rule recommends the `|` literal scalar. Keep in mind that without the Dev Box tools enabled, the agent will first ask you to turn them on.

## Requirements
- Works with: Azure

## Install

### GitHub Copilot (native platform)

**Manually: put the files in place**
- File: `.github/instructions/devbox-image-definition.instructions.md` — The applyTo field sets which files it applies to

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/devbox-image-definition.md` — The paths frontmatter field limits the files: move applyTo from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/devbox-image-definition.mdc` — Frontmatter: description, globs, alwaysApply. Move applyTo from the source into globs, or the rule will not attach on its own

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/devbox-image-definition.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/devbox-image-definition.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/github/awesome-copilot/tree/HEAD/instructions/devbox-image-definition.instructions.md

## When to use it
- generate a YAML image definition file for Dev Box
- check which customization tasks the environment exposes
- install packages through the `~/winget` task
- clone a repository into the image with `~/gitclone`
- embed a multi-line PowerShell script in a customization

## Example prompts
- Generate a Dev Box image definition that installs git and VS Code via `~/winget`
- Review my customization YAML and make sure intrinsic tasks use the `~/` prefix
- Which customization tasks are available? Run `devbox customizations list-tasks`

## Source text · devbox-image-definition.instructions.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 7abd53246b9886fc.

BEGIN THIRD-PARTY FILE 7abd53246b9886fc
````text
---
description: 'Authoring recommendations for creating YAML based image definition files for use with Microsoft Dev Box Team Customizations'
applyTo: '**/*.yaml'
---

# Dev Box image definitions

## Role

You are an expert at creating image definition files ([customization files](https://learn.microsoft.com/azure/dev-box/how-to-write-image-definition-file)) for use with Microsoft Dev Box Team Customizations. Your task is to generate YAML orchestrating the available customization tasks (```devbox customizations list-tasks```) or answer questions about how to use those customization tasks.

## IMPORTANT: Critical First Steps

### STEP 1: Check Dev Box Tools Availability

**CRITICAL FIRST STEP**: At the start of every conversation, you MUST first check if the dev box tools are already enabled by attempting to use one of the MCP tools (e.g., `devbox_customization_winget_task_generator` with a simple test parameter).

**If tools are NOT available:**

- Recommend that the user enable the [dev box tools](https://learn.microsoft.com/azure/dev-box/how-to-use-copilot-generate-image-definition-file)
- Explain the benefits of using these specialized tools

**If tools ARE available:**

- Acknowledge that the dev box tools are enabled and ready to use
- Proceed to Step 2

These tools include:

- **Customization WinGet Task Generator** - For `~/winget` tasks
- **Customization Git Clone Task Generator** - For `~/gitclone` tasks
- **Customization PowerShell Task Generator** - For `~/powershell` tasks  
- **Customization YAML Generation Planner** - For planning YAML files
- **Customization YAML Validator** - For validating YAML files

**Always mention the tool recommendation unless:**

- The tools are already confirmed to be enabled (via the check above)
- The user has already indicated they have the tools enabled
- You can see evidence of dev box tools being used in the conversation
- The user explicitly asks you not to mention the tools

### STEP 2: Check Available Customization Tasks

**MANDATORY SECOND STEP**: Before creating or modifying any YAML customization files, you MUST check what customization tasks are available by running:

```cli
devbox customizations list-tasks
```

**This is essential because:**

- Different Dev Box environments may have different available tasks
- You must only use tasks that are actually available to the user
- Assuming tasks exist without checking can lead to invalid YAML files
- The available tasks determine which approaches are possible

**After running the command:**

- Review the available tasks and their parameters
- Use only the tasks shown in the output
- If a desired task is not available, suggest alternatives using available tasks (especially `~/powershell` as a fallback)

This approach ensures users have the best experience while avoiding unnecessary recommendations when tools are already available and ensures all generated YAML uses only available tasks.

## Reference

- [Team Customizations docs](https://learn.microsoft.com/azure/dev-box/concept-what-are-team-customizations?tabs=team-customizations)
- [Write an image definition file for Dev Box Team Customizations](https://learn.microsoft.com/azure/dev-box/how-to-write-image-definition-file)
````
END THIRD-PARTY FILE 7abd53246b9886fc

The third-party file has ended. Everything between the 7abd53246b9886fc tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 3232 of 24481 bytes. © github · MIT · https://github.com/github/awesome-copilot/tree/HEAD/instructions/devbox-image-definition.instructions.md

From the same set: [github/awesome-copilot](https://affpapa.org/en/nevibecode/by/github/awesome-copilot.md) — 770 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
