npx skills add ...
npx skills add forcedotcom/sf-skills --skill dx-devops-work-item-manage
Use this skill to manage the full lifecycle of DevOps Center work items — list, create, update, commit changes, perform status transitions, and create pull requests. Update fields like subject, description, and status. Commit and push code changes to work item branches. Create pull requests for work item branches via DevOps Center API. Invoke when the user wants to track, find, create, or update a work item, commit changes to a work item branch, advance a work item's status through the pipeline, or create a pull request for code review. Consolidates sf devops work-item and review operations. DO NOT TRIGGER for promotion or deployment operations, or conflict detection.
npx skills add forcedotcom/sf-skills --skill dx-devops-work-item-manage
Manages the complete work item lifecycle in DevOps Center — from creation through status transitions to promotion readiness. Provides headless CLI-driven operations for autonomous release workflows.
Gather or infer before proceeding:
sf devops project list --json if not providedDefaults unless specified:
--json for headless consumption--work-item-name (WI-000001) over --work-item-id when both are available (names are human-readable)If the user provides a clear request ("list work items for Project Alpha", "create work item to fix login bug", "move WI-12345 to In Progress", "create PR for WI-12345"), proceed immediately without unnecessary questions.
All operations use sf devops work-item CLI commands with --json output for structured consumption.
Verify org authentication before any operation:
--target-org <alias> on all subsequent commandsList work items — when the user wants to see existing work items:
--project-id is required — if the user provides a project name instead of ID, first run sf devops project list --json to resolve the name to an ID.result[] arrayname (e.g., WI-000001), subject, branch, environment, status, description.result[] is an empty array, confirm "No work items found in project ."Create a work item — when the user wants to create a new work item:
--project-id is required (obtain from user or via sf devops project list --json)--subject is required (user-facing title)--description is optional (defaults to blank if omitted)Execute commit operation — when operation type is commit:
branch field (retrieve via list or create operation)Update work item — when the user wants to change subject, description, or status:
--work-item-name <WI-000001> (preferred) or --work-item-id <id>--subject, --description, or --status must be provided.result.name, .result.subject, .result.status contain the updated values.result.status in the response. If the status field is absent from the update response, re-query the work item via list to verify the status persistedCreate pull request — when the user wants to create a PR for code review:
--work-item-name <WI-000001> (preferred) or --work-item-id <id>.result.pullRequestUrl contains the PR URL, .result.status contains the PR status (typically "open" for newly created PRs), .result.number contains the PR numberVerify operation success:
.result[] array, and verify it contains work items (or is empty if no matches). If the user specified a project by name, confirm the resolved project ID matches..result.name (work item ID like WI-000001), .result.branch (branch name), and .result.environment fields.git push succeeds, the commit is saved to the work item branch..result.subject matches the new value..result.status in the JSON response matches the target status (e.g., "Ready to Promote"). If the response doesn't include the status field, re-run sf devops work-item list filtered to this work item and verify the status persisted..result.pullRequestUrl (the PR URL) and .result.status (should be "open" or equivalent). If VCS credentials are missing, the CLI returns an error — surface this to the user.Report results:
| Constraint | Rationale |
|---|---|
All sf devops commands must use --json flag | Structured output is required for headless consumption; human-readable output is unreliable for parsing |
| Work item identifier required for commit, update, and create-review | Use --work-item-name (preferred) or --work-item-id; obtain from list or prior create |
| Project ID required for list and create | All work items belong to a project; use sf devops project list --json if not provided |
| At least one update field required | Update command fails if no --subject, --description, or --status flag is provided |
| Status values must be exact strings | "In Progress" and "Ready to Promote" (with spaces, proper capitalization); other values fail |
| Idempotent create operations | Check for existing work item with same subject + project before creating duplicates |
| Changes must be committed before status transition to Ready to Promote | DevOps Center validates that the work item branch has commits before allowing promotion readiness |
| PR creation requires VCS credentials in org | DevOps Center API uses stored VCS credentials; no local git auth needed |
| Never use interactive prompts | Skills run in headless environments; all inputs must be via CLI flags |
| Issue | Resolution |
|---|---|
| No default org set | Run sf org display --json first; if it fails, instruct user to run sf org login web --set-default |
| User provides work item by subject, not name | Resolve via: sf devops work-item list --project-id <id> --json | jq -r '.result[] | select(.subject == "<subject>") | .name'; then pass the returned name to the update/create-review command |
| User provides project by name, not ID | First run sf devops project list --json and filter .result[] by .name field to find the project ID, then use that ID in the list/create command |
| Status update response missing status field | The CLI doesn't always return the status field in the update response; re-run sf devops work-item list filtered to this work item and check .result[0].status to verify the transition persisted |
| Work item not found | User provided invalid work item name/ID; run list command to show available work items |
| Invalid status value | Only "In Progress" and "Ready to Promote" are valid (exact strings with spaces); check spelling and capitalization |
| Project not found | User provided invalid project ID; run sf devops project list --json to show available projects |
| Duplicate work item subject | Idempotent create check should catch this; return existing work item name instead of creating duplicate |
| Git push fails - no commits or branch not found | Verify files are staged with git status and branch name retrieved from work item via list command |
| PR creation fails - VCS credentials | VCS credentials not configured in DevOps Center UI; instruct user to configure in Setup → DevOps Center → VCS Credentials |
Deliverables vary by operation:
Outputs are derived from sf devops work-item CLI, sf devops review create CLI, and standard git commands.
Before reporting results to the user:
sf org display --json?--json flag?--target-org specified on all commands?--project-id provided?--subject provided and included in the command?--project-id provided (or obtained via project list)?git add?git commit succeed with exit code 0?git push succeed with exit code 0?| File | When to read |
|---|---|
references/cli-commands.md | When you need detailed CLI flag documentation, JSON output schemas, or error handling patterns |
examples/common-workflows.md | When the user's request matches a common pattern (bulk updates, reassignment, idempotent creation, sequential transitions) |