platform-permission-set-generate
forcedotcom/sf-skills
Generate correct, deployable Salesforce permission set metadata with object, field, and user permissions.
What is platform-permission-set-generate?
Generates valid PermissionSet XML metadata for Salesforce with CRUD permissions, field-level security, user permissions, and app/tab visibility. Use this when creating or editing permission sets, configuring object access, or deploying permission set changes.
- Generate PermissionSet XML with proper structure and naming conventions
- Configure object-level CRUD permissions (Create, Read, Edit, Delete)
- Set field-level security (FLS) for sensitive or custom fields
- Grant user permissions for system features and API access
- Configure app and tab visibility with correct naming (standard- prefix, __c suffix)
- Add Apex class and Visualforce page access controls
How to install platform-permission-set-generate
npx skills add https://github.com/forcedotcom/sf-skills --skill platform-permission-set-generate- Salesforce CLI installed
- Access to Salesforce org metadata
- Knowledge of object and field API names
- Understanding of required vs. optional fields in your org
How to use platform-permission-set-generate
- 1.Define core permission set properties (fullName, label, description)
- 2.Configure object permissions with appropriate CRUD settings
- 3.Add field-level security for non-required fields only
- 4.Grant user permissions for required system features
- 5.Set application and tab visibility with correct naming conventions
- 6.Optionally add Apex class, Visualforce page, and agent access
- 7.Validate against the deployment checklist before deploying
- 8.Deploy using Salesforce CLI
Use cases
- Create a permission set for sales managers with Account CRUD and report execution rights
- Configure field-level security to restrict access to sensitive fields like SSN or salary data
- Grant API access to integration users with specific object permissions
- Set up tab visibility for custom objects in a Salesforce app
- Deploy permission sets with Agentforce Employee Agent access for automation users
- Salesforce administrators managing user access and security
- Developers deploying permission set metadata to orgs
- Security teams implementing least-privilege access controls
- Salesforce architects designing permission models
platform-permission-set-generate FAQ
No. Required fields cannot have FLS and will cause deployment failure. Always confirm from object metadata that a field is not required before adding it to fieldPermissions.
Custom object tabs must include the __c suffix (e.g., MyCustomObject__c). Standard object tabs use the standard- prefix (e.g., standard-Account).
Visible: tab appears in the app and All Tabs page; Available: tab on All Tabs page only, users can customize; None: not visible at all.
No. Formula fields are read-only and cannot be set to editable in field permissions.
ViewAllData (read all records), ModifyAllData (edit all records), and ManageUsers (user administration) require security review before granting.
Full instructions (SKILL.md)
Source of truth, from forcedotcom/sf-skills.
name: platform-permission-set-generate description: "Generates correct, deployable Salesforce permission set metadata (PermissionSet XML) with object, field, user, and app permissions. Use this skill when creating or editing permission set metadata, object permissions, field-level security (FLS), tab visibility, or deploying permission sets." metadata: version: "1.0" domains: ["Platform"] minApiVersion: "60.0"
When to Use This Skill
Use when generating or editing permission set metadata, or when granting object, field, user, and app permissions.
Step 1: Define Core Properties
Start by defining the required permission set properties:
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<fullName>YourPermissionSetName</fullName>
<label>Display Name for Administrators</label>
<description>Clear description of purpose and intended audience</description>
</PermissionSet>
Naming conventions:
- Use descriptive API names (e.g.,
Sales_Manager_Access)
Step 2: Configure Object Permissions
Add CRUD permissions for standard and custom objects:
<objectPermissions>
<allowCreate>true</allowCreate>
<allowRead>true</allowRead>
<allowEdit>true</allowEdit>
<allowDelete>false</allowDelete>
<modifyAllRecords>false</modifyAllRecords>
<viewAllRecords>false</viewAllRecords>
<viewAllFields>false</viewAllFields>
<object>Account</object>
</objectPermissions>
Step 3: Set Field-Level Security
Define field permissions for sensitive or custom fields:
<fieldPermissions>
<editable>true</editable>
<readable>true</readable>
<field>Account.SSN__c</field>
</fieldPermissions>
Important:
- Required fields must NEVER appear in list of field permissions. Granting field-level security on required fields is not allowed by the platform and will cause deployment failure.
- Before adding any field, confirm from the object metadata that the field exists and is not required
- A field is required when its metadata contains
<required>true</required>: - Formula fields cannot be editable
- Master-detail fields are required fields on the child (detail) object
<fields>
<fullName>FieldName__c</fullName>
<required>true</required>
</fields>
- Use format
ObjectName.FieldNamefor field references - Set both readable and editable to true when the user needs edit access; editable implies readable
- If all fields should be visible, can alternatively enable the "viewAllFields" object permission
Step 4: Grant User Permissions
Add system-level permissions for features and capabilities:
<userPermissions>
<enabled>true</enabled>
<name>ApiEnabled</name>
</userPermissions>
<userPermissions>
<enabled>true</enabled>
<name>RunReports</name>
</userPermissions>
Common permissions:
ApiEnabled: API accessViewSetup: View Setup menuManageUsers: User managementRunReports: Report execution
Security review required for:
ViewAllData: Read all recordsModifyAllData: Edit all recordsManageUsers: User administration
Step 5: Configure App and Tab Visibility
Make applications and tabs visible to users:
<applicationVisibilities>
<application>Sales_Console</application>
<visible>true</visible>
</applicationVisibilities>
<tabSettings>
<tab>CustomTab__c</tab>
<visibility>Visible</visibility>
</tabSettings>
Application visibility options:
- <visible> can be true or false
Tab visibility options:
Visible: The tab is available on the All Tabs page and appears in the visible tabs for its associated app. Can be customized.Available: The tab is available on the All Tabs page. Individual users can customize their display to make the tab visible in any appNone: Not visible
CRITICAL - Tab Naming:
- Custom object tabs: MUST include the __c suffix (e.g., MyCustomObject__c)
- Standard object tabs: Use the object name with "standard-" prefix (e.g., standard-Account, standard-Contact)
- The tab name matches the object's API name exactly
Step 6: Add Apex and Visualforce Access (Optional)
Grant access to custom code:
<classAccesses>
<apexClass>CustomController</apexClass>
<enabled>true</enabled>
</classAccesses>
<pageAccesses>
<apexPage>CustomPage</apexPage>
<enabled>true</enabled>
</pageAccesses>
Step 7: Set License and Record Type Settings (Optional)
Specify license requirements and record type visibility:
<license>Salesforce</license>
<hasActivationRequired>false</hasActivationRequired>
<recordTypeVisibilities>
<recordType>Account.Business</recordType>
<visible>true</visible>
<default>true</default>
</recordTypeVisibilities>
Step 8: Set Agent Access (Optional)
Enable access to Agentforce Employee Agents for users assigned to this permission set:
<agentAccesses> <agentName>Sales_Assistant_Agent</agentName> <enabled>true</enabled> </agentAccesses>Field requirements:
- agentName (Required): The developer name of the employee agent
- enabled (Required): Set to true to grant access, false to deny
Important:
- Agent names must match existing Agentforce Employee Agent developer names
Validation Checklist
Before deploying, verify:
- fullName, label, description set
- Permissions follow least privilege
- No required fields in
<fieldPermissions> - No duplicate permissions
- No lengthy comments
What Causes Deployment Failure
- Field permissions on required fields: Any required field in
<fieldPermissions>fails deployment. Required fields cannot have FLS; omit them entirely. Always confirm from object/field metadata that a field exists and is not required—never assume. - Incorrect API names: Using the wrong name or missing suffixes (e.g. missing
__cfor custom objects, fields, tabs) cause failure.
Deployment
Deploy using Salesforce CLI
Related skills
More from forcedotcom/sf-skills and the wider catalog.

platform-policy-rule-generate
Author Salesforce Data Cloud PolicyRuleDefinition and PolicyRuleDefinitionSet metadata XML for governance policies.

platform-quick-deploy
Deploy validated Salesforce metadata to Production without re-running tests.

platform-report-generate
Generate and validate Salesforce Lightning Report metadata (.report-meta.xml) for tabular, summary, matrix, and joined reports.

platform-sandbox-configure
Manage Salesforce sandbox lifecycle—create, refresh, activate, and delete sandboxes via Connect REST API.

platform-sharing-owd-configure
Retrieve and update Organization-Wide Default (OWD) sharing settings for Salesforce objects.

platform-sharing-rules-generate
Create, edit, and delete Salesforce Sharing Rules metadata for record-level access control.