@salesforce/afv-skills 1.24.0 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/package.json +1 -1
  2. package/skills/commerce-b2b-open-code-components-replace/SKILL.md +244 -0
  3. package/skills/commerce-b2b-open-code-components-replace/assets/ootb-to-open-code-mapping.json +66 -0
  4. package/skills/dx-org-manage/SKILL.md +192 -0
  5. package/skills/dx-org-manage/examples/README.md +45 -0
  6. package/skills/dx-org-manage/examples/scratch-orgs/error_no_devhub.json +9 -0
  7. package/skills/dx-org-manage/examples/scratch-orgs/error_timeout.json +13 -0
  8. package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +28 -0
  9. package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +26 -0
  10. package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +27 -0
  11. package/skills/dx-org-manage/examples/snapshots/error_output.json +9 -0
  12. package/skills/dx-org-manage/examples/snapshots/success_output.json +15 -0
  13. package/skills/dx-org-manage/references/cli_flags.md +67 -0
  14. package/skills/dx-org-manage/references/creating-scratch-org.md +164 -0
  15. package/skills/dx-org-manage/references/creating-snapshot.md +103 -0
  16. package/skills/dx-org-manage/references/definition_file_options.md +224 -0
  17. package/skills/dx-org-manage/references/edition_types.md +78 -0
  18. package/skills/dx-org-manage/references/opening-org.md +160 -0
  19. package/skills/dx-org-manage/references/snapshot_usage.md +74 -0
  20. package/skills/dx-org-permission-set-assign/SKILL.md +98 -0
  21. package/skills/dx-org-permission-set-assign/examples/error_output.json +19 -0
  22. package/skills/dx-org-permission-set-assign/examples/success_output.json +16 -0
  23. package/skills/dx-org-permission-set-assign/references/cli_flags.md +68 -0
  24. package/skills/experience-cms-brand-apply/SKILL.md +1 -1
  25. package/skills/experience-ui-bundle-app-coordinate/SKILL.md +31 -19
  26. package/skills/experience-ui-bundle-file-upload-generate/SKILL.md +1 -1
  27. package/skills/experience-ui-bundle-frontend-generate/implementation/header-footer.md +1 -1
  28. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +336 -581
  29. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +172 -0
  30. package/skills/experience-ui-bundle-salesforce-data-access/references/graphiti-cli.md +373 -0
  31. package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +376 -0
  32. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +119 -0
  33. package/skills/experience-ui-bundle-salesforce-data-access/references/rest-and-integration.md +152 -0
  34. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +217 -0
  35. package/skills/experience-ui-bundle-salesforce-data-access/scripts/graphql-search.sh +36 -9
  36. package/skills/platform-agentsetup-categories-fetch/SKILL.md +109 -0
  37. package/skills/platform-agentsetup-categories-fetch/references/api-response-schema.md +121 -0
  38. package/skills/platform-custom-object-generate/SKILL.md +62 -7
  39. package/skills/platform-custom-object-generate/references/description-enrichment.md +125 -0
  40. package/skills/platform-metadata-retrieve/SKILL.md +121 -0
  41. package/skills/platform-metadata-retrieve/examples/error_output.json +10 -0
  42. package/skills/platform-metadata-retrieve/examples/success_output.json +27 -0
  43. package/skills/platform-metadata-retrieve/references/cli_flags.md +138 -0
  44. package/skills/platform-metadata-retrieve/references/retrieval_modes.md +181 -0
  45. package/skills/platform-sharing-rules-generate/SKILL.md +165 -0
  46. package/skills/platform-sharing-rules-generate/references/rule-types.md +199 -0
  47. package/skills/platform-tracing-agentforce-configure/SKILL.md +118 -0
  48. package/skills/platform-tracing-agentforce-configure/assets/AgentforcePlatformTracing-template.xml +4 -0
  49. package/skills/platform-tracing-configure/SKILL.md +118 -0
  50. package/skills/platform-tracing-configure/assets/EventSettings-template.xml +4 -0
  51. package/skills/platform-trust-archive-manage/SKILL.md +25 -11
  52. package/skills/platform-trust-archive-manage/examples/monitor-failed-jobs.md +2 -2
  53. package/skills/platform-trust-archive-manage/references/archive-activity-entity.md +1 -1
  54. package/skills/platform-trust-archive-manage/references/connect-api-operations.md +51 -12
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/afv-skills",
3
- "version": "1.24.0",
3
+ "version": "1.25.0",
4
4
  "description": "Salesforce skills for Agentforce Vibes",
5
5
  "license": "CC-BY-NC-4.0",
