@salesforce/afv-skills 1.37.0 → 1.38.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 (247) hide show
  1. package/package.json +1 -1
  2. package/skills/agentforce-generate/README.md +20 -3
  3. package/skills/agentforce-generate/SKILL.md +253 -440
  4. package/skills/agentforce-generate/assets/agent-spec-template.md +6 -2
  5. package/skills/agentforce-generate/assets/agents/order-service.agent +16 -12
  6. package/skills/agentforce-generate/assets/agents/production-faq.agent +4 -4
  7. package/skills/agentforce-generate/assets/agents/router-first.agent +5 -5
  8. package/skills/agentforce-generate/assets/agents/template-single-subagent.agent +4 -4
  9. package/skills/agentforce-generate/assets/agents/verification-gate.agent +8 -6
  10. package/skills/agentforce-generate/assets/agents/voice-knowledge-grounded.agent +9 -9
  11. package/skills/agentforce-generate/assets/agents/voice-service-agent.agent +7 -7
  12. package/skills/agentforce-generate/assets/patterns/README.md +3 -3
  13. package/skills/agentforce-generate/assets/patterns/action-callbacks.agent +5 -5
  14. package/skills/agentforce-generate/assets/patterns/advanced-input-bindings.agent +6 -8
  15. package/skills/agentforce-generate/assets/patterns/bidirectional-routing.agent +11 -13
  16. package/skills/agentforce-generate/assets/patterns/critical-input-collection.agent +11 -16
  17. package/skills/agentforce-generate/assets/patterns/lifecycle-events.agent +2 -3
  18. package/skills/agentforce-generate/assets/patterns/llm-controlled-actions.agent +6 -7
  19. package/skills/agentforce-generate/assets/patterns/open-gate-routing.agent +3 -3
  20. package/skills/agentforce-generate/assets/patterns/prompt-template-action.agent +14 -19
  21. package/skills/agentforce-generate/assets/patterns/system-instruction-overrides.agent +11 -20
  22. package/skills/agentforce-generate/references/actions-reference.md +2 -2
  23. package/skills/agentforce-generate/references/agent-audit-and-repair.md +135 -0
  24. package/skills/agentforce-generate/references/agent-audit-candidate-verification.md +160 -0
  25. package/skills/agentforce-generate/references/agent-audit-diagnostic-catalog.md +156 -0
  26. package/skills/agentforce-generate/references/agent-audit-diagnostics-actions-state.md +176 -0
  27. package/skills/agentforce-generate/references/agent-audit-diagnostics-architecture-evaluation.md +68 -0
  28. package/skills/agentforce-generate/references/agent-audit-diagnostics-instructions-routing.md +283 -0
  29. package/skills/agentforce-generate/references/agent-audit-evaluation-loop.md +191 -0
  30. package/skills/agentforce-generate/references/agent-audit-repair-report.md +143 -0
  31. package/skills/agentforce-generate/references/agent-audit-scope-path-review.md +180 -0
  32. package/skills/agentforce-generate/references/agent-design-and-spec-creation.md +105 -59
  33. package/skills/agentforce-generate/references/agent-script-core-language.md +144 -61
  34. package/skills/agentforce-generate/references/agent-subagent-map-diagrams.md +33 -23
  35. package/skills/agentforce-generate/references/agent-validation-and-debugging.md +37 -11
  36. package/skills/agentforce-generate/references/agentscript-toolchain.md +112 -0
  37. package/skills/agentforce-generate/references/architecture-patterns.md +81 -18
  38. package/skills/agentforce-generate/references/common-control-flow-pitfalls.md +255 -0
  39. package/skills/agentforce-generate/references/control-flow-actions-sequencing.md +198 -0
  40. package/skills/agentforce-generate/references/control-flow-lifecycle-side-effects.md +87 -0
  41. package/skills/agentforce-generate/references/examples.md +22 -22
  42. package/skills/agentforce-generate/references/instruction-resolution.md +123 -83
  43. package/skills/agentforce-generate/references/known-issues.md +1 -2
  44. package/skills/agentforce-generate/references/optimization-pattern-1-data-flow.md +4 -0
  45. package/skills/agentforce-generate/references/optimization-pattern-2-deterministic-logic.md +33 -0
  46. package/skills/agentforce-generate/references/optimization-pattern-3-reference-syntax.md +32 -3
  47. package/skills/agentforce-generate/references/optimization-pattern-4-escalation.md +2 -2
  48. package/skills/agentforce-generate/references/patterns-by-requirement.md +3 -1
  49. package/skills/agentforce-generate/references/posture-and-determinism.md +103 -22
  50. package/skills/agentforce-generate/references/reference-map.md +19 -3
  51. package/skills/agentforce-generate/references/scoring-rubric.md +1 -1
  52. package/skills/agentforce-generate/references/voice-latency-heuristics.md +4 -0
  53. package/skills/agentforce-generate/references/voice-modality-reference.md +4 -4
  54. package/skills/agentforce-generate/references/zen-of-agentscript.md +139 -23
  55. package/skills/agentforce-generate/scripts/agentscript-sdk-loader.mjs +133 -0
  56. package/skills/agentforce-generate/scripts/index-agent.mjs +141 -0
  57. package/skills/agentforce-generate/scripts/setup-agentscript-sdk.mjs +337 -0
  58. package/skills/automation-sandbox-post-copy-config-generate/SKILL.md +1 -1
  59. package/skills/automation-sandbox-post-copy-configure/SKILL.md +433 -0
  60. package/skills/automation-sandbox-post-copy-configure/assets/api_request_templates.json +89 -0
  61. package/skills/automation-sandbox-post-copy-configure/examples/sample_config_input.json +40 -0
  62. package/skills/automation-sandbox-post-copy-configure/examples/sample_execution_summary.md +79 -0
  63. package/skills/automation-sandbox-post-copy-configure/references/api_endpoints.md +273 -0
  64. package/skills/automation-sandbox-post-copy-configure/references/authentication.md +94 -0
  65. package/skills/automation-sandbox-post-copy-configure/references/execution_phasing.md +93 -0
  66. package/skills/automation-sandbox-post-copy-configure/references/rules_gotchas.md +35 -0
  67. package/skills/automation-sandbox-post-copy-configure/scripts/classify-patch-result.mjs +88 -0
  68. package/skills/automation-sandbox-post-copy-configure/scripts/map-metadata-key.mjs +98 -0
  69. package/skills/automation-sandbox-post-copy-configure/scripts/plan-phases.mjs +98 -0
  70. package/skills/automation-sandbox-post-copy-configure/scripts/resolve-target-org.mjs +56 -0
  71. package/skills/design-systems-slds-validate/SKILL.md +14 -13
  72. package/skills/dx-code-analyzer-custom-rule-create/examples/xpath-examples.md +1 -1
  73. package/skills/dx-code-analyzer-custom-rule-create/references/xpath-patterns-security.md +1 -1
  74. package/skills/dx-org-devhub-configure/SKILL.md +268 -0
  75. package/skills/dx-org-devhub-configure/examples/status-output.md +39 -0
  76. package/skills/dx-org-devhub-configure/scripts/devhub.sh +650 -0
  77. package/skills/dx-org-devhub-configure/scripts/test-devhub.sh +116 -0
  78. package/skills/dx-org-manage/SKILL.md +135 -42
  79. package/skills/dx-org-manage/assets/derive-alias.sh +95 -0
  80. package/skills/dx-org-manage/assets/scratch-def.seed.json +6 -0
  81. package/skills/dx-org-manage/examples/README.md +1 -1
  82. package/skills/dx-org-manage/examples/scratch-orgs/delete_output.json +8 -0
  83. package/skills/dx-org-manage/examples/scratch-orgs/display_output.json +23 -0
  84. package/skills/dx-org-manage/examples/scratch-orgs/list_output.json +58 -0
  85. package/skills/dx-org-manage/examples/scratch-orgs/resume_output.json +38 -0
  86. package/skills/dx-org-manage/examples/scratch-orgs/success_definition_file.json +1 -1
  87. package/skills/dx-org-manage/examples/scratch-orgs/success_edition.json +1 -1
  88. package/skills/dx-org-manage/examples/scratch-orgs/success_shape.json +41 -0
  89. package/skills/dx-org-manage/examples/scratch-orgs/success_snapshot.json +1 -1
  90. package/skills/dx-org-manage/examples/snapshots/error_output.json +3 -3
  91. package/skills/dx-org-manage/references/creating-scratch-org.md +2 -2
  92. package/skills/dx-org-manage/references/creating-snapshot.md +1 -2
  93. package/skills/dx-org-manage/references/definition_file_options.md +24 -0
  94. package/skills/dx-org-manage/references/edition_types.md +10 -8
  95. package/skills/dx-org-manage/references/opening-org.md +11 -12
  96. package/skills/dx-org-manage/references/scratch-org-create.md +303 -0
  97. package/skills/dx-org-manage/references/scratch-org-operations.md +135 -0
  98. package/skills/experience-aura-lwc-migrate/SKILL.md +120 -0
  99. package/skills/experience-aura-lwc-migrate/references/aura-api-expert.md +170 -0
  100. package/skills/experience-aura-lwc-migrate/references/aura-data-expert.md +172 -0
  101. package/skills/experience-aura-lwc-migrate/references/aura-migration-guidelines.md +299 -0
  102. package/skills/experience-aura-lwc-migrate/references/aura-prd-framework.md +79 -0
  103. package/skills/experience-aura-lwc-migrate/references/aura-redundant-code-expert.md +24 -0
  104. package/skills/experience-aura-lwc-migrate/references/aura-reference-expert.md +140 -0
  105. package/skills/experience-aura-lwc-migrate/references/aura-resolver-expert.md +115 -0
  106. package/skills/experience-aura-lwc-migrate/references/aura-slots-expert.md +67 -0
  107. package/skills/experience-aura-lwc-migrate/references/aura-style-expert.md +62 -0
  108. package/skills/experience-aura-lwc-migrate/references/aura-to-lwc-completeness-checklist.md +188 -0
  109. package/skills/experience-aura-lwc-migrate/references/aura-values-expert.md +67 -0
  110. package/skills/experience-content-media-search/SKILL.md +17 -12
  111. package/skills/experience-content-media-stock-image-search/SKILL.md +192 -0
  112. package/skills/experience-content-media-stock-image-search/scripts/download-stock-image.py +102 -0
  113. package/skills/experience-lds-best-practices-apply/SKILL.md +245 -0
  114. package/skills/experience-lds-best-practices-apply/references/adapter-apis.md +1640 -0
  115. package/skills/experience-lds-best-practices-apply/references/lds-data-consistency.md +126 -0
  116. package/skills/experience-lds-best-practices-apply/references/lds-expert.md +429 -0
  117. package/skills/experience-lds-best-practices-apply/references/lds-referential-integrity.md +322 -0
  118. package/skills/experience-lds-best-practices-apply/references/wire-adapter-types.md +1511 -0
  119. package/skills/experience-lds-graphql-generate/SKILL.md +222 -0
  120. package/skills/experience-lds-graphql-generate/references/generation-guide.md +236 -0
  121. package/skills/experience-lds-graphql-generate/references/generation-mutation.md +277 -0
  122. package/skills/experience-lds-graphql-generate/references/generation-query.md +237 -0
  123. package/skills/experience-lds-graphql-generate/scripts/fetch-lds-graphql-schema.sh +230 -0
  124. package/skills/experience-lds-graphql-generate/scripts/test-lds-graphql-query.sh +128 -0
  125. package/skills/experience-lwc-accessibility-validate/SKILL.md +112 -0
  126. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-1-1-non-text-content.md +88 -0
  127. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-i-lists.md +52 -0
  128. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-ii-tables.md +106 -0
  129. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iii-form-labels.md +78 -0
  130. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-iv-regions.md +26 -0
  131. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-1-v-groups.md +66 -0
  132. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-3-5-identify-input.md +70 -0
  133. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-1-4-3-contrast.md +115 -0
  134. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-1-1-keyboard.md +47 -0
  135. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-4-link-purpose.md +39 -0
  136. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-4-6-headings-labels.md +50 -0
  137. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-1-pointer-gestures.md +54 -0
  138. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-2-pointer-cancellation.md +49 -0
  139. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-3-label-in-name.md +77 -0
  140. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-2-5-7-dragging-movement.md +45 -0
  141. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-1-on-focus.md +55 -0
  142. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-2-2-on-input.md +51 -0
  143. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-1-error-identification.md +84 -0
  144. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-2-labels-instructions.md +50 -0
  145. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-3-3-3-error-suggestion.md +64 -0
  146. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-i-name.md +105 -0
  147. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-ii-role.md +99 -0
  148. package/skills/experience-lwc-accessibility-validate/references/reviewers/sc-4-1-2-iii-value.md +97 -0
  149. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-1-1-non-text-content.md +83 -0
  150. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-1-use-of-color.md +62 -0
  151. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-10-resize-reflow.md +18 -0
  152. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-11-non-text-contrast.md +43 -0
  153. package/skills/experience-lwc-accessibility-validate/references/vision/sc-1-4-3-contrast.md +25 -0
  154. package/skills/experience-lwc-accessibility-validate/scripts/contrast-ratio.py +153 -0
  155. package/skills/experience-lwc-design-generate/SKILL.md +261 -0
  156. package/skills/experience-lwc-design-generate/references/figma-to-prd-blueprint.md +66 -0
  157. package/skills/experience-lwc-design-generate/references/prd-analysis-template.md +17 -0
  158. package/skills/experience-lwc-design-generate/scripts/check-component-name.sh +75 -0
  159. package/skills/experience-lwc-design-generate/scripts/detect-project-tools.sh +97 -0
  160. package/skills/experience-lwc-runtime-observe/SKILL.md +244 -0
  161. package/skills/experience-lwc-runtime-observe/examples/component-preview-and-dom.md +41 -0
  162. package/skills/experience-lwc-runtime-observe/scripts/extract-dom.sh +79 -0
  163. package/skills/experience-lwc-runtime-observe/scripts/open-frontdoor.sh +46 -0
  164. package/skills/experience-lwc-runtime-observe/scripts/verify-toolchain.sh +48 -0
  165. package/skills/experience-lwc-security-validate/SKILL.md +151 -0
  166. package/skills/experience-lwc-security-validate/examples/review-report.md +6 -0
  167. package/skills/experience-lwc-security-validate/examples/score-report.sarif.json +32 -0
  168. package/skills/experience-lwc-security-validate/references/lws-security-expert.md +986 -0
  169. package/skills/experience-lwc-security-validate/references/security-analysis.md +611 -0
  170. package/skills/experience-lwc-security-validate/scripts/check-lwc-import.sh +166 -0
  171. package/skills/experience-lwc-security-validate/scripts/validate-sarif.sh +131 -0
  172. package/skills/experience-ui-bundle-2gp-deploy/SKILL.md +454 -0
  173. package/skills/experience-ui-bundle-2gp-deploy/assets/CustomApplication.app-meta.xml +12 -0
  174. package/skills/experience-ui-bundle-2gp-deploy/assets/PermissionSet.permissionset-meta.xml +9 -0
  175. package/skills/experience-ui-bundle-2gp-deploy/scripts/find-bundle-package-dir.sh +53 -0
  176. package/skills/experience-ui-bundle-agentforce-client-generate/SKILL.md +104 -26
  177. package/skills/experience-ui-bundle-agentforce-client-generate/references/constraints.md +35 -24
  178. package/skills/experience-ui-bundle-agentforce-client-generate/references/examples.md +92 -1
  179. package/skills/experience-ui-bundle-agentforce-client-generate/references/style-tokens.md +2 -0
  180. package/skills/experience-ui-bundle-agentforce-client-generate/references/troubleshooting.md +14 -1
  181. package/skills/experience-ui-bundle-agentforce-client-generate/scripts/detect-framework.sh +67 -0
  182. package/skills/experience-ui-bundle-deploy/SKILL.md +83 -14
  183. package/skills/experience-ui-bundle-deploy/assets/Communities.settings-meta.xml +19 -0
  184. package/skills/experience-ui-bundle-deploy/assets/org-setup.config.template.json +5 -0
  185. package/skills/experience-ui-bundle-deploy/assets/social-login-auth-providers.apex +158 -0
  186. package/skills/experience-ui-bundle-deploy/references/config-scaffold.md +13 -1
  187. package/skills/experience-ui-bundle-deploy/references/social-login.md +179 -0
  188. package/skills/experience-ui-bundle-frontend-generate/SKILL.md +14 -0
  189. package/skills/experience-ui-bundle-mfa-configure/SKILL.md +6 -5
  190. package/skills/experience-ui-bundle-mfa-configure/references/social-login.md +15 -7
  191. package/skills/experience-ui-bundle-salesforce-data-access/SKILL.md +41 -5
  192. package/skills/experience-ui-bundle-salesforce-data-access/references/caching.md +10 -22
  193. package/skills/experience-ui-bundle-salesforce-data-access/references/graphql-hand-authoring.md +4 -19
  194. package/skills/experience-ui-bundle-salesforce-data-access/references/migration.md +5 -0
  195. package/skills/experience-ui-bundle-salesforce-data-access/references/sdk-api.md +33 -150
  196. package/skills/mobile-platform-native-capabilities-integrate/references/nfc.md +35 -0
  197. package/skills/platform-apex-generate/SKILL.md +8 -7
  198. package/skills/platform-apex-test-generate/SKILL.md +3 -1
  199. package/skills/platform-apex-test-run/SKILL.md +9 -8
  200. package/skills/platform-lightning-type-widget-coordinate/SKILL.md +1 -1
  201. package/skills/platform-lightning-type-widget-coordinate/examples/existing-lightning-type-with-widget-prompt.md +1 -1
  202. package/skills/platform-lightning-type-widget-coordinate/examples/new-lightning-type-with-widget-prompt.md +1 -1
  203. package/skills/platform-lightning-type-widget-coordinate/references/validation-gates.md +3 -3
  204. package/skills/platform-mcp-tool-widget-coordinate/SKILL.md +43 -67
  205. package/skills/platform-mcp-tool-widget-coordinate/examples/action-name-source-prompt.md +1 -2
  206. package/skills/platform-mcp-tool-widget-coordinate/examples/apex-invocable-source-prompt.md +2 -3
  207. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-list-source-prompt.md +163 -0
  208. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-single-source-prompt.md +198 -0
  209. package/skills/platform-mcp-tool-widget-coordinate/examples/pasted-tool-output-prompt.md +0 -1
  210. package/skills/platform-mcp-tool-widget-coordinate/references/build-plan-format.md +17 -11
  211. package/skills/platform-mcp-tool-widget-coordinate/references/mcp-tool-output-discovery.md +48 -15
  212. package/skills/platform-mcp-tool-widget-coordinate/references/two-clt-modeling.md +73 -10
  213. package/skills/platform-mcp-tool-widget-coordinate/references/validation-gates.md +48 -8
  214. package/skills/platform-policy-rule-generate/SKILL.md +22 -12
  215. package/skills/platform-policy-rule-generate/references/deploy-errors.md +1 -1
  216. package/skills/platform-policy-rule-generate/references/policy-schema-full.md +8 -29
  217. package/skills/platform-policy-rule-generate/references/templates-advanced.md +1 -1
  218. package/skills/platform-sharing-owd-configure/SKILL.md +20 -8
  219. package/skills/platform-sharing-owd-configure/references/access_levels.md +14 -1
  220. package/skills/platform-sharing-rules-generate/SKILL.md +67 -35
  221. package/skills/platform-sharing-rules-generate/examples/create-cases.md +16 -17
  222. package/skills/platform-sharing-rules-generate/examples/delete-cases.md +34 -79
  223. package/skills/platform-sharing-rules-generate/examples/edit-cases.md +13 -26
  224. package/skills/platform-sharing-rules-generate/scripts/count-remaining-rules.sh +33 -0
  225. package/skills/platform-widget-generate/SKILL.md +3 -5
  226. package/skills/platform-widget-generate/examples/conditional.json +18 -13
  227. package/skills/platform-widget-generate/examples/list-with-foreach.json +2 -2
  228. package/skills/platform-widget-generate/examples/single-object.json +2 -2
  229. package/skills/platform-widget-generate/references/schema-from-lightning-type.md +27 -6
  230. package/skills/platform-widget-generate/references/widget-bundle-layout.md +4 -3
  231. package/skills/service-itsm-agentic-setup-cmdb-access-assign/SKILL.md +287 -0
  232. package/skills/service-itsm-agentic-setup-cmdb-access-assign/references/mcp-invocation.md +260 -0
  233. package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/SKILL.md +252 -0
  234. package/skills/service-itsm-agentic-setup-cmdb-bundle-deploy/references/mcp-invocation.md +204 -0
  235. package/skills/service-itsm-agentic-setup-cmdb-configure/SKILL.md +259 -0
  236. package/skills/service-itsm-agentic-setup-cmdb-configure/references/mcp-invocation.md +188 -0
  237. package/skills/service-itsm-agentic-setup-cmdb-coordinate/SKILL.md +197 -0
  238. package/skills/service-itsm-agentic-setup-cmdb-coordinate/examples/output-templates.md +77 -0
  239. package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/SKILL.md +316 -0
  240. package/skills/service-itsm-agentic-setup-cmdb-discovery-configure/references/mcp-invocation.md +221 -0
  241. package/skills/service-itsm-incident-priority-configure/SKILL.md +168 -0
  242. package/skills/service-itsm-incident-priority-configure/examples/matrix-operations.md +200 -0
  243. package/skills/service-itsm-incident-priority-configure/examples/render-matrix.md +54 -0
  244. package/skills/service-itsm-incident-priority-configure/examples/seed-full-matrix.md +52 -0
  245. package/skills/service-itsm-incident-priority-configure/references/sf-cli-invocation.md +264 -0
  246. package/skills/platform-mcp-tool-widget-coordinate/examples/nested-object-source-prompt.md +0 -191
  247. package/skills/platform-policy-rule-generate/references/fixtures-index.md +0 -29
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  name: platform-sharing-rules-generate
3
- description: "Use this skill when users need to create, edit, delete, or manage Salesforce Sharing Rules metadata. TRIGGER when: users mention sharing rules, record sharing, criteria-based sharing, role-based sharing, guest user sharing, sharingRules, sharingCriteriaRules, sharingGuestRules, sharingOwnerRules, .sharingRules-meta.xml files, or ask to share records with specific roles or groups. Also trigger when users want to modify or remove existing sharing rules, or update sharing rule criteria or access levels. DO NOT TRIGGER when user needs permission sets or profiles (use platform-permission-set-generate), or needs object-level security rather than record-level sharing (use platform-permission-set-generate)."
3
+ description: "Use this skill when users need to get, create, edit, delete, or manage Salesforce Sharing Rules metadata. TRIGGER when: users mention sharing rules, record sharing, criteria-based sharing, role-based sharing, guest user sharing, sharingRules, sharingCriteriaRules, sharingGuestRules, sharingOwnerRules, .sharingRules-meta.xml files, or ask to share records with specific roles or groups. Also trigger when users want to retrieve or view existing sharing rules from an org, modify or remove existing sharing rules, or update sharing rule criteria or access levels. DO NOT TRIGGER when user needs permission sets or profiles (use platform-permission-set-generate), or needs object-level security rather than record-level sharing (use platform-permission-set-generate)."
4
4
  metadata:
