@salesforce/afv-skills 1.23.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 (61) 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/{developing-datacloud-code-extension → data360-code-extension-generate}/SKILL.md +7 -7
  5. package/skills/{developing-datacloud-code-extension → data360-code-extension-generate}/references/README.md +7 -7
  6. package/skills/{developing-datacloud-code-extension → data360-code-extension-generate}/references/quick-reference.md +2 -2
  7. package/skills/{getting-datacloud-schema → data360-schema-get}/SKILL.md +26 -26
  8. package/skills/{getting-datacloud-schema → data360-schema-get}/references/README.md +9 -9
  9. package/skills/dx-org-manage/SKILL.md +192 -0
  10. package/skills/dx-org-manage/examples/README.md +45 -0
  11. package/skills/dx-org-manage/examples/scratch-orgs/error_no_devhub.json +9 -0
  12. package/skills/dx-org-manage/examples/scratch-orgs/error_timeout.json +13 -0
  13. package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +28 -0
  14. package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +26 -0
  15. package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +27 -0
  16. package/skills/dx-org-manage/examples/snapshots/error_output.json +9 -0
  17. package/skills/dx-org-manage/examples/snapshots/success_output.json +15 -0
  18. package/skills/dx-org-manage/references/cli_flags.md +67 -0
  19. package/skills/dx-org-manage/references/creating-scratch-org.md +164 -0
  20. package/skills/dx-org-manage/references/creating-snapshot.md +103 -0
  21. package/skills/dx-org-manage/references/definition_file_options.md +224 -0
  22. package/skills/dx-org-manage/references/edition_types.md +78 -0
  23. package/skills/dx-org-manage/references/opening-org.md +160 -0
  24. package/skills/dx-org-manage/references/snapshot_usage.md +74 -0
  25. package/skills/dx-org-permission-set-assign/SKILL.md +98 -0
  26. package/skills/dx-org-permission-set-assign/examples/error_output.json +19 -0
  27. package/skills/dx-org-permission-set-assign/examples/success_output.json +16 -0
  28. package/skills/dx-org-permission-set-assign/references/cli_flags.md +68 -0
  29. package/skills/experience-cms-brand-apply/SKILL.md +1 -1
  30. package/skills/experience-ui-bundle-app-coordinate/SKILL.md +31 -19
  31. package/skills/experience-ui-bundle-file-upload-generate/SKILL.md +1 -1
  32. package/skills/experience-ui-bundle-frontend-generate/implementation/header-footer.md +1 -1
  33. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +336 -581
  34. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +172 -0
  35. package/skills/experience-ui-bundle-salesforce-data-access/references/graphiti-cli.md +373 -0
  36. package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +376 -0
  37. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +119 -0
  38. package/skills/experience-ui-bundle-salesforce-data-access/references/rest-and-integration.md +152 -0
  39. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +217 -0
  40. package/skills/experience-ui-bundle-salesforce-data-access/scripts/graphql-search.sh +36 -9
  41. package/skills/platform-agentsetup-categories-fetch/SKILL.md +109 -0
  42. package/skills/platform-agentsetup-categories-fetch/references/api-response-schema.md +121 -0
  43. package/skills/platform-custom-object-generate/SKILL.md +62 -7
  44. package/skills/platform-custom-object-generate/references/description-enrichment.md +125 -0
  45. package/skills/platform-metadata-retrieve/SKILL.md +121 -0
  46. package/skills/platform-metadata-retrieve/examples/error_output.json +10 -0
  47. package/skills/platform-metadata-retrieve/examples/success_output.json +27 -0
  48. package/skills/platform-metadata-retrieve/references/cli_flags.md +138 -0
  49. package/skills/platform-metadata-retrieve/references/retrieval_modes.md +181 -0
  50. package/skills/platform-sharing-rules-generate/SKILL.md +165 -0
  51. package/skills/platform-sharing-rules-generate/references/rule-types.md +199 -0
  52. package/skills/platform-tracing-agentforce-configure/SKILL.md +118 -0
  53. package/skills/platform-tracing-agentforce-configure/assets/AgentforcePlatformTracing-template.xml +4 -0
  54. package/skills/platform-tracing-configure/SKILL.md +118 -0
  55. package/skills/platform-tracing-configure/assets/EventSettings-template.xml +4 -0
  56. package/skills/platform-trust-archive-manage/SKILL.md +25 -11
  57. package/skills/platform-trust-archive-manage/examples/monitor-failed-jobs.md +2 -2
  58. package/skills/platform-trust-archive-manage/references/archive-activity-entity.md +1 -1
  59. package/skills/platform-trust-archive-manage/references/connect-api-operations.md +51 -12
  60. /package/skills/{getting-datacloud-schema → data360-schema-get}/scripts/get_dlo_schema.py +0 -0
  61. /package/skills/{getting-datacloud-schema → data360-schema-get}/scripts/get_dmo_schema.py +0 -0