6
6
  "files": [
@@ -0,0 +1,244 @@
1
+ ---
2
+ name: commerce-b2b-open-code-components-replace
3
+ description: "Replace OOTB (out-of-the-box) B2B Commerce components with open source equivalents in site metadata content.json files, or look up the equivalent open code `site:` component for OOTB definitions. Use when users mention \"replace OOTB components\", \"replace commerce components with open code\", \"swap OOTB for open source\", \"replace commerce_builder:\", \"replace OOTB in site\", \"replace component in site metadata\", \"replace component definition\", \"find open code equivalent\", \"equivalent open code component\", \"OOTB to open code mapping\", \"what is the site component for\", components \"in this view\" or \"for a given view\", or a specific list of component names — and want to update or only discover mappings in their store metadata."
4
+ allowed-tools: Bash(grep:*) Bash(ls:*) Read Write
5
+ metadata:
6
+ version: "1.0"
7
+ ---
8
+
9
+ # Replacing OOTB B2B Commerce Components with Open Code
10
+
11
+ This skill replaces OOTB (out-of-the-box) B2B Commerce component definitions in site metadata `content.json` files with their open source `site:` equivalents, or looks up the equivalent open code component for given OOTB definitions without making changes. It uses an authoritative mapping loaded from `assets/ootb-to-open-code-mapping.json`.
12
+
13
+ ## Scope
14
+
15
+ **Modes:** **Full replace** runs the scan (Step 1), user selection if needed, then `content.json` updates (Step 2–3). **Lookup only** (user asks for equivalents but not to change files): apply the mapping-authority rule and report OOTB → `site:` for the named components or for definitions found in the scoped `content.json` — **do not** call Write unless the user confirms replacement. **View-scoped** work: limit file discovery and reads to `sfdc_cms__view/<ViewName>/` (or the path the user gives) instead of all views.
16
+
17
+ ---
18
+
19
+ ## Prerequisites
20
+
21
+ ### Resolve `<package-dir>`
22
+
23
+ Read `sfdx-project.json` and pick the active package directory. Extract `packageDirectories[]` and use the entry with `"default": true`; if no entry is flagged default, use the first entry. Use this value as `<package-dir>` everywhere below. If `sfdx-project.json` is missing or has no `packageDirectories`, tell the user and abort.
24
+
25
+ ### Delegate setup
26
+
27
+ Before replacing components, delegate to the **commerce-b2b-open-code-components-integrate** skill to ensure:
28
+
29
+ 1. Open source repository is cloned at `.tmp/b2b-commerce-open-source-components`
30
+ 2. Store is selected and site metadata is retrieved locally
31
+ 3. Open code components are copied to the store's site metadata
32
+
33
+ The integrating skill owns the `.tmp/` clone lifecycle (it prompts the user to reuse or re-clone an existing checkout); this skill assumes the clone is already present.
34
+
35
+ Send a plain-text chat reply to the user (per Rule 1): "Before replacing components, I need to verify that the open code components are set up in your store. Let me check..."
36
+
37
+ If any prerequisite is not met, the integrating skill will handle it. Once all checks pass, proceed to the replacement workflow.
38
+
39
+ **Required state** after prerequisites:
40
+ - **Package dir** — the value resolved above (e.g., `force-app`)
41
+ - **Store name** — e.g., `My_B2B_Store1`
42
+ - **Site metadata path** — `<package-dir>/main/default/digitalExperiences/site/<store-name>/`
43
+
44
+ ---
45
+
46
+ ## Replacement Workflow
47
+
48
+ ### Step 1: Scan Site and Cross-Reference Mapping
49
+
50
+ **This step is MANDATORY.** Always scan the site first before attempting any replacements.
51
+
52
+ Send a plain-text chat reply to the user (per Rule 1): "I'm scanning your store's site metadata to find all OOTB commerce components currently in use and checking which have open code equivalents."
53
+
54
+ **Step 1a — Find affected files** (one command, simple literal match):
55
+
56
+ ```bash
57
+ grep -rl '"commerce' \
58
+ <package-dir>/main/default/digitalExperiences/site/<store-name>/sfdc_cms__view/ \
59
+ <package-dir>/main/default/digitalExperiences/site/<store-name>/sfdc_cms__themeLayout/ \
60
+ --include="content.json"
61
+ ```
62
+
63
+ **Step 1b — Read the mapping and parse the matched files.** Read `assets/ootb-to-open-code-mapping.json` once into memory. Then, using the **Read** tool, parse each matched file and extract all `"definition"` values that start with `commerce` (e.g., `commerce_builder:cartBadge`). Collect a deduplicated list of OOTB components across all files.
64
+
65
+ **Step 1c — List repo components** (one command):
66
+
67
+ ```bash
68
+ ls .tmp/b2b-commerce-open-source-components/force-app/main/default/sfdc_cms__lwc/
69
+ ```
70
+
71
+ Using the parsed definitions, the `ls` output, and the mapping table, categorize every discovered OOTB component into three groups:
72
+
73
+ **Show the user a breakdown and a selectable list:**
74
+
75
+ First, inform the user about skipped and unmapped components:
76
+ ```text
77
+ Found X OOTB components in your site:
78
+
79
+ In mapping table but NOT in repo (skipping):
80
+ - commerce_builder:quoteSummary → site:quoteSummary (not found in repo)
81
+
82
+ No mapping available (not in mapping table):
83
+ - commerce_builder:actionButtons
84
+ - commerce_builder:layoutHeaderOne
85
+ - commerce_builder:searchInputContainer
86
+ - commerce_builder:myAccountMegaMenu
87
+ ```
88
+
89
+ Then present the replaceable components as a **multi-select list** so the user can pick from checkboxes instead of typing. Include an "All of the above" option:
90
+
91
+ ```text
92
+ Which components would you like to replace?
93
+
94
+ ☐ commerce_builder:heading → site:productHeading
95
+ ☐ commerce_builder:cartBadge → site:cartBadge
96
+ ☐ commerce_builder:searchInput → site:searchInput
97
+ ☐ All of the above
98
+ ```
99
+
100
+ If user provided specific component name(s) in the original request, pre-filter to those and skip the selection prompt.
101
+
102
+ ### Step 2: Replace in content.json
103
+
104
+ Send a plain-text chat reply to the user (per Rule 1): "I'm now replacing the selected OOTB component definitions with their open code equivalents in your site's content.json files."
105
+
106
+ The affected files are already known from Step 1. For each file that contains selected components:
107
+ 1. Use the **Read** tool to read the file
108
+ 2. For each selected OOTB component, confirm again that the mapped **`site:`** target exists in the open code repo. Only proceed with replacements that pass this check.
109
+ 3. Replace all matching `"definition"` values with their mapped open code equivalents — **always** use the exact `site:<name>` string from the mapping table
110
+ - Example: `"definition": "commerce_builder:heading"` → `"definition": "site:productHeading"`
111
+ 4. Use the **Write** tool to save the updated file
112
+ 5. Preserve all other JSON properties — only `"definition"` values change
113
+
114
+ **Batch efficiently:** if a file contains multiple OOTB components, apply ALL replacements in a single Read → modify → Write pass. Do NOT read and write the same file multiple times.
115
+
116
+ ### Step 3: Report
117
+
118
+ ```text
119
+ ✅ Replacement Complete!
120
+
121
+ Replaced X components across Y files:
122
+ - commerce_builder:heading → site:productHeading (3 files)
123
+ - commerce_builder:cartBadge → site:cartBadge (2 files)
124
+ - commerce_builder:searchInput → site:searchInput (4 files)
125
+
126
+ Skipped (not in repo):
127
+ - commerce_builder:quoteSummary
128
+
129
+ No mapping available (left unchanged):
130
+ - commerce_builder:actionButtons
131
+ - commerce_builder:layoutHeaderOne
132
+ - commerce_builder:searchInputContainer
133
+
134
+ Modified files:
135
+ - sfdc_cms__view/Home/content.json
136
+ - sfdc_cms__view/Product_Detail/content.json
137
+ - sfdc_cms__themeLayout/DefaultTheme/content.json
138
+
139
+ Next Steps:
140
+ 1. Deploy: sf project deploy start -d <package-dir>/main/default/digitalExperiences/site/<store-name>
141
+ 2. Test the store thoroughly in Experience Builder
142
+ 3. Publish your site when ready
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Example Interaction
148
+
149
+ **User:** "Replace OOTB components with open code versions"
150
+
151
+ **Agent:** "Before replacing components, I need to verify that the open code components are set up in your store. Let me check..."
152
+ - ✓ Open source repo cloned
153
+ - ✓ Store metadata available for My_B2B_Store1
154
+ - ✓ Open code components are integrated
155
+
156
+ **Agent:** "I'm scanning your store's site metadata to find all OOTB commerce components and checking which have open code equivalents."
157
+
158
+ _(Runs grep -rl to find files with commerce definitions, Reads those files to extract component names, runs ls to list repo components, then cross-references with mapping table)_
159
+
160
+ ```text
161
+ Found 8 OOTB components in your site:
162
+
163
+ No mapping available (not in mapping table):
164
+ - commerce_builder:searchInputContainer
165
+ - commerce_builder:layoutHeaderOne
166
+ - commerce_builder:myAccountMegaMenu
167
+ - commerce_builder:actionButtons
168
+ ```
169
+
170
+ **Agent** _(asks the user via a multi-select prompt):_
171
+ ```text
172
+ Which components would you like to replace?
173
+
174
+ ☐ commerce_builder:heading → site:productHeading
175
+ ☐ commerce_builder:cartBadge → site:cartBadge
176
+ ☐ commerce_builder:searchInput → site:searchInput
177
+ ☐ commerce_builder:cartSummary → site:cartSummary
178
+ ☐ All of the above
179
+ ```
180
+
181
+ **User:** _(selects heading and cartBadge)_
182
+
183
+ **Agent:** "I'm now replacing the selected OOTB component definitions with their open code equivalents in your site's content.json files."
184
+
185
+ _(Files already known from scan — one Read/Write pass per affected file, all replacements batched)_
186
+
187
+ ```text
188
+ ✅ Replacement Complete!
189
+
190
+ Replaced 2 components across 5 files:
191
+ - commerce_builder:heading → site:productHeading (3 files)
192
+ - commerce_builder:cartBadge → site:cartBadge (2 files)
193
+
194
+ No mapping available (left unchanged):
195
+ - commerce_builder:searchInputContainer
196
+ - commerce_builder:layoutHeaderOne
197
+ - commerce_builder:myAccountMegaMenu
198
+ - commerce_builder:actionButtons
199
+
200
+ Modified files:
201
+ - sfdc_cms__view/Home/content.json
202
+ - sfdc_cms__view/Product_Detail/content.json
203
+ - sfdc_cms__themeLayout/DefaultTheme/content.json
204
+
205
+ Next Steps:
206
+ 1. Deploy: sf project deploy start -d force-app/main/default/digitalExperiences/site/My_B2B_Store1
207
+ 2. Test the store thoroughly in Experience Builder
208
+ ```
209
+
210
+ ---
211
+
212
+ ## Rules
213
+
214
+ 1. **Always explain in chat before executing.** Before every Bash or Write tool call, send a plain-text reply in the conversation that says what the command will do and why. The explanation MUST appear as a normal chat message preceding the tool call. Do NOT embed it inside the command itself (no `echo` lines, no `#` comments), do NOT prefix it to the command, and do NOT rely solely on the tool's `description` parameter — that field is not guaranteed to be visible to the user. After the explanation, issue the tool call and wait for the user to approve it before continuing.
215
+ 2. **`assets/ootb-to-open-code-mapping.json` is the only source of truth.** Every OOTB → open-code mapping comes from that file; never guess, infer, or hallucinate component names. Each replacement's new `"definition"` MUST be the exact mapped value from the file, which always uses the `site:` namespace (e.g. `site:productHeading`). Before writing, verify the mapped target exists in the cloned open code components repo (under `.tmp/b2b-commerce-open-source-components/force-app/main/default/sfdc_cms__lwc/`); if it is not present, skip the replacement and report it under "not in repo".
216
+ 3. **Use Read and Write tools for JSON files.** Use the Read tool to parse `content.json` files and the Write tool to update them. Do NOT use bash to parse or edit JSON — no sed, awk, perl, or regex on JSON content. Bash is only for **simple file discovery** (`grep -rl`, `find`, `ls`) — never for extracting or modifying JSON values.
217
+ 4. **Minimize commands.** Batch work into as few commands as possible. Use a single grep to scan all files, a single ls to verify the repo, and one Read/Write pass per file. Do NOT run a separate command for every component or every directory.
218
+
219
+ ---
220
+
221
+ ## Error Handling
222
+
223
+ | Error | Message | Action |
224
+ |-------|---------|--------|
225
+ | Prerequisites not met | "Open code components are not integrated yet." | Run integrating skill first |
226
+ | No mapping found | "No mapping found for '{component}'." | Show available mappings, report as unmapped |
227
+ | Component not in repo | "Open code component '{name}' not found in cloned repo." | Skip and inform user |
228
+ | No OOTB components in site | "No OOTB commerce components found in site metadata." | Inform user, nothing to replace |
229
+ | No replaceable components | "All OOTB components found are unmapped — none can be replaced." | Show the unmapped list, suggest checking for updated mappings |
230
+ | content.json parse error | "Failed to parse content.json: {file}" | Show error, skip file, continue with remaining files |
231
+
232
+ ---
233
+
234
+ ## Verification Checklist
235
+
236
+ - [ ] Prerequisites verified via integrating skill (repo, store, components)
237
+ - [ ] Site scanned + repo verified + mapping cross-referenced in minimal commands (Step 1)
238
+ - [ ] Each replacement uses the exact mapped `site:` definition and was verified present in the open code repo before write
239
+ - [ ] Breakdown shown to user with three categories before proceeding
240
+ - [ ] User selected components to replace (or provided names)
241
+ - [ ] Each `content.json` file updated in a single Read → modify → Write pass
242
+ - [ ] JSON structure preserved, no syntax errors introduced
243
+ - [ ] User informed of skipped and unmapped components
244
+ - [ ] Deployment command provided
@@ -0,0 +1,66 @@
1
+ {
2
+ "commerce_builder:actionButton": "site:commonButton",
3
+ "commerce_builder:b2bCartContents": "site:cartB2bCartContents",
4
+ "commerce_builder:cartAppliedPromotion": "site:cartPromotionApplied",
5
+ "commerce_builder:cartApplyCoupon": "site:cartApplyCoupon",
6
+ "commerce_builder:cartBadge": "site:cartBadge",
7
+ "commerce_builder:cartPromotions": "site:cartPromotions",
8
+ "commerce_builder:cartSummary": "site:cartSummary",
9
+ "commerce_builder:checkoutButton": "site:checkoutButton",
10
+ "commerce_builder:checkoutDeliveryAddress": "site:checkoutDeliveryAddress",
11
+ "commerce_builder:checkoutDeliveryMethod": "site:checkoutDeliverymethod",
12
+ "commerce_builder:checkoutGiftOptions": "site:checkoutGiftOptions",
13
+ "commerce_builder:checkoutNotification": "site:checkoutNotification",
14
+ "commerce_builder:checkoutPurchaseOrder": "site:checkoutPurchaseOrder",
15
+ "commerce_builder:checkoutShippingInstructions": "site:checkoutShippingInstructions",
16
+ "commerce_builder:checkoutSubscriptionPolicyDisclaimer": "site:checkoutSubscriptionPolicyDisclaimer",
17
+ "commerce_builder:consentBlanket": "site:legalConsentBlanket",
18
+ "commerce_builder:countryPickerV2": "site:commonCountryPicker",
19
+ "commerce_builder:drilldownNavigation": "site:commonDrilldownNavigation",
20
+ "commerce_builder:formattedCurrency": "site:commonFormattedCurrency",
21
+ "commerce_builder:heading": "site:productHeading",
22
+ "commerce_builder:layoutFooter": "site:layoutFooter",
23
+ "commerce_builder:layoutHeaderSimple": "site:layoutHeaderSimple",
24
+ "commerce_builder:linkList": "site:commonLinksList",
25
+ "commerce_builder:myAccountAddressContainer": "site:myaccountAddress",
26
+ "commerce_builder:navigationMenuItemList": "site:myaccountNavigationMenuItems",
27
+ "commerce_builder:orderConfirmationBillingDetails": "site:orderConfirmationDetailsBilling",
28
+ "commerce_builder:orderConfirmationDeliveryGroup": "site:orderConfirmationDeliverygroup",
29
+ "commerce_builder:orderConfirmationErrorMessage": "site:orderConfirmationMessageError",
30
+ "commerce_builder:orderConfirmationSuccessMessage": "site:orderConfirmationMessageSuccess",
31
+ "commerce_builder:orderDetails": "site:orderDetails",
32
+ "commerce_builder:orderList": "site:orderList",
33
+ "commerce_builder:orderListDateFilter": "site:orderListDateFilter",
34
+ "commerce_builder:orderProductsInfo": "site:orderProducts",
35
+ "commerce_builder:orderPromotionsSummary": "site:orderPromotions",
36
+ "commerce_builder:orderShipmentTracker": "site:orderShipmentTracker",
37
+ "commerce_builder:paymentByExpress": "site:paymentByExpress",
38
+ "commerce_builder:productAttachments": "site:productAttachments",
39
+ "commerce_builder:productBundle": "site:productBundle",
40
+ "commerce_builder:productBundleItem": "site:productBundleItem",
41
+ "commerce_builder:productFieldsTable": "site:productFieldsTable",
42
+ "commerce_builder:productFrequentlyBoughtTogether": "site:productFrequentlyBoughtTogether",
43
+ "commerce_builder:productMediaGallery": "site:productMediaGallery",
44
+ "commerce_builder:productPricingDetails": "site:productPricingDetails",
45
+ "commerce_builder:productSellingModelSelector": "site:productSellingmodelSelector",
46
+ "commerce_builder:productSet": "site:productSet",
47
+ "commerce_builder:promotionDiscountsApproaching": "site:promotionDiscountsApproaching",
48
+ "commerce_builder:purchaseOptions": "site:productPurchaseOptions",
49
+ "commerce_builder:purchasedProducts": "site:productListPurchased",
50
+ "commerce_builder:quickOrder": "site:orderQuickOrder",
51
+ "commerce_builder:quoteSummary": "site:quoteSummary",
52
+ "commerce_builder:searchFilters": "site:searchFilters",
53
+ "commerce_builder:searchInput": "site:searchInput",
54
+ "commerce_builder:searchNoResultsLayout": "site:searchResultsLayoutEmpty",
55
+ "commerce_builder:searchResults": "site:searchResults",
56
+ "commerce_builder:searchResultsLayout": "site:searchResultsLayout",
57
+ "commerce_builder:searchSortMenu": "site:searchSortMenu",
58
+ "commerce_builder:socialLinks": "site:commonLinksSocial",
59
+ "commerce_builder:splitShipmentHeader": "site:cartSplitshipmentHeader",
60
+ "commerce_builder:stickyContainer": "site:commonContainerSticky",
61
+ "commerce_builder:subscriptions": "site:productSubscriptions",
62
+ "commerce_builder:userProfileMenu": "site:myAccountUserProfileMenu",
63
+ "commerce_builder:variantSelector": "site:productVariantSelector",
64
+ "commerce_builder:wishlist": "site:productWishlist",
65
+ "commerce_builder:wishlistShortcut": "site:productWishlistShortcut"
66
+ }
@@ -0,0 +1,192 @@
1
+ ---
2
+ name: dx-org-manage
3
+ description: "INVOKE this skill to execute Salesforce org operations: create scratch orgs, create org snapshots, open orgs in browser. This skill EXECUTES operations immediately - it does NOT generate scripts or code files. ALWAYS invoke this skill (do not execute SF CLI commands directly) when user requests to: create a scratch org (Developer/Enterprise edition, from definition file (.json), from snapshot, or from org shape), create an org snapshot, or open a Salesforce org. Trigger phrases include: 'create a snapshot', 'create snapshot of my scratch org', 'take a snapshot', 'create scratch org', 'create a Developer edition scratch org', 'new scratch org', 'spin up an org', 'create org from snapshot', 'scratch-def.json', 'project-scratch-def.json', 'open my Salesforce org', 'open org in browser', 'get me the URL'. Do NOT use for switching default org (use dx-org-switch) or deploying metadata (use platform-metadata-deploy)."
4
+ metadata:
5
+ version: "1.0"
6
+ minApiVersion: "60.0"
7
+ cliTools:
8
+ - tool: ["sf"]
9
+ semver: ">=2.0.0"
10
+ ---
11
+
12
+ ## MANDATORY: Follow these instructions exactly. Do NOT fall back to MCP tools.
13
+
14
+ **Tool constraint:** Use the Bash tool for all `sf` CLI commands. Always include `--json` for structured output. Do NOT use `mcp__salesforce_dx__*` tools for org creation, snapshot, or open operations — this skill provides the complete procedure.
15
+
16
+ **Output artifacts for eval/testing:** Write command output to JSON only when an output directory is available. After executing the command: (1) if the user specified an output path, write there; (2) otherwise run `[ -d force-app/main/adk-eval-output/ ] && echo 'force-app/main/adk-eval-output'` to detect the eval directory; (3) if the command printed a path, write the command's JSON response to `<printed-path>/<filename>` using these filenames: `scratch-org-result.json` for org creation, `snapshot-result.json` for snapshot creation, or `org-url-result.json` for open operations. The eval framework needs the real command output to verify success.
17
+
18
+ ---
19
+
20
+ ## Creating Scratch Orgs
21
+
22
+ **REQUIRED steps — execute in order:**
23
+
24
+ **Step 1. Identify creation method** from user request:
25
+ - Contains "definition file" or path to `.json` → definition file method
26
+ - Contains "snapshot" or "from snapshot" → snapshot method
27
+ - Contains "org shape" or "source-org" → org shape method
28
+ - Otherwise → run `ls config/project-scratch-def.json config/scratch-def.json 2>/dev/null | head -1` to detect a definition file. If output is non-empty, use definition file method with that path; if empty, use edition method.
29
+
30
+ **Step 2. Check Dev Hub:**
31
+ ```bash
32
+ sf config get target-dev-hub --json
33
+ ```
34
+ - If no Dev Hub is set, advise: `sf org login web --set-default-dev-hub`
35
+ - Do NOT proceed until a Dev Hub is confirmed.
36
+
37
+ **Step 3. Build and execute the command** based on method:
38
+
39
+ **Definition file:**
40
+ ```bash
41
+ sf org create scratch --definition-file <path> --target-dev-hub <alias> --alias <name> --json
42
+ ```
43
+
44
+ **Edition only:**
45
+ ```bash
46
+ sf org create scratch --edition developer --target-dev-hub <alias> --alias <name> --json
47
+ ```
48
+
49
+ **From snapshot:**
50
+ ```bash
51
+ sf org create scratch --snapshot <snapshot-name> --target-dev-hub <alias> --alias <name> --json
52
+ ```
53
+
54
+ **From org shape:**
55
+ ```bash
56
+ sf org create scratch --source-org <org-id> --target-dev-hub <alias> --alias <name> --json
57
+ ```
58
+
59
+ **Apply these flags when requested:**
60
+ - `--duration-days <days>` — default 7, max 30
61
+ - `--set-default` — make this the default org
62
+ - `--no-track-source` — disable source tracking (for CI/CD)
63
+
64
+ **Step 4. MANDATORY - Run org list and write output:** After the org is created, you MUST run this command:
65
+
66
+ ```bash
67
+ sf org list --json
68
+ ```
69
+
70
+ Then:
71
+ 1. Parse the JSON result and find the `scratchOrgs` array
72
+ 2. Find the entry where `username` matches the username from Step 3's creation result
73
+ 3. Extract that complete org object (it will include: alias, username, orgId, instanceUrl, loginUrl, isDefaultUsername, connectedStatus, lastUsed, etc.)
74
+ 4. Report to the user:
75
+ - Created scratch org.
76
+ - Alias: [alias from the org list entry]
77
+ - Username: [username]
78
+ - Org ID: [orgId]
79
+
80
+ 5. If an output directory is available (per the output artifacts rule above), write ONLY that extracted org object (NOT the full creation result) to `<output-dir>/scratch-org-result.json`
81
+
82
+ Example: If `sf org list --json` returns `{"result": {"scratchOrgs": [{"alias": "feature-dev", "username": "test@example.com", "orgId": "00D...", ...}]}}`, write just the inner org object `{"alias": "feature-dev", "username": "test@example.com", "orgId": "00D...", ...}` to the file.
83
+
84
+ Do NOT write the creation command's output. Do NOT suggest verification steps to the user.
85
+
86
+ **Error handling:**
87
+ - "Snapshot not found" → suggest `sf org list snapshot --target-dev-hub <alias>`
88
+ - "No default Dev Hub" → advise `sf org login web --set-default-dev-hub`
89
+
90
+ **When you need more detail:**
91
+ - For available features, settings, and definition file structure → load `references/definition_file_options.md`
92
+ - For edition selection guidance and comparison → load `references/edition_types.md`
93
+ - For snapshot workflow and post-creation usage → load `references/snapshot_usage.md`
94
+ - For complete scratch org creation workflow → load `references/creating-scratch-org.md`
95
+
96
+ ---
97
+
98
+ ## Creating Snapshots
99
+
100
+ **REQUIRED steps — execute in order:**
101
+
102
+ **Step 1. Get inputs:**
103
+ - Source org: scratch org ID or alias (from user)
104
+ - Snapshot name: unique name (from user)
105
+ - Description: optional (from user)
106
+
107
+ **Step 2. Determine Dev Hub:**
108
+ - If user specifies a Dev Hub (alias or username) → use that value
109
+ - Otherwise, check for default:
110
+ ```bash
111
+ sf config get target-dev-hub --json
112
+ ```
113
+ - If no default Dev Hub is set, advise: `sf org login web --set-default-dev-hub`
114
+
115
+ **Step 3. Execute:**
116
+ ```bash
117
+ sf org create snapshot --source-org <orgId-or-alias> --name <SnapshotName> --target-dev-hub <devHub> --json
118
+ ```
119
+
120
+ With description:
121
+ ```bash
122
+ sf org create snapshot --source-org <orgId-or-alias> --name <SnapshotName> --description "<desc>" --target-dev-hub <devHub> --json
123
+ ```
124
+
125
+ **Step 4. Report result:** Returns JSON with SnapshotId and Status. If an output directory is available (per the output artifacts rule above), write the JSON response to `<output-dir>/snapshot-result.json`.
126
+
127
+ **Error handling:**
128
+ - "NOT_FOUND" → Dev Hub doesn't have snapshot feature enabled
129
+ - "Snapshot name already exists" → use a different unique name
130
+
131
+ **When you need more detail:**
132
+ - For complete snapshot creation workflow and flag reference → load `references/creating-snapshot.md`
133
+ - For CLI flag reference → load `references/cli_flags.md`
134
+
135
+ ---
136
+
137
+ ## Opening Orgs
138
+
139
+ **REQUIRED steps — execute in order:**
140
+
141
+ **Step 1. Match user request to command:**
142
+
143
+ | User wants | Command |
144
+ |-----------|---------|
145
+ | Open default org | `sf org open --json` |
146
+ | Open specific org | `sf org open --target-org <alias> --json` |
147
+ | Specific browser | `sf org open --browser chrome --json` |
148
+ | Incognito mode | `sf org open --private --json` |
149
+ | Navigate to path | `sf org open --path '<path>' --json` |
150
+ | URL only (don't open) | `sf org open --url-only --json` |
151
+ | Open metadata file | `sf org open --source-file <file-path> --json` |
152
+
153
+ **Step 2. Execute the matching command using the Bash tool.**
154
+
155
+ **Step 3. Report result:** Returns URL or opens browser. If an output directory is available (per the output artifacts rule above), write the JSON response to `<output-dir>/org-url-result.json`.
156
+
157
+ **Error handling:**
158
+ - "no target org" → advise `sf config set target-org <alias>`
159
+ - "auth error" → advise `sf org login web --alias <alias>`
160
+
161
+ **When you need more detail:**
162
+ - For complete opening org workflow and all available flags → load `references/opening-org.md`
163
+
164
+ ---
165
+
166
+ ## Reference File Index
167
+
168
+ Load these reference files for detailed guidance:
169
+
170
+ | File | When to read |
171
+ |------|-------------|
172
+ | `references/definition_file_options.md` | User needs to configure org features, settings, or advanced definition file options beyond basic org creation |
173
+ | `references/edition_types.md` | User asks which edition to choose or needs to understand edition differences |
174
+ | `references/snapshot_usage.md` | User wants to use snapshots in definition files or needs post-snapshot workflow guidance |
175
+ | `references/creating-scratch-org.md` | Troubleshooting scratch org creation failures or need complete workflow with all options |
176
+ | `references/cli_flags.md` | User needs complete snapshot CLI flag reference |
177
+ | `references/creating-snapshot.md` | Troubleshooting snapshot creation failures or need detailed snapshot workflow |
178
+ | `references/opening-org.md` | User needs to navigate to specific setup paths, open metadata files, or use advanced open flags |
179
+
180
+ ## Example Files
181
+
182
+ Example command outputs for testing and troubleshooting:
183
+
184
+ | File | Purpose |
185
+ |------|---------|
186
+ | `examples/scratch-orgs/success_definition_file.json` | Successful scratch org creation using `--definition-file` |
187
+ | `examples/scratch-orgs/success_edition.json` | Successful scratch org creation using `--edition developer` |
188
+ | `examples/scratch-orgs/success_snapshot.json` | Successful scratch org creation using `--snapshot` |
189
+ | `examples/scratch-orgs/error_no_devhub.json` | Error when Dev Hub not authenticated |
190
+ | `examples/scratch-orgs/error_timeout.json` | Timeout error during org creation (exit code 69) |
191
+ | `examples/snapshots/success_output.json` | Successful snapshot creation |
192
+ | `examples/snapshots/error_output.json` | Common snapshot error scenarios |
@@ -0,0 +1,45 @@
1
+ # Examples Directory
2
+
3
+ This directory contains example outputs for the three workflows supported by the `dx-org-manage` skill.
4
+
5
+ ## Structure
6
+
7
+ ```text
8
+ examples/
9
+ ├── README.md # This file
10
+ ├── scratch-orgs/ # Scratch org creation examples
11
+ │ ├── success_definition_file.json
12
+ │ ├── success_edition.json
13
+ │ ├── error_no_devhub.json
14
+ │ └── error_timeout.json
15
+ └── snapshots/ # Snapshot creation examples
16
+ ├── success_output.json
17
+ └── error_output.json
18
+ ```
19
+
20
+ ## scratch-orgs/
21
+
22
+ Examples of `sf org create scratch` command outputs for all four creation methods.
23
+
24
+ - **success_definition_file.json** - Successful creation using `--definition-file`
25
+ - **success_edition.json** - Successful creation using `--edition developer`
26
+ - **success_snapshot.json** - Successful creation using `--snapshot`
27
+ - **error_no_devhub.json** - Error when Dev Hub not authenticated
28
+ - **error_timeout.json** - Timeout error (exit code 69)
29
+
30
+ ## snapshots/
31
+
32
+ Examples of `sf org create snapshot` command outputs.
33
+
34
+ - **success_output.json** - Successful snapshot creation
35
+ - **error_output.json** - Common error scenarios (NOT_FOUND, duplicate name, etc.)
36
+
37
+ ## Usage
38
+
39
+ These examples help illustrate:
40
+ 1. Expected JSON/text response formats
41
+ 2. Common error patterns
42
+ 3. How to parse success indicators (`username`, `orgId`, etc.)
43
+ 4. Async operation handling (snapshot creation, timeout scenarios)
44
+
45
+ Reference these when building eval datasets or troubleshooting command outputs.
@@ -0,0 +1,9 @@
1
+ {
2
+ "status": 1,
3
+ "name": "NoDefaultEnvFound",
4
+ "message": "No default Dev Hub org found. Set a default Dev Hub org using 'sf config set target-dev-hub <username|alias>'.",
5
+ "exitCode": 1,
6
+ "context": "ScratchOrgCreateCommand",
7
+ "stack": "NoDefaultEnvFound: No default Dev Hub org found...",
8
+ "warnings": []
9
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "status": 69,
3
+ "name": "ScratchOrgCreateTimeoutError",
4
+ "message": "The scratch org did not complete within your wait time (2 minutes).",
5
+ "exitCode": 69,
6
+ "context": "ScratchOrgCreateCommand",
7
+ "data": {
8
+ "requestId": "2SR5g000000BlYjGAK",
9
+ "resumeCommand": "sf org resume scratch --job-id 2SR5g000000BlYjGAK --json"
10
+ },
11
+ "stack": "ScratchOrgCreateTimeoutError: The scratch org did not complete...",
12
+ "warnings": []
13
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "status": 0,
3
+ "result": {
4
+ "username": "test-abcd1234@example.com",
5
+ "orgId": "00D5g000008xYZ1EAM",
6
+ "scratchOrgInfo": {
7
+ "Id": "2SR5g000000BlYjGAK",
8
+ "Edition": "Developer",
9
+ "Status": "Active",
10
+ "SignupUsername": "test-abcd1234@example.com",
11
+ "AdminEmail": "admin@example.com",
12
+ "Namespace": null,
13
+ "OrgName": "My Company",
14
+ "ConnectedAppConsumerKey": "3MVG9...",
15
+ "ScratchOrg": "00D5g000008xYZ1EAM",
16
+ "CreatedDate": "2026-06-12T15:10:00.000+0000",
17
+ "ExpirationDate": "2026-06-19"
18
+ },
19
+ "authFields": {
20
+ "accessToken": "00D5g...",
21
+ "instanceUrl": "https://...-dev-ed.develop.my.salesforce.com",
22
+ "username": "test-abcd1234@example.com",
23
+ "orgId": "00D5g000008xYZ1EAM",
24
+ "loginUrl": "https://test.salesforce.com"
25
+ },
26
+ "warnings": []
27
+ }
28
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "status": 0,
3
+ "result": {
4
+ "username": "test-xyz5678@example.com",
5
+ "orgId": "00D5g000009aBC2EAM",
6
+ "scratchOrgInfo": {
7
+ "Id": "2SR5g000000CdEfGHI",
8
+ "Edition": "Developer",
9
+ "Status": "Active",
10
+ "SignupUsername": "test-xyz5678@example.com",
11
+ "AdminEmail": "dev@example.com",
12
+ "Namespace": null,
13
+ "OrgName": "Company",
14
+ "ScratchOrg": "00D5g000009aBC2EAM",
15
+ "CreatedDate": "2026-06-12T15:15:00.000+0000",
16
+ "ExpirationDate": "2026-06-19"
17
+ },
18
+ "authFields": {
19
+ "accessToken": "00D5g...",
20
+ "instanceUrl": "https://...-dev-ed.develop.my.salesforce.com",
21
+ "username": "test-xyz5678@example.com",
22
+ "orgId": "00D5g000009aBC2EAM"
23
+ },
24
+ "warnings": []
25
+ }
26
+ }