5
- version: "1.2"
5
+ version: "1.3"
6
6
  minApiVersion: "60.0"
7
7
  relatedSkills:
8
8
  - "platform-custom-object-generate"
@@ -14,11 +14,11 @@ metadata:
14
14
 
15
15
  # Sharing Rules Generator
16
16
 
17
- Create, edit, and delete Salesforce Sharing Rules metadata to control record-level access beyond org-wide defaults. Supports criteria-based rules, role/group-based owner rules, and guest user rules for Experience Sites.
17
+ Get, create, edit, and delete Salesforce Sharing Rules metadata to control record-level access beyond org-wide defaults. Supports criteria-based rules, role/group-based owner rules, and guest user rules for Experience Sites.
18
18
 
19
19
  ## Scope
20
20
 
21
- - **In scope**: Creating, editing, and deleting `sharingCriteriaRules`, `sharingOwnerRules`, and `sharingGuestRules` metadata; retrieving existing sharing rules from an org; appending new rules to existing files; modifying rule criteria, access levels, or shared-to targets; removing rules from metadata files; configuring rules for Guest and Portal profiles.
21
+ - **In scope**: Creating, editing, deleting, and retrieving (getting) `sharingCriteriaRules`, `sharingOwnerRules`, and `sharingGuestRules` metadata; retrieving existing sharing rules from an org using the Metadata API Retrieve pattern; appending new rules to existing files; modifying rule criteria or access levels; removing rules from metadata files; configuring rules for Guest and Portal profiles.
22
22
  - **Out of scope**: Changing org-wide defaults (OWD/sharing model), creating Experience Sites, configuring permission sets or profiles (use `platform-permission-set-generate`), territory-based sharing rules.