@@ -1,4 +1,4 @@
1
- # getting-datacloud-schema Skill
1
+ # data360-schema-get Skill
2
2
 
3
3
  ## Overview
4
4
 
@@ -7,25 +7,25 @@ A skill that retrieves Data Lake Object (DLO) and Data Model Object (DMO) schema
7
7
  ## Usage
8
8
 
9
9
  **List all DLOs:**
10
- ```
10
+ ```text
11
11
  "Show me all DLOs in afvibe org"
12
12
  "List Data Lake Objects in myorg"
13
13
  ```
14
14
 
15
15
  **Get specific DLO schema:**
16
- ```
16
+ ```text
17
17
  "Get the schema for Employee__dll in afvibe"
18
18
  "What fields does the Employee__dll DLO have in myorg?"
19
19
  ```
20
20
 
21
21
  **List all DMOs:**
22
- ```
22
+ ```text
23
23
  "Show me all DMOs in afvibe org"
24
24
  "List Data Model Objects in myorg"
25
25
  ```
26
26
 
27
27
  **Get specific DMO schema:**
28
- ```
28
+ ```text
29
29
  "Get the schema for Individual__dlm in afvibe"
30
30
  "What fields does the Individual__dlm DMO have in myorg?"
31
31
  ```
@@ -116,7 +116,7 @@ python3 scripts/get_dmo_schema.py afvibe Individual__dlm
116
116
  ## Output Format
117
117
 
118
118
  ### DLO List
119
- ```
119
+ ```text
120
120
  Found 5 DLOs in org 'afvibe':
121
121
 
122
122
  1. DataCustomCodeLogs__dll
@@ -131,7 +131,7 @@ Found 5 DLOs in org 'afvibe':
131
131
  ```
132
132
 
133
133
  ### DLO Schema
134
- ```
134
+ ```text
135
135
  DLO: Employee__dll
136
136
  Label: Employee
137
137
  Category: Profile
@@ -148,7 +148,7 @@ Fields (9 total):
148
148
  ```
149
149
 
150
150
  ### DMO List
151
- ```
151
+ ```text
152
152
  Found 10 DMOs in org 'afvibe':
153
153
 
154
154
  1. Individual__dlm
