SuperAPI AI Directory

boards-work-item-summary

Office & productivity

View repository

Updated 10-15 21:11

About this skill

Work Item Summary

This Skill always targetsa specific work item ID. A work item ID is unique across the entire organization, so there is no need to select a project first.

  • If the user provides an ID (for example "115770" or "work item 115770"), use it directly.
  • If not provided, ask the user to provide it once.
  • If there is still no ID after prompting, reply "A work item ID is required" and stop, without calling any API.

Connection and Authentication

Always use curl to call the Azure DevOps REST API directly; each command carries its own authentication parameters.

  • Organization: read the environment variable AZURE_DEVOPS_ORG(the organization name, for example contoso). If it is not set, ask the user once; if the user gives a URL, extract the organization name from https://dev.azure.com/{org} or https://{org}.visualstudio.com .
  • Token: the PAT is sent using Basic authentication:-u ":$AZURE_DEVOPS_PAT"; if only AZURE_DEVOPS_EXT_PATis set (the variable used by the Azure CLI azure-devops extension), use that instead. When using a Microsoft Entra ID token instead, switch to -H "Authorization: Bearer $AZURE_DEVOPS_TOKEN". If neither is set, ask the user to set AZURE_DEVOPS_PAT in their own terminal and retry, then stop. Read the token only from environment variables: do not ask the user to paste the token into the conversation, and do not print it or write it to a file.
  • PAT permission scopes: Work Items (Read); to read Pull Request details, Code (Read) is also required.
  • Encoding: project names in paths must be URL-encoded (write spaces as %20); in query strings, write $ as %24(for example %24expand) to avoid shell expansion.
  • Errors: HTTP 401, 403, 203, or a response that is an HTML login page means the token is invalid, expired, or has insufficient permissions; report this and stop. HTTP 404 means the organization name or ID is incorrect.
  • Windows PowerShell: call curl.exe(rather than the curl alias), and write the environment variable as $env:AZURE_DEVOPS_PAT; PowerShell does not support <<'EOF', so first write the JSON body to a temporary file, then send it with --data-binary "@body.json" .

Steps

  1. Retrieve the work item's fields, relations, and links in one call:

    curl -sS -u ":$AZURE_DEVOPS_PAT" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/_apis/wit/workitems/{id}?%24expand=all&api-version=7.1"
    

    Note fields["System.TeamProject"]for later use when constructing URLs and calling the comments API.

  2. From the relations array, collect all linked work item IDs:url for relations of the form .../_apis/wit/workItems/{linkedId} , take the last segment of the URL as the ID;attributes.name is the display name of the link type (Parent, Child, Related…). The parent item (System.LinkTypes.Hierarchy-Reverse) is also among them, so there is no need to call separately.

  3. Retrieve details of all linked items in a single batch call (at most 200 IDs per call; split into batches if more):

    curl -sS -u ":$AZURE_DEVOPS_PAT" -X POST -H "Content-Type: application/json" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/_apis/wit/workitemsbatch?api-version=7.1" \
      -d '{"ids":[101,102],"fields":["System.Id","System.Title","System.State","System.WorkItemType","System.TeamProject"],"errorPolicy":"Omit"}'
    

    errorPolicy: Omit causes deleted or unauthorized items to be returned as null , so the entire batch call does not fail because of them.

  4. Find linked Pull Requests:relations in rel where ArtifactLink is attributes.name and Pull Request isurl in the form vstfs:///Git/PullRequestId/{projectId}%2F{repositoryId}%2F{pullRequestId}(the separator may be %2F or %2f, and parsing is case-insensitive). Other ArtifactLink(Commit, Build, Release) are not included in the summary. For each PR, call:

    curl -sS -u ":$AZURE_DEVOPS_PAT" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/{projectId}/_apis/git/repositories/{repositoryId}/pullrequests/{pullRequestId}?api-version=7.1"
    

    Get title、status(active、completed、abandoned) and repository.webUrl. If the token lacks Code (Read) and the data cannot be retrieved, still list the PR ID and note that details could not be obtained.

  5. Retrieve the raw work item comments in one call:

    curl -sS -u ":$AZURE_DEVOPS_PAT" \
      "https://dev.azure.com/$AZURE_DEVOPS_ORG/{project}/_apis/wit/workItems/{id}/comments?api-version=7.1-preview.4"
    

    totalCount is the total number of comments, andcomments[].text is HTML. When the response includes continuationToken , it means there are more comments; if needed, add &continuationToken={token} and retrieve again.

Present the results

  • Main item fields: ID, title, status, assignee (show only displayName, do not show email), work item type, created date (YYYY/MM/DD), priority (Microsoft.VSTS.Common.Priority), tags (System.Tags)。

  • Linkstable, with one row per linked work item:

    • ID: a clickable hyperlink, with a fixed format of [{ID}](https://dev.azure.com/{organization}/{project}/_workitems/edit/{ID}),{project} take that item's System.TeamProject(URL-encoded)
    • Link type(Parent, Child, Related, or the original relation name)
    • Work item type
    • Title
    • Status

    Ordered as follows:Parent → Child → Related → other link types.

  • When there are linked Pull Requests, also list a Pull Requests table, including at least the PR ID, title, status, and a clickable link {repository.webUrl}/pullrequest/{pullRequestId}。

  • Use brief plain languageto summarizethe work item's description (System.Description), system information (Microsoft.VSTS.TCM.SystemInfo), and reproduction steps (Microsoft.VSTS.TCM.ReproSteps), summarizing only fields that actually exist. These fields are HTML; skip the tags when reading. Focus on the core intent, scope, and key technical or reproduction details.

  • Comments:

    • When there are comments, state thetotal number of comments, and briefly describe the main issues or decisions made.
    • When there are no comments, clearly state that this work item has no comments.