23
23
 
24
24
  ---
@@ -27,6 +27,10 @@ Create, edit, and delete Salesforce Sharing Rules metadata to control record-lev
27
27
 
28
28
  Before proceeding, confirm with the user if not already clear:
29
29
 
30
+ ### For Get operations:
31
+ - Which object's sharing rules should be retrieved? (standard or custom object API name, or all objects)
32
+ - Which target org should the rules be retrieved from? (org alias or default)
33
+
30
34
  ### For Create operations:
31
35
  - Which object should the sharing rule apply to? (standard or custom object API name)
32
36
  - What type of rule? (criteria-based, role/group-based owner rule, or guest user rule)
@@ -36,7 +40,7 @@ Before proceeding, confirm with the user if not already clear:
36
40
 
37
41
  ### For Edit operations:
38
42
  - Which existing rule should be modified? (rule fullName or label)
39
- - What should change? (access level, shared-to target, criteria, label)
43
+ - What should change? (access level, criteria, label — note: `sharedTo` and `sharedFrom` cannot be edited in place)
40
44
 
41
45
  ### For Delete operations:
42
46
  - Which rule(s) should be removed? (rule fullName or label)
@@ -64,19 +68,23 @@ Defaults unless specified:
64
68
 
65
69
  ## Workflow
66
70
 