@@ -161,7 +161,7 @@ Found 10 DMOs in org 'afvibe':
161
161
  ```
162
162
 
163
163
  ### DMO Schema
164
- ```
164
+ ```text
165
165
  DMO: Individual__dlm
166
166
  Label: Individual
167
167
  Category: Profile
@@ -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
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "status": 0,
3
+ "result": {
4
+ "username": "test-snap9012@example.com",
5
+ "orgId": "00D5g00000aDEF3EAM",
6
+ "scratchOrgInfo": {
7
+ "Id": "2SR5g000000EfGhIJK",
8
+ "Edition": "Developer",
9
+ "Status": "Active",
10
+ "SignupUsername": "test-snap9012@example.com",
11
+ "AdminEmail": "dev@example.com",
12
+ "Namespace": null,
13
+ "OrgName": "Company",
14
+ "ScratchOrg": "00D5g00000aDEF3EAM",
15
+ "SnapshotName": "MySnapshot",
16
+ "CreatedDate": "2026-06-12T15:20: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-snap9012@example.com",
23
+ "orgId": "00D5g00000aDEF3EAM"
24
+ },
25
+ "warnings": []
26
+ }
27
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "status": 1,
3
+ "name": "NOT_FOUND",
4
+ "message": "Org snapshots are not enabled in this org. Contact Salesforce to enable org snapshots.",
5
+ "exitCode": 1,
6
+ "commandName": "SnapshotCreate",
7
+ "stack": "NOT_FOUND: Org snapshots are not enabled in this org...",
8
+ "warnings": []
9
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "status": 0,
3
+ "result": {
4
+ "Id": "0Oo5g00000001ABCAA",
5
+ "Status": "Pending",
6
+ "SourceOrg": "00D5g00000001XyEAI",
7
+ "SnapshotName": "MySnapshot",
8
+ "Description": "Baseline configuration with Package v1.2.0",
9
+ "Content": "metadatadata",
10
+ "CreatedDate": "2026-06-04T20:00:00.000+0000",
11
+ "CreatedBy": "0055g00000001UserEAA",
12
+ "LastModifiedDate": "2026-06-04T20:00:00.000+0000",
13
+ "LastModifiedBy": "0055g00000001UserEAA"
14
+ }
15
+ }
@@ -0,0 +1,67 @@
1
+ # CLI Flags Reference
2
+
3
+ Complete reference for `sf org create snapshot` command flags.
4
+
5
+ ## Required Flags
6
+
7
+ | Flag | Alias | Description | Example |
8
+ |------|-------|-------------|---------|
9
+ | `--source-org` | `-o` | ID or authenticated username/alias of scratch org to snapshot | `--source-org my-scratch` |
10
+ | `--name` | `-n` | Unique name for the snapshot | `--name MySnapshot` |
11
+ | `--target-dev-hub` | `-v` | Dev Hub org username or alias (required unless default is set) | `--target-dev-hub DevHub` |
12
+
13
+ ## Optional Flags
14
+
15
+ | Flag | Alias | Description | Example |
16
+ |------|-------|-------------|---------|
17
+ | `--description` | `-d` | Description of snapshot contents | `--description "Package v1.2.0"` |
18
+ | `--api-version` | | Override the API version used for API requests | `--api-version 66.0` |
19
+
20
+ ## Global Flags
21
+
22
+ | Flag | Description |
23
+ |------|-------------|
24
+ | `--json` | Format output as JSON (ALWAYS use this) |
25
+
26
+ ## Usage Patterns
27
+
28
+ ### Basic Snapshot Creation
29
+
30
+ ```bash
31
+ sf org create snapshot --source-org my-scratch --name MySnapshot --json
32
+ ```
33
+
34
+ ### With Description
35
+
36
+ ```bash
37
+ sf org create snapshot \
38
+ --source-org my-scratch \
39
+ --name MySnapshot \
40
+ --description "Baseline with Package v1.2.0" \
41
+ --json
42
+ ```
43
+
44
+ ### Using Org ID Instead of Alias
45
+
46
+ ```bash
47
+ sf org create snapshot \
48
+ --source-org 00D5g00000001XyEAI \
49
+ --name MySnapshot \
50
+ --json
51
+ ```
52
+
53
+ ### Specify Dev Hub Explicitly
54
+
55
+ ```bash
56
+ sf org create snapshot \
57
+ --source-org my-scratch \
58
+ --name MySnapshot \
59
+ --target-dev-hub MyDevHub \
60
+ --json
61
+ ```
62
+
63
+ ## Important Notes
64
+
65
+ - **Source org auto-resolution**: Accepts org ID (starts with 00D) or username/alias — aliases are automatically resolved to org IDs
66
+ - **Description best practice**: Include version control reference (git tag, commit SHA) to track snapshot contents
67
+ - **Asynchronous creation**: Snapshot creation happens asynchronously — use `sf org get snapshot` to check status
@@ -0,0 +1,164 @@
1
+ # Creating Scratch Orgs
2
+
3
+ Detailed workflow for creating Salesforce scratch orgs using `sf org create scratch`. Supports four creation methods: definition file, edition flag, snapshot, and org shape.
4
+
5
+ ---
6
+
7
+ ## Required Inputs
8
+
9
+ Gather or infer before proceeding:
10
+
11
+ - **Dev Hub org**: Username or alias of authenticated Dev Hub (or use default from `target-dev-hub` config)
12
+ - **Creation method**: Which approach to use (see Workflow step 1)
13
+ - **Alias**: Optional but recommended for easy reference
14
+
15
+ Optional but commonly used:
16
+ - **Duration**: Days before org expires (default: 7, max: 30)
17
+ - **Set as default**: Whether to make this the default org
18
+ - **Source tracking**: Whether to enable (default: yes, disable for CI/CD performance)
19
+
20
+ ---
21
+
22
+ ## Workflow
23
+
24
+ ### 1. Identify creation method
25
+
26
+ Determine which approach based on user request:
27
+
28
+ | Method | When to use | Required flags |
29
+ |--------|-------------|----------------|
30
+ | Definition file | User provides config file or needs org features/settings | `--definition-file <path>` |
31
+ | Edition only | Quick simple org, no special config needed | `--edition <edition>` |
32
+ | Snapshot | Clone from existing snapshot | `--snapshot <name>` |
33
+ | Org shape | Mimic another org's structure | `--source-org <id>` |
34
+
35
+ **Mutually exclusive**: `--edition`, `--snapshot`, and `--source-org` cannot be combined.
36
+
37
+ ### 2. Verify Dev Hub authentication
38
+
39
+ Check if Dev Hub is authenticated:
40
+ - If `--target-dev-hub` not provided, check `sf config get target-dev-hub`
41
+ - If no Dev Hub configured, prompt user to authenticate: `sf org login web --set-default-dev-hub`
42
+
43
+ ### 3. Build the command
44
+
45
+ Construct based on creation method:
46
+
47
+ **Definition file approach:**
48
+ ```bash
49
+ sf org create scratch --definition-file <path> --target-dev-hub <alias> --alias <name> --json
50
+ ```
51
+
52
+ **Edition-only approach:**
53
+ ```bash
54
+ sf org create scratch --edition developer --target-dev-hub <alias> --alias <name> --json
55
+ ```
56
+
57
+ **Snapshot approach:**
58
+ ```bash
59
+ sf org create scratch --snapshot <name> --target-dev-hub <alias> --alias <name> --json
60
+ ```
61
+
62
+ **Org shape approach:**
63
+ ```bash
64
+ sf org create scratch --source-org <id> --target-dev-hub <alias> --alias <name> --json
65
+ ```
66
+
67
+ **Common optional flags:**
68
+ - `--duration-days <days>` — Set expiration (default 7, max 30)
69
+ - `--set-default` — Make this the default org
70
+ - `--no-track-source` — Disable source tracking for CI/CD performance
71
+ - `--wait <minutes>` — Wait for completion (default 5 minutes, min 2)
72
+ - `--async` — Return immediately, don't wait for completion
73
+
74
+ **⚠️ CRITICAL: This is a BLOCKING command**
75
+ - The command **WAITS** until the scratch org is fully created (or times out)
76
+ - When the command returns success, the org is **READY TO USE** — do NOT poll with `sf org list` waiting for it to become ready
77
+ - The JSON response with `username` and `orgId` means creation is **COMPLETE**
78
+ - Only use `--async` if you want to check status later with `sf org resume scratch`
79
+ - **Note**: SKILL.md Step 4 requires running `sf org list --json` once after creation for artifact collection (not for polling status)
80
+
81
+ **Before executing, verify:**
82
+ - [ ] `--json` flag is present in the command
83
+ - [ ] At least ONE of `--edition`, `--snapshot`, `--source-org`, or `--definition-file` is specified (flags can override definition file values)
84
+ - [ ] `--snapshot` and `--source-org` are not combined (mutually exclusive)
85
+ - [ ] `--target-dev-hub` is resolved (either in command or from config)
86
+
87
+ ### 4. Handle async creation
88
+
89
+ If `--async` or `--wait` timeout occurs:
90
+ - CLI displays: "The scratch org did not complete within your wait time."
91
+ - CLI automatically shows the resume command with Request ID
92
+ - Timeout exits with code 69
93
+ - User can resume with the displayed command: `sf org resume scratch --job-id <request-id> --json`
94
+
95
+ ### 5. Report result
96
+
97
+ When the command returns, check JSON response. If it contains `username` and `orgId`, the org is **COMPLETE and READY**. Do NOT run additional commands to verify completion.
98
+
99
+ Successful creation returns:
100
+ ```json
101
+ {
102
+ "username": "test-...@example.com",
103
+ "orgId": "00D...",
104
+ "scratchOrgInfo": {
105
+ "Id": "2SR...",
106
+ "ScratchOrg": "00D...",
107
+ "SignupUsername": "test-...@example.com"
108
+ }
109
+ }
110
+ ```
111
+
112
+ This JSON response means: org is created, authenticated, and ready for `sf org open`, `sf project deploy`, or any other commands.
113
+
114
+ ---
115
+
116
+ ## Rules / Constraints
117
+
118
+ | Constraint | Rationale |
119
+ |-----------|-----------|
120
+ | Always include `--json` flag | Returns structured output for parsing success/failure |
121
+ | **Command blocks until completion — do NOT poll for status** | The command waits until the org is created (or times out). When it returns with `username` and `orgId` in JSON, the org is ready. Do NOT poll repeatedly with `sf org list` waiting for it to become ready — the command already waited for you. Only exception: if using `--async` flag or command timed out (exit code 69), then use `sf org resume scratch` to check status. **Note**: SKILL.md Step 4 requires a single `sf org list --json` call after creation for artifact collection (not polling) |
122
+ | Dev Hub must be authenticated | Scratch org creation requires Dev Hub access |
123
+ | `--edition`, `--snapshot`, `--source-org` are mutually exclusive | Only one creation source allowed per command |
124
+ | Definition file overrides can use flags | Flags like `--edition`, `--name`, `--username`, `--release`, `--admin-email` override definition file values |
125
+ | Snapshot requires same Dev Hub | Snapshot must be created in the same Dev Hub you're using |
126
+ | Duration max is 30 days | Platform limit for scratch org expiration |
127
+ | Source tracking enabled by default | Disable with `--no-track-source` only for CI/CD or performance needs |
128
+
129
+ ---
130
+
131
+ ## Troubleshooting
132
+
133
+ | Issue | Resolution |
134
+ |-------|------------|
135
+ | `No default Dev Hub org found` | Authenticate Dev Hub with `sf org login web --set-default-dev-hub` or specify `--target-dev-hub` |
136
+ | `NamedOrgNotFoundError` on Dev Hub | Dev Hub org is not authenticated — run `sf org login web` |
137
+ | `edition value must be one of` | Invalid edition specified — use developer, enterprise, group, professional, or partner variants |
138
+ | `Snapshot not found` | Snapshot doesn't exist in this Dev Hub — run `sf org list snapshot` to see available |
139
+ | `sourceOrg value must be 15 or 18 characters` | Org shape ID format incorrect — use output from `sf org list shape` |
140
+ | `The org could not be created` | Generic creation failure — check Dev Hub limits, licensing, or try again |
141
+ | Timeout during creation (exit code 69) | Command timed out waiting for org. CLI displays the resume command with Request ID. User can run the displayed command or increase `--wait` time (min 2 minutes) for next attempt |
142
+ | `Definition file not found` | Path to definition file is incorrect — verify file exists |
143
+ | Partner editions unavailable | Partner editions only work if Dev Hub is a Partner Business Org |
144
+
145
+ ---
146
+
147
+ ## Output Expectations
148
+
149
+ Deliverables:
150
+ - **Created scratch org**: Authenticated and ready to use
151
+ - **JSON response**: Contains `username`, `orgId`, `scratchOrgInfo` with Request ID
152
+ - **Local auth info**: Stored in `.sf/` directory for future CLI commands
153
+
154
+ If `--async` used or timeout occurs:
155
+ - **Request ID**: Returned in `scratchOrgInfo.Id` (format: `2SR...`)
156
+ - **Resume command**: `sf org resume scratch --job-id <request-id> --json`
157
+ - **Timeout exit code**: 69
158
+
159
+ ---
160
+
161
+ ## Additional Resources
162
+
163
+ - See `definition_file_options.md` for org features, settings, and configuration templates
164
+ - See `edition_types.md` for available edition types and when to use each