--- name: platform-policy-rule-generate description: "Use this skill when authoring PolicyRuleDefinition and PolicyRuleDefinitionSet metadata XML for the Salesforce Enforce-O-Matic MDAPI (Data Cloud governance policies), or when editing *.policyRuleDefinition / *.policyRuleDefinitionSet files. Covers the category decision tree, full schema for all policy variants (ACCESS, GOVERNANCE, RECORD, TRANSFORM), UI-compatibility rules for the Data Governance Policy Builder, and validation guardrails. Do NOT use this skill for UserAccessPolicy, AccessPolicy, SharingRules, PermissionSet, or any non-Enforce-O-Matic access-control metadata — those have their own types and live outside the PolicyRuleDefinition schema." metadata: version: "1.0" minApiVersion: "64.0" cliTools: - tool: ["sf"] semver: ">=2.0.0" --- # Authoring Policy Rule Definitions **Gating:** `@WsdlGuard("EnforceOMatic.orgCanUsePolicyRuleMDAPI")` = `OrgPermissions.EnforceOMatic && OrgPermissions.PolicyRuleMDAPI` **Min API version:** 64.0 (66.0 for conditions using `PolicyJsonExpression`) > **For human maintainers (not the agent):** the Java source-of-truth lives at `enforce-o-matic-impl/java/src/enforce/o/matic/metadata/` and reference fixtures at `enforce-o-matic-impl/test/func/filemetadata//`. The agent should rely on the templates and reference docs in this skill bundle — those impl paths are not readable from the Vibes/MCP runtime. This skill covers the **on-disk metadata XML format** for authoring policies. Use it whenever a task asks to write a `*.policyRuleDefinition` or `*.policyRuleDefinitionSet` file, add a fixture under `test/func/filemetadata/`, or ship a metadata package. The runtime side (RuleProvider, hooks) is out of scope. --- > **Eval coverage:** This skill is exercised by the team's ADK eval framework, not by `tests/evals/` under the skill directory. Five datasets covering the ACCESS / GOVERNANCE / RECORD / TRANSFORM variants live in `packages/adk-eval/eval/domains/platform-policy-rule-generate/datasets/`. ## 1. Package Layout A deployable package always contains: ```text / package.xml policyRuleDefinitionSets/.policyRuleDefinitionSet policyRuleDefinitions/.policyRuleDefinition ``` `package.xml` template (use `[ftest]` for ftests, `64.0` or higher for real orgs): ```xml Rule0 PolicyRuleDefinition Set1 PolicyRuleDefinitionSet 64.0 ``` --- ## 2. PolicyRuleDefinitionSet Schema ```xml Optional free text false true ``` | Element | Req | Notes | |---------|-----|-------| | `