67
- Steps are sequential within each phase. Phase 3 branches by operation type — execute only the matching branch.
71
+ Steps are sequential within each phase. Phase 3 branches by operation type — execute only the matching branch. Phase 4 applies to create, edit, and delete only (get operations end at Phase 3).
68
72
 
69
73
  ### Phase 1 — Discover
70
74
 
71
75
  1. **Resolve the SFDX project path** — find the project's `sfdx-project.json` and identify the package directory for `sharingRules/`.
72
76
 
73
- 2. **Check for existing sharing rules** — look for `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml`. If found, read it to understand existing rules and avoid duplicates.
77
+ 2. **Always retrieve the latest sharing rules from the org** using the Metadata API Retrieve pattern:
78
+ ```bash
79
+ sf project retrieve start --metadata "SharingRules:<ObjectName>" --target-org <org>
80
+ ```
81
+ This ensures the local file reflects the current org state. Never trust a local file that may be stale — edits or deletes against a stale file can recreate rules that were already removed in the org or overwrite changes made by other users.
74
82
 
75
- 3. **If no local file exists**, retrieve from the org: `sf project retrieve start --metadata "SharingRules:<ObjectName>" --target-org <org>`
83
+ 3. **Read the retrieved file** — parse `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml` to understand existing rules and avoid duplicates.
76
84
 
77
85
  ### Phase 2 — Determine Operation and Rule Type
78
86
 
79
- 4. **Identify the operation** — determine whether the user wants to **create**, **edit**, or **delete** a sharing rule.
87
+ 4. **Identify the operation** — determine whether the user wants to **get**, **create**, **edit**, or **delete** a sharing rule.
80
88
 
81
89
  5. **Select the rule type** based on user intent. Read `references/rule-types.md` for the complete schema of each type and its required elements.
82
90
 
@@ -86,6 +94,19 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
86
94
 
87
95
  ### Phase 3 — Execute Operation
88
96
 
97
+ #### For Get:
98
+
99
+ 8a. **Use the file already retrieved in Phase 1** — the retrieve in step 2 already pulled the latest `<ObjectName>.sharingRules-meta.xml` from the org. No additional retrieve is needed.
100
+
101
+ 8b. **Read and present the retrieved rules** — parse the `.sharingRules-meta.xml` file and present the rules to the user in a readable format showing:
102
+ - Rule name (`fullName`) and label
103
+ - Rule type (criteria-based, owner-based, or guest)
104
+ - Access level
105
+ - Shared-to target
106
+ - Criteria (if applicable)
107
+
108
+ For get operations, skip Phase 4 (no write needed). The retrieve itself writes the metadata file to the local project.
109
+
89
110
  #### For Create:
90
111
 
91
112
  8a. **Construct the XML** following the schema in `references/rule-types.md`. Key structure:
@@ -99,36 +120,33 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
99
120
 
100
121
  8a. **Locate the target rule** — find the rule by `<fullName>` or `<label>` in the existing `.sharingRules-meta.xml` file.
101
122
 
102
- 8b. **Determine modifications** — identify which elements to change (e.g., `<accessLevel>`, `<sharedTo>`, `<criteriaItems>`, `<label>`) and what the new values will be. Do not write yet — all disk writes happen in Phase 5 after user confirmation.
123
+ 8b. **Gate unsupported edits** — the platform does NOT support in-place modification of `<sharedTo>` or `<sharedFrom>` elements. If the user requests a change to the sharing target or source, refuse the edit and instruct them to delete the existing rule and create a new one with the desired target. This is the same pattern used for rule-type changes (see TC-16).
124
+
125
+ 8c. **Determine modifications based on rule type**:
126
+ - **Owner-based rules (`sharingOwnerRules`)**: only `<accessLevel>` can be edited. The platform does not support modifying any other element (`sharedTo`, `sharedFrom`, `label`) on owner rules. If the user requests changes beyond access level, refuse and instruct them to delete + create.
127
+ - **Criteria-based rules (`sharingCriteriaRules`)**: supported editable elements are `<accessLevel>`, `<criteriaItems>`, `<label>`, and `<booleanFilter>`.
128
+ - **Guest rules (`sharingGuestRules`)**: supported editable elements are `<accessLevel>`, `<criteriaItems>`, `<label>`, and `<includeHVUOwnedRecords>`.
103
129
 
