forcedotcom/sf-skills / skills/platform-policy-rule-generate
platform-policy-rule-generate
VerifiedTHE skill for creating a Data Cloud / Data Governance access policy — authors and deploys a PolicyRuleDefinitionSet + PolicyRuleDefinition pair (CRUD) covering OLS, FLS, RLS, masking/transform, and tag/classification-based access for the DATACLOUD or ALL consumer. TRIGGER when the user wants to create/write/author a Data Cloud or Data Governance policy, access policy, or policy rule, or to grant access to a Data Cloud object THROUGH A POLICY — a Data Cloud policy-create request routes here, not to the tag/classification surface. Resolves every reference via Data 360 MCP. SCOPE: Data Cloud policies only (not Security Center, DSAR, or User Access Policies). DO NOT TRIGGER to create tags/classifications, or to grant object/dataspace access via a PERMISSION SET / RBAC grant (use platform-dataspace-access-configure). For a vague object-access ask, surface both skills and ASK the permission-set way vs the policy way; if unsure the object is Data Cloud, ask which first.
references/condition-model.md
View on GitHub# Condition Model
Each `<conditions>` element is a comparison:
```text
condition = left operand + operator + right operand
```
The XML does not contain literal `<left>` or `<right>` elements. The operand type determines which elements represent each side.
| Logical part | XML representation |
|---|---|
| Resource left operand | `resourcePath`, optionally `resourceExpression` |
| Principal left operand | `principalPath`, optionally `principalExpression` |
| Context left operand | `contextPath` |
| Comparison | `operator` |
| Right reference or literal | `policyRuleValueSet` |
| Right record/domain value | `valueDomain` |
| Right principal-derived value | `valuePrincipalPath` |
| Clause polarity | `clause` is always `WHEN`, inside `whenPolicyRuleDefinitionClauseConjunction` |
Every condition must be constructed in this order:
1. Use the `whenPolicyRuleDefinitionClauseConjunction` wrapper. Never author `unlessPolicyRuleDefinitionClauseConjunction`: the Data Governance UI has no UNLESS section and drops it on save. Express "unless X" as a `WHEN` condition with the negated operator (`ASSIGNED_PERMISSIONS_PATH CONTAINS_NONE`, `TAG CONTAINS_NONE`, `RECORDFIELD NOT_EQUALS`); see `policy-shapes.md` "Deny unless".
2. Set `<clause>` to `WHEN`.
3. Select the left path. Most conditions use one of `resourcePath`, `principalPath`, or `contextPath`; a record-field-to-principal comparison uses both `resourcePath=RECORDFIELD` and a principal expression.
4. Add a `resourceExpression` or `principalExpression` if the selected left operand requires an expression.
5. Select the operator valid for that operand.
6. Add the right-side representation required by the shape. Most conditions use one of `policyRuleValueSet`, `valueDomain`, or `valuePrincipalPath`; a record-field-to-principal comparison uses `valueDomain` and `valuePrincipalPath` together.
Example: principal has a permission.
```xml
<conditions>
<clause>WHEN</clause>
<operator>CONTAINS_ANY</operator>
<policyRuleValueSet>
<valueReference>cust_perm1</valueReference>
<valueReferenceType>CUSTOM_PERMISSION</valueReferenceType>
</policyRuleValueSet>
<principalPath>ASSIGNED_PERMISSIONS_PATH</principalPath>
</conditions>
```
This means: left operand `principal.assignedPermissions`, operator `CONTAINS_ANY`, right operand custom permission `cust_perm1`.
For FLS and masking, condition 1 must be `resourcePath=ENTITYTYPE`, `operator=IS`, and `valueText=FIELD`. OLS instead begins with two entity-type conditions for `OBJECT` and `FIELD`, grouped with `OR`.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |