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/templates-advanced.md
View on GitHub# Advanced Templates — API-only Multi-Condition, Hierarchy, Unauthorable
Each template is a verified shape from a passing test fixture. Copy, then change names/values.
---
> These examples are API-only exceptions. Do not copy them for the default UI-compatible output without explicit operator confirmation.
## API-only Multi-Condition with Custom Conjunction (AND/OR mix)
Source: `conjunctionExpressionSteelthread`
```xml
<unlessPolicyRuleDefinitionClauseConjunction>
<conditions>
<clause>UNLESS</clause>
<operator>CONTAINS_ANY</operator>
<resourcePath>TAG</resourcePath>
</conditions>
<conditions>
<clause>UNLESS</clause>
<operator>CONTAINS_NONE</operator>
<resourcePath>TAG</resourcePath>
</conditions>
<conjunctionExpression>(AND 1 2)</conjunctionExpression>
</unlessPolicyRuleDefinitionClauseConjunction>
```
> Note: `<unlessPolicyRuleDefinitionClauseConjunction>` blocks are **not UI-editable** — silently dropped on first save. Never author UNLESS; always use WHEN + negated operator (see `policy-shapes.md` "Deny unless"). This block is shown only so you can recognize it in retrieved API-only policies.
---
## Hierarchy Traversal
Source: `conditionWithHierarchy`
```xml
<conditions>
<clause>WHEN</clause>
<operator>HIERARCHICALLY_BELOW</operator>
<resourcePath>RECORDFIELD</resourcePath>
<valueDomain>testDMO__dlm:name__c</valueDomain>
<policyRuleValueSet>
<valueReference>testHierarchyRLS</valueReference>
<valueReferenceType>HIERARCHY</valueReferenceType>
</policyRuleValueSet>
</conditions>
```
> Not UI-editable (`HIERARCHICALLY_BELOW` and `valueReferenceType=HIERARCHY` are not in the UI dropdowns).
---
## IDENTIFIED_RECORD — Not Authorable via MDAPI
`IDENTIFIED_RECORD` policies cannot be authored as XML. The required `RuleContextPath.SESSION_CONSUMER_ID` is not in `RuleContextPathType`.
To author one: implement it as a runtime `RuleProvider` in the consuming service, not via MDAPI XML.
**Do not** synthesize a placeholder XML using `<contextPath>SESSION_CONSUMER_ID</contextPath>` — the value is not in `RuleContextPathType` and the deploy will fail.
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 |