104
130
  #### For Delete:
105
131
 
106
132
  8a. **Locate the target rule** — find the rule by `<fullName>` or `<label>` in the existing `.sharingRules-meta.xml` file.
107
133
 
108
- 8b. **Count remaining rules** — run: `grep -c '<sharingCriteriaRules>\|<sharingOwnerRules>\|<sharingGuestRules>' <file>` to get the total rule count. If the count is 1 (only the rule being deleted), the file must be removed entirely in Phase 5. Do not write yet — all disk writes happen in Phase 5 after user confirmation.
109
-
110
- ### Phase 4 — Confirm with User CRITICAL
111
-
112
- 9. **Present a summary of changes** before writing to disk. You MUST stop and wait for user confirmation. Format the summary as:
113
-
114
- > **Operation:** Create / Edit / Delete
115
- > **Object:** `<ObjectName>`
116
- > **Rule:** `<fullName>` (`<label>`)
117
- > **Changes:** (describe what will be created/modified/removed)
118
- >
119
- > Proceed? (yes / no / edit)
134
+ 8b. **Count remaining rules** — run `scripts/count-remaining-rules.sh <file>` to get the total rule count. If the count is 1 (only the rule being deleted), the file must be removed entirely in Phase 4.
120
135
 
121
- **Do NOT write any file changes until the user explicitly confirms.** If the user says "no", abort. If the user says "edit", incorporate their feedback and re-present.
136
+ 8c. **Delegate destructive deployment to `platform-destructive-deploy`** — a normal `sf project deploy start` is additive and will NOT remove a rule from the org. Delegate to the `platform-destructive-deploy` skill with the following context:
137
+ - Metadata type: `SharingCriteriaRule`, `SharingOwnerRule`, or `SharingGuestRule` (depending on the rule type)
138
+ - Member: `<ObjectName>.<RuleFullName>`
139
+ - Target org: the user's specified org
122
140
 
123
- ### Phase 5 — Write and Verify
141
+ ### Phase 4 — Write and Verify
124
142
 
125
- 10. **Apply the change** only after user confirmation:
143
+ 9. **Apply the change**:
126
144
  - **Create**: Write the file to `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml`.
127
145
  - **Edit**: Update only the elements identified in step 8b; preserve all other elements exactly as they were.
128
146
  - **Delete (rules remain)**: Write the updated file with the target rule removed.
129
147
  - **Delete (last rule)**: Remove the file `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml` entirely.
130
148
 
131
- 11. **Run the verification checklist** below and consult the examples files (`examples/create-cases.md`, `examples/edit-cases.md`, `examples/delete-cases.md`) for scenario-specific expected behaviors before presenting output.
149
+ 10. **Run the verification checklist** below and consult the examples files (`examples/create-cases.md`, `examples/edit-cases.md`, `examples/delete-cases.md`) for scenario-specific expected behaviors before presenting output.
132
150
 
133
151
  ---
134
152
 
@@ -156,16 +174,21 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
156
174
  - [ ] Do both use valid `<role>`, `<roleAndSubordinates>`, or `<group>` targets?
157
175
 
158
176
  ### Edit Operation Checks
177
+ - [ ] Was the edit against a freshly retrieved file (not a stale local copy)?
178
+ - [ ] Is the edit limited to supported fields for the rule type?
179
+ - Owner rules: only `accessLevel`
180
+ - Criteria rules: `accessLevel`, `criteriaItems`, `label`, `booleanFilter`
181
+ - Guest rules: `accessLevel`, `criteriaItems`, `label`, `includeHVUOwnedRecords`
182
+ - [ ] Was `sharedTo`/`sharedFrom` left unchanged? (if user requested that change, refuse and advise delete + create)
159
183
  - [ ] Was only the intended element modified?
160
184
  - [ ] Are all required elements still present after the edit?
161
185
  - [ ] Does the modified rule still pass the universal checks above?
162
- - [ ] Was user confirmation received before writing?
163
186
 
164
187
  ### Delete Operation Checks
165
188
  - [ ] Was the correct rule removed (matched by `<fullName>`)?
166
189
  - [ ] Is the remaining XML well-formed with proper `<SharingRules>` root?
167
190
  - [ ] If no rules remain, was the file removed entirely?
168
- - [ ] Was user confirmation received before writing?
191
+ - [ ] Was `platform-destructive-deploy` delegated to with the correct metadata type (`SharingCriteriaRule`, `SharingOwnerRule`, or `SharingGuestRule`)?
169
192
 
170
193
  ### Account-Specific Checks CRITICAL
171
194
  - [ ] If object is Account, is `<accountSettings>` present with all three sub-elements?
@@ -185,7 +208,10 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
185
208
  | Criteria field values must exist as picklist values on the org | Invalid values cause: "Picklist value does not exist" |
186
209
  | Never hardcode file paths — resolve from `sfdx-project.json` | Customer projects use custom package directories |
187
210
  | For managed package custom objects, use the full API name including namespace prefix (e.g., `ns__Object__c`) | Namespace-prefixed objects store sharing rules under the prefixed name |
188
- | Always confirm before writing changes | Prevents accidental creation, modification, or deletion of sharing rules |
211
+ | `sharedTo` and `sharedFrom` cannot be edited in place | Platform does not support modifying sharing targets — deploy will fail. Delete the rule and create a new one instead |
212
+ | Owner-based rules only support editing `accessLevel` | No other field (`label`, `sharedTo`, `sharedFrom`) can be modified on owner rules — delete and recreate instead |
213
+ | Always retrieve from the org before edit or delete | Local files may be stale; editing a stale file can recreate deleted rules or overwrite concurrent changes |
214
+ | Deleting a rule requires a destructive deployment | A normal deploy is additive — it will not remove rules from the org. Delegate to `platform-destructive-deploy` |
189
215
  | Edit must preserve unmodified elements | Changing only `accessLevel` must not alter `criteriaItems` or other fields |
190
216
  | Delete must remove the entire rule block | Partial deletion leaves invalid XML and causes deployment failures |
191
217
  | Delete last rule removes the file | An empty `<SharingRules>` root with no children is invalid metadata |
@@ -202,9 +228,12 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
202
228
  | Picklist value mismatch | Query the org for valid values before generating criteria |
203
229
  | Appending duplicates existing rule name | Check existing `<fullName>` values before writing |
204
230
  | Guest user nickname not found | Query: `SELECT CommunityNickname FROM User WHERE UserType='Guest' AND IsActive=true` |
205
- | Editing a rule that doesn't exist locally | Retrieve from org first before attempting edit |
206
- | Deleting a rule referenced by other automation | Warn the user about potential downstream impact before confirming |
231
+ | User requests edit to `sharedTo` or `sharedFrom` | Not supported — refuse the edit and instruct user to delete + create a new rule |
232
+ | User requests edit to owner rule beyond `accessLevel` | Not supported — owner rules only allow `accessLevel` edits. Refuse and instruct user to delete + create |
207
233
  | Editing changes rule type (e.g., criteria → owner) | Not supported — delete the old rule and create a new one instead |
