|
| 1 | +--- |
| 2 | +description: "Create a single Azure DevOps work item with conversational field collection and parent validation" |
| 3 | +agent: ADO Backlog Manager |
| 4 | +argument-hint: "project=... [type={Epic|Feature|UserStory|Bug|Task}] [title=...]" |
| 5 | +--- |
| 6 | + |
| 7 | +# Add ADO Work Item |
| 8 | + |
| 9 | +Create a single work item through conversational field collection, validate parent hierarchy, and log the result. Use interaction templates from #file:../../instructions/ado/ado-interaction-templates.instructions.md for description formatting. |
| 10 | + |
| 11 | +Follow all instructions from #file:../../instructions/ado/ado-wit-planning.instructions.md for field definitions and shared conventions. |
| 12 | +Follow all instructions from #file:../../instructions/ado/ado-interaction-templates.instructions.md for work item description and comment templates. |
| 13 | + |
| 14 | +## Inputs |
| 15 | + |
| 16 | +* `${input:project}`: (Required) Azure DevOps project name. |
| 17 | +* `${input:type}`: (Optional) Work item type: Epic, Feature, User Story, Bug, Task. When not provided, present options during field collection. |
| 18 | +* `${input:title}`: (Optional) Work item title. When not provided, prompt during field collection. |
| 19 | +* `${input:parentId}`: (Optional) Parent work item ID for hierarchy linking. |
| 20 | +* `${input:areaPath}`: (Optional) Area Path for the new work item. |
| 21 | +* `${input:iterationPath}`: (Optional) Iteration Path for the new work item. |
| 22 | +* `${input:contentFormat:Markdown}`: (Optional) Content format for rich-text fields. Use `Markdown` for Azure DevOps Services (dev.azure.com) or `Html` for Azure DevOps Server (on-premises). Defaults to Markdown. |
| 23 | + |
| 24 | +## Required Steps |
| 25 | + |
| 26 | +The workflow proceeds through five steps: resolve project context, select work item type, collect fields conversationally, validate parent hierarchy, then create the work item and log the result. |
| 27 | + |
| 28 | +### Step 1: Resolve Project Context |
| 29 | + |
| 30 | +Establish the target project and verify access before proceeding. |
| 31 | + |
| 32 | +1. Call `mcp_ado_core_get_identity_ids` to establish authenticated user context. |
| 33 | +2. Verify `${input:project}` is accessible. When inaccessible, report the error and prompt for correction. |
| 34 | +3. When `${input:areaPath}` or `${input:iterationPath}` is not provided, retrieve available paths via `mcp_ado_work_list_team_iterations` or similar retrieval calls for context. |
| 35 | + |
| 36 | +### Step 2: Select Work Item Type |
| 37 | + |
| 38 | +Determine the work item type for creation. |
| 39 | + |
| 40 | +1. When `${input:type}` matches a valid type (Epic, Feature, User Story, Bug, Task), use it directly. |
| 41 | +2. When `${input:type}` is not provided, present the available types and ask the user to select one. |
| 42 | +3. Record the selected type for field collection in the next step. |
| 43 | + |
| 44 | +### Step 3: Collect Fields |
| 45 | + |
| 46 | +Gather field values through conversation using the interaction template for the selected work item type. |
| 47 | + |
| 48 | +1. When `${input:title}` is not provided, prompt the user for a title. |
| 49 | +2. Collect the description using the appropriate interaction template format for the selected type. Select the Markdown or HTML template variant from #file:../../instructions/ado/ado-interaction-templates.instructions.md based on `${input:contentFormat}`. |
| 50 | +3. For optional fields not provided through inputs (Priority, Severity for bugs, Tags, Assigned To), ask the user whether they want to supply values. |
| 51 | +4. Merge provided inputs with conversationally collected values. |
| 52 | + |
| 53 | +### Step 4: Validate Parent Hierarchy |
| 54 | + |
| 55 | +Verify parent-child relationships are valid before creation. |
| 56 | + |
| 57 | +1. When `${input:parentId}` is provided, fetch the parent work item via `mcp_ado_wit_get_work_item` and verify the hierarchy is valid: |
| 58 | + * Features require an Epic parent. |
| 59 | + * User Stories require a Feature parent. |
| 60 | + * Tasks and Bugs can be children of User Stories or Features. |
| 61 | +2. When the hierarchy is invalid, warn the user and suggest corrections or alternative parent items. |
| 62 | +3. When `${input:parentId}` is not provided and the selected type is Feature, User Story, Task, or Bug, ask the user if they want to link to a parent item. |
| 63 | + |
| 64 | +### Step 5: Create and Log |
| 65 | + |
| 66 | +Submit the work item to Azure DevOps and record the result. |
| 67 | + |
| 68 | +1. When `${input:parentId}` is provided and valid, call `mcp_ado_wit_add_child_work_items` to create the item as a child of the parent. |
| 69 | +2. When no parent is specified, call `mcp_ado_wit_create_work_item` with the collected fields (title, description, type, Area Path, Iteration Path, Priority, Tags, and any additional fields). Set the `format` parameter to `${input:contentFormat}` for Description, Acceptance Criteria, and Repro Steps fields. |
| 70 | +3. On success, extract the work item ID and URL from the response and confirm creation with the user. |
| 71 | +4. Create or append to a tracking artifact in `.copilot-tracking/workitems/execution/{{YYYY-MM-DD}}/` with the work item ID, URL, type, title, applied fields, and parent relationship. |
| 72 | +5. On failure, report the error and suggest corrections or a retry. |
| 73 | + |
| 74 | +## Success Criteria |
| 75 | + |
| 76 | +* Project context is resolved and access is verified before field collection. |
| 77 | +* The work item type is selected before collecting type-specific fields. |
| 78 | +* Required fields are validated before creation. |
| 79 | +* Parent hierarchy is validated when a parent ID is provided. |
| 80 | +* The work item is created with correct metadata and interaction template formatting matching `${input:contentFormat}`. |
| 81 | +* A tracking artifact exists in `.copilot-tracking/workitems/execution/{{YYYY-MM-DD}}/`. |
| 82 | + |
| 83 | +## Error Handling |
| 84 | + |
| 85 | +* Project inaccessible: display the error and prompt for correction. |
| 86 | +* Invalid parent hierarchy: warn the user and suggest valid parent options. |
| 87 | +* Required field missing after prompting: re-prompt until a value is provided. |
| 88 | +* Creation failure: display the error message and suggest corrections. |
| 89 | +* Parent work item not found: inform the user and offer to proceed without linking. |
| 90 | + |
| 91 | +--- |
| 92 | + |
| 93 | +Proceed with creating the Azure DevOps work item following the Required Steps. |
0 commit comments