234
+ | Local file is stale (rule deleted/changed in org) | Always retrieve fresh from org before edit or delete to avoid recreating removed rules |
235
+ | Delete deployed with normal deploy (no destructive manifest) | Rule remains in the org — delegate to `platform-destructive-deploy` for proper removal |
236
+ | Deleting a rule referenced by other automation | Warn the user about potential downstream impact |
208
237
  | Delete leaves malformed XML | Ensure proper XML structure after removal; validate the file is well-formed |
209
238
 
210
239
  ---
@@ -212,7 +241,8 @@ Steps are sequential within each phase. Phase 3 branches by operation type — e
212
241
  ## Output Expectations
213
242
 
214
243
  Deliverables:
215
- - `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml` — complete sharing rules file for the target object
244
+ - **For get operations**: `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml` — retrieved sharing rules file from the org, plus a formatted summary of all rules found
245
+ - **For create/edit/delete operations**: `<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xml` — complete sharing rules file for the target object
216
246
 
217
247
  ---
218
248
 
@@ -222,6 +252,7 @@ Deliverables:
222
252
  |------|-------------|
223
253
  | Permission set configuration | `platform-permission-set-generate` skill |
224
254
  | Custom object creation (if target object doesn't exist) | `platform-custom-object-generate` skill |
255
+ | Destructive deployment (rule deletion from org) | `platform-destructive-deploy` skill |
225
256
 
226
257
  ---
227
258
 
@@ -230,6 +261,7 @@ Deliverables:
230
261
  | File | When to read |
231
262
  |------|-------------|
232
263
  | `references/rule-types.md` | Phase 2 — before generating any rule, to get the complete XML schema for each rule type |
233
- | `examples/create-cases.md` | Phase 5, step 11 — expected behavior for create and append scenarios |
234
- | `examples/edit-cases.md` | Phase 5, step 11 — expected behavior for edit scenarios |
235
- | `examples/delete-cases.md` | Phase 5, step 11 — expected behavior for delete and confirmation flow scenarios |
264
+ | `scripts/count-remaining-rules.sh` | Phase 3, step 8b (Delete) — count sharing rule elements to determine if file should be removed |
265
+ | `examples/create-cases.md` | Phase 4, step 10 — expected behavior for create and append scenarios |
266
+ | `examples/edit-cases.md` | Phase 4, step 10 — expected behavior for edit scenarios |
267
+ | `examples/delete-cases.md` | Phase 4, step 10 — expected behavior for delete scenarios |
@@ -14,9 +14,9 @@ Structured test scenarios for create operations. Each test case defines an input
14
14
  - Criteria: `Status__c` equals `Active`
15
15
 
16
16
  **Expected behavior:**
17
- 1. Discovers SFDX project path and checks for existing `Property__c.sharingRules-meta.xml`
18
- 2. Presents confirmation summary to user and waits for approval
19
- 3. After confirmation, writes the file
17
+ 1. Retrieves the latest sharing rules from the org
18
+ 2. Checks for existing `Property__c.sharingRules-meta.xml` — no duplicates found
19
+ 3. Writes the file
20
20
 
21
21
  **Expected output:**
22
22
  ```xml
@@ -51,10 +51,9 @@ Structured test scenarios for create operations. Each test case defines an input
51
51
  - Criteria: `Published__c` equals `true`
52
52
 
53
53
  **Expected behavior:**
54
- 1. Discovers project path and checks for existing file
54
+ 1. Retrieves the latest sharing rules from the org
55
55
  2. Queries org for guest user nickname if not provided
56
- 3. Presents confirmation summary and waits for approval
57
- 4. After confirmation, writes file using `<guestUser>` (not `<role>` or `<group>`)
56
+ 3. Writes file using `<guestUser>` (not `<role>` or `<group>`)
58
57
 
59
58
  **Expected output:**
60
59
  ```xml
@@ -89,10 +88,10 @@ Structured test scenarios for create operations. Each test case defines an input
89
88
  - Access level: Edit
90
89
 
91
90
  **Expected behavior:**
92
- 1. Discovers project path, checks for existing Account sharing rules
93
- 2. Includes `<accountSettings>` with all three sub-elements defaulted to `None`
94
- 3. Presents confirmation summary and waits for approval
95
- 4. After confirmation, writes the file
91
+ 1. Retrieves the latest sharing rules from the org
92
+ 2. Checks for existing Account sharing rules
93
+ 3. Includes `<accountSettings>` with all three sub-elements defaulted to `None`
94
+ 4. Writes the file
96
95
 
97
96
  **Expected output:**
98
97
  ```xml
@@ -122,17 +121,17 @@ Structured test scenarios for create operations. Each test case defines an input
122
121
  ## TC-04: Append a rule to an existing file
123
122
 
124
123
  **Input:**
125
- - Object: `Property__c` (file already exists with TC-01's rule)
124
+ - Object: `Property__c` (org already contains TC-01's rule)
126
125
  - Rule type: criteria-based
127
126
  - Share with: group `AllAgents`
128
127
  - Access level: Edit
129
128
  - Criteria: `Price__c` greaterThan `1000000`
130
129
 
131
130
  **Expected behavior:**
132
- 1. Reads existing file and finds TC-01's rule already present
133
- 2. Does not duplicate existing rule
134
- 3. Presents confirmation showing the new rule will be appended
135
- 4. After confirmation, appends new rule inside existing `<SharingRules>` root
131
+ 1. Retrieves the latest sharing rules from the org
132
+ 2. Reads existing file and finds TC-01's rule already present
133
+ 3. Does not duplicate existing rule
134
+ 4. Appends new rule inside existing `<SharingRules>` root
136
135
 
137
136
  **Expected output:** File contains both TC-01's rule AND the new rule within the same `<SharingRules>` element.
138
137
 
@@ -141,11 +140,11 @@ Structured test scenarios for create operations. Each test case defines an input
141
140
  ## TC-17: Create rule with duplicate fullName
142
141
 
143
142
  **Input:**
144
- - Object: `Property__c` (file already contains rule `ShareActivePropertiesWithRegionalManager`)
143
+ - Object: `Property__c` (org already contains rule `ShareActivePropertiesWithRegionalManager`)
145
144
  - Create a new rule also named `ShareActivePropertiesWithRegionalManager`
146
145
 
147
146
  **Expected behavior:**
148
- 1. Reads existing file, finds duplicate `<fullName>`
147
+ 1. Retrieves from org, reads file, finds duplicate `<fullName>`
149
148
  2. Informs user of the conflict
150
149
  3. Suggests an alternative name or asks user to choose
151
150
 
@@ -1,6 +1,8 @@
1
1
  # Sharing Rules — Delete Test Cases
2
2
 
3
- Structured test scenarios for delete operations and confirmation flow. Each test case defines an input, the expected behavior, and the expected output.
3
+ Structured test scenarios for delete operations. Each test case defines an input, the expected behavior, and the expected output.
4
+
5
+ > **Important:** A normal `sf project deploy start` is additive and will NOT remove a sharing rule from the org. Deleting a rule from the org requires a destructive deployment using `destructiveChanges.xml` with the `--post-destructive-changes` flag.
4
6
 
5
7
  ---
6
8
 
@@ -11,19 +13,20 @@ Structured test scenarios for delete operations and confirmation flow. Each test
11
13
  - Delete rule: `ShareActivePropertiesWithRegionalManager`
12
14
 
13
15
  **Expected behavior:**
14
- 1. Locates the rule in the file
15
- 2. Presents confirmation:
16
- > **Operation:** Delete
17
- > **Object:** `Property__c`
18
- > **Rule:** `ShareActivePropertiesWithRegionalManager` (Share Active Properties With Regional Manager)
19
- > **Changes:** Remove this criteria-based sharing rule entirely. 1 other rule(s) will remain in the file.
20
- >
21
- > Proceed? (yes / no / edit)
22
- 3. Waits for confirmation
23
- 4. Removes the entire `<sharingCriteriaRules>` block for that rule
24
- 5. Other rules in the file remain intact
25
-
26
- **Expected output:** File retains `<SharingRules>` root and all other rules, with the deleted rule's block completely removed.
16
+ 1. Retrieves the latest sharing rules from the org
17
+ 2. Locates the rule in the retrieved file
18
+ 3. Removes the entire `<sharingCriteriaRules>` block for that rule from the local file
19
+ 4. Other rules in the file remain intact
20
+ 5. Creates `destructiveChanges.xml` with:
21
+ ```xml
22
+ <types>
23
+ <members>Property__c.ShareActivePropertiesWithRegionalManager</members>
24
+ <name>SharingCriteriaRule</name>
25
+ </types>
26
+ ```
27
+ 6. Deploys with: `sf project deploy start --manifest package.xml --post-destructive-changes destructiveChanges.xml --target-org <org>`
28
+
29
+ **Expected output:** Local file retains `<SharingRules>` root and all other rules, with the deleted rule's block completely removed. Org has the rule removed via destructive deployment.
27
30
 
28
31
  ---
29
32
 
@@ -34,35 +37,19 @@ Structured test scenarios for delete operations and confirmation flow. Each test
34
37
  - Delete rule: `SharePublishedListingsWithSiteGuest`
35
38
 
36
39
  **Expected behavior:**
37
- 1. Locates the rule — confirms it is the only rule in the file
38
- 2. Presents confirmation warning that the entire file will be removed:
39
- > **Operation:** Delete
40
- > **Object:** `Listing__c`
41
- > **Rule:** `SharePublishedListingsWithSiteGuest` (Share Published Listings With Site Guest)
42
- > **Changes:** Remove this guest sharing rule. This is the last rule — the entire file `Listing__c.sharingRules-meta.xml` will be deleted.
43
- >
44
- > Proceed? (yes / no / edit)
45
- 3. Waits for confirmation
46
- 4. Deletes the entire file
47
-
48
- **Expected output:** File `Listing__c.sharingRules-meta.xml` no longer exists.
49
-
50
- ---
51
-
52
- ## TC-11: Delete with user declining confirmation
53
-
54
- **Input:**
55
- - Object: `Account`
56
- - Delete rule: `ShareDirectorAccountsWithSalesTeam`
57
- - User response to confirmation: "no"
58
-
59
- **Expected behavior:**
60
- 1. Locates the rule
61
- 2. Presents confirmation
62
- 3. User says "no"
63
- 4. Aborts — no changes written
64
-
65
- **Expected output:** No file changes. Acknowledgment that the operation was cancelled.
40
+ 1. Retrieves the latest sharing rules from the org
41
+ 2. Locates the rule — confirms it is the only rule in the file
42
+ 3. Removes the local file entirely
43
+ 4. Creates `destructiveChanges.xml` with:
44
+ ```xml
45
+ <types>
46
+ <members>Listing__c.SharePublishedListingsWithSiteGuest</members>
47
+ <name>SharingGuestRule</name>
48
+ </types>
49
+ ```
50
+ 5. Deploys with: `sf project deploy start --manifest package.xml --post-destructive-changes destructiveChanges.xml --target-org <org>`
51
+
52
+ **Expected output:** File `Listing__c.sharingRules-meta.xml` no longer exists locally. Org has the rule removed via destructive deployment.
66
53
 
67
54
  ---
68
55
 
@@ -73,41 +60,9 @@ Structured test scenarios for delete operations and confirmation flow. Each test
73
60
  - Delete rule: `RuleThatDoesNotExist`
74
61
 
75
62
  **Expected behavior:**
76
- 1. Searches for the rule by `<fullName>` in the file
77
- 2. Rule not found — reports error
78
- 3. Lists available rules and asks user to clarify
63
+ 1. Retrieves the latest sharing rules from the org
64
+ 2. Searches for the rule by `<fullName>` in the retrieved file
65
+ 3. Rule not found — reports error
66
+ 4. Lists available rules and asks user to clarify
79
67
 
80
68
  **Expected output:** No file changes. Error message listing available rule names.
81
-
82
- ---
83
-
84
- ## Confirmation Flow Tests
85
-
86
- ### TC-13: User confirms with "yes"
87
-
88
- **Input:** Any create/edit/delete operation where user responds "yes" to confirmation.
89
-
90
- **Expected behavior:** Changes are written to disk as presented in the summary.
91
-
92
- ---
93
-
94
- ### TC-14: User responds with "edit" and provides feedback
95
-
96
- **Input:**
97
- - Create operation for a criteria rule
98
- - User responds "edit" to confirmation with: "Change the access level to Edit instead of Read"
99
-
100
- **Expected behavior:**
101
- 1. Original summary presented
102
- 2. User says "edit" with feedback
103
- 3. Incorporates feedback (changes `accessLevel` to `Edit`)
104
- 4. Re-presents updated summary
105
- 5. Waits for new confirmation before writing
106
-
107
- ---
108
-
109
- ### TC-15: User declines with "no"
110
-
111
- **Input:** Any create/edit/delete operation where user responds "no" to confirmation.
112
-
113
- **Expected behavior:** No file changes. Operation aborted with acknowledgment.
@@ -12,16 +12,9 @@ Structured test scenarios for edit operations. Each test case defines an input,
12
12
  - Change: access level from `Read` to `Edit`
13
13
 
14
14
  **Expected behavior:**
15
- 1. Locates the rule by `<fullName>` in the existing file
16
- 2. Presents confirmation showing current vs. proposed change:
17
- > **Operation:** Edit
18
- > **Object:** `Property__c`
19
- > **Rule:** `ShareActivePropertiesWithRegionalManager` (Share Active Properties With Regional Manager)
20
- > **Changes:** accessLevel: Read → Edit
21
- >
22
- > Proceed? (yes / no / edit)
23
- 3. Waits for user confirmation
24
- 4. After confirmation, modifies only `<accessLevel>` — all other elements unchanged
15
+ 1. Retrieves the latest sharing rules from the org
16
+ 2. Locates the rule by `<fullName>` in the retrieved file
17
+ 3. Modifies only `<accessLevel>` — all other elements unchanged
25
18
 
26
19
  **Expected output (changed portion):**
27
20
  ```xml
@@ -31,7 +24,7 @@ All other elements (`fullName`, `label`, `sharedTo`, `criteriaItems`, `includeRe
31
24
 
32
25
  ---
33
26
 
34
- ## TC-06: Edit shared-to target of an existing rule
27
+ ## TC-06: Edit shared-to target of an existing rule (UNSUPPORTED)
35
28
 
36
29
  **Input:**
37
30
  - Object: `Property__c`
@@ -39,18 +32,13 @@ All other elements (`fullName`, `label`, `sharedTo`, `criteriaItems`, `includeRe
39
32
  - Change: shared-to from role `RegionalManager` to group `PropertyViewers`
40
33
 
41
34
  **Expected behavior:**
42
- 1. Locates the rule in the file
43
- 2. Presents confirmation showing:
44
- > **Changes:** sharedTo: role `RegionalManager` → group `PropertyViewers`
45
- 3. Waits for confirmation
46
- 4. Replaces `<sharedTo>` content only
35
+ 1. Detects that the requested change targets `<sharedTo>`, which cannot be edited in place
36
+ 2. Refuses the edit and informs the user that the platform does not support modifying `sharedTo` or `sharedFrom` on an existing rule
37
+ 3. Suggests: delete the existing rule and create a new one with the desired sharing target
47
38
 
48
- **Expected output (changed portion):**
49
- ```xml
50
- <sharedTo>
51
- <group>PropertyViewers</group>
52
- </sharedTo>
53
- ```
39
+ **Expected output:** No file changes. Guidance to user about delete + create workflow.
40
+
41
+ > **Note:** The same restriction applies to `<sharedFrom>` on owner-based rules. Any change to the sharing source or target requires delete + create.
54
42
 
55
43
  ---
56
44
 
@@ -62,10 +50,9 @@ All other elements (`fullName`, `label`, `sharedTo`, `criteriaItems`, `includeRe
62
50
  - Change: update criteria from `Status__c equals Active` to `Status__c equals Active` AND `Region__c equals West`
63
51
 
64
52
  **Expected behavior:**
65
- 1. Locates the rule in the file
66
- 2. Presents confirmation showing current criteria vs. proposed criteria
67
- 3. Waits for confirmation
68
- 4. Replaces `<criteriaItems>` elements
53
+ 1. Retrieves the latest sharing rules from the org
54
+ 2. Locates the rule in the retrieved file
55
+ 3. Replaces `<criteriaItems>` elements
69
56
 
70
57
  **Expected output (changed portion):**
71
58
  ```xml
@@ -0,0 +1,33 @@
1
+ #!/bin/bash
2
+ # Counts remaining sharing rule elements in a .sharingRules-meta.xml file.
3
+ # Usage: count-remaining-rules.sh <file>
4
+ # Output: integer count of rule elements found
5
+ # Exit behavior: exits 0 with count; exits 1 if file not found, xmllint missing, or XML parse fails
6
+
7
+ FILE="$1"
8
+ if [ ! -f "$FILE" ]; then
9
+ echo "Error: File not found: $FILE" >&2
10
+ exit 1
11
+ fi
12
+
13
+ if ! command -v xmllint &>/dev/null; then
14
+ echo "Error: xmllint is not installed or not in PATH" >&2
15
+ exit 1
16
+ fi
17
+
18
+ XMLLINT_ERR=$(mktemp)
19
+ COUNT=$(xmllint --xpath 'count(//*[local-name()="sharingCriteriaRules" or local-name()="sharingOwnerRules" or local-name()="sharingGuestRules"])' "$FILE" 2>"$XMLLINT_ERR")
20
+ STATUS=$?
21
+ if [ $STATUS -ne 0 ]; then
22
+ echo "Error: xmllint failed to parse $FILE (exit $STATUS): $(cat "$XMLLINT_ERR")" >&2
23
+ rm -f "$XMLLINT_ERR"
24
+ exit 1
25
+ fi
26
+ rm -f "$XMLLINT_ERR"
27
+
28
+ if ! [[ "$COUNT" =~ ^[0-9]+\.?[0-9]*$ ]]; then
29
+ echo "Error: xmllint returned non-numeric output for $FILE: $COUNT" >&2
30
+ exit 1
31
+ fi
32
+
33
+ echo "${COUNT%%.*}"
@@ -2,7 +2,7 @@
2
2
  name: platform-widget-generate
3
3
  description: "Use this skill to author a complete HXL WidgetBundle (UEM body + schema.json + -meta.xml). TRIGGER when: user asks for a widget, mosaic, fragment, card, or rich UI surface for any subject, domain, feature, or entity noun; the prompt names only an entity or data shape without invoking Lightning Types, CLTs, or Apex-backed types. DO NOT TRIGGER when: the prompt explicitly says 'Lightning Type', 'CLT', 'Custom Lightning Type', 'Apex-backed type', or references '@apexClassType/...' (use platform-lightning-type-widget-coordinate); authoring a custom-LWC renderer for a Custom Lightning Type (use platform-custom-lightning-type-generate); or editing only an LWC component."
4
4
  metadata:
5
- version: "1.1"
5
+ version: "1.2"
6
6
  minApiVersion: "68.0"
7
7
  relatedSkills:
8
8
  - "platform-apex-generate"
@@ -62,7 +62,7 @@ interface Block {
62
62
  }
63
63
  ```
64
64
 
65
- The first child of `tile/widget.children` SHOULD be a single `tile/column` (or a single `tile/card`). All widget content typically goes inside that first child for predictable vertical structure across surfaces.
65
+ The first child of `tile/widget.children` SHOULD be a single `tile/column`. All widget content typically goes inside that first child for predictable vertical structure across surfaces.
66
66
 
67
67
  ---
68
68
 
@@ -103,10 +103,8 @@ These conventions cover widget *structure* — how blocks are grouped and stacke
103
103
  |---|---|---|
104
104
  | `tile/column` | Vertical stack of children | Root wrapper, and any group of blocks that should stack |
105
105
  | `tile/row` | Horizontal stack of children | Two or more blocks that belong on the same line |
106
- | `tile/card` | Visually-boxed group | A bounded section that should read as one unit |
107
106
  | `tile/spacer` | Whitespace between blocks | When extra space is needed between content groups |
108
107
 
109
- - **Sectioning:** Separate major content groups with a fresh `tile/card`-bounded section. Do not nest cards inside cards.
110
108
  - **Nesting:** Prefer flat layouts. Only nest a `tile/column` inside a `tile/row` (or vice versa) when the visual orientation actually changes for that subgroup.
111
109
  - **Authoritative palette:** the table above lists *typical* layout primitives. Always confirm a block exists by inspecting `discoverUiComponents` output — do not assume a block name from this table without seeing it in the discovery response.
112
110
 
@@ -198,7 +196,7 @@ Widgets express *intent*, not pixels. Each surface provides a default look and f
198
196
  9. **Self-validate.** Before reporting, confirm each check below and report each result individually (`pass` or `fail (<reason>)`). Do **not** summarize as a single "all passed" line — list every check so a reviewer can spot a silent skip.
199
197
  - **`schema-parses`** — `<pkgDir>/uiWidgets/<widgetName>/schema.json` parses as JSON.
200
198
  - **`schema-root-keys`** — root has `title` (string), `type: "object"`, and `properties.attributes` (object) — where `properties.attributes` carries `lightning:type: "lightning__objectType"` and a nested `properties` map. No `unevaluatedProperties: false`.
201
- - **`schema-leaf-types`** — every leaf under `properties.attributes.properties` carries a `lightning:type`. Singular nested inner-class fields appear as `lightning__objectType`; the nested shape is not redeclared.
199
+ - **`schema-leaf-types`** — every leaf under `properties.attributes.properties` carries a `lightning:type`. Singular nested inner-class fields carry `lightning:type` set to the inner Apex class reference (`@apexClassType/<namespace>__<OuterClass>$<InnerClass>`); the nested shape is not redeclared. `List<InnerClass>` fields carry `lightning:type: "lightning__listType"` with `items.lightning:type` set to the inner Apex class reference (`@apexClassType/<namespace>__<OuterClass>$<InnerClass>`), not a redeclared field map. See `references/schema-from-lightning-type.md`.
202
200
  - **`bindings-resolve`** — every `{!$attrs.X}` (or `{!$attrs.<outerField>.<innerField>}` for nested objects) in `<widgetName>.json` resolves to a property under `schema.json` `properties.attributes.properties`, and every `{!$item.X}` resolves to a `forItem` loop variable defined upstream.
203
201
  - **`body-envelope`** — `<widgetName>.json` root has `type: "lightning__agentforceWidget"` and a `contentBody` object whose `widgetBody` carries the UEM tree rooted at `tile/widget`. No node in the tree — root or non-root — carries a `type` key.
204
202
  - **`metaxml-wellformed`** — `<widgetName>.uiwidget-meta.xml` parses as well-formed XML.