Skip to main content
skill CX Codex

platform-permission-set-generate — Claude Code skill

Creates Salesforce PermissionSet XML for object, field, user, and app permissions. Use it when editing FLS, tab visibility, or permission sets for deployment.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add forcedotcom/sf-skills --skill platform-permission-set-generate -a claude-code
Open on GitHub

What platform-permission-set-generate does

This skill creates and edits PermissionSet XML with names, labels, descriptions, object CRUD permissions, field access, user permissions, application visibility, and tab settings. It can also add access to Apex classes, Visualforce pages, record types, and Agentforce Employee Agents.

It follows Salesforce API naming rules. Custom objects and tabs require the __c suffix, while standard object tabs use the standard- prefix. Field references use the ObjectName.FieldName format.

Required fields must stay out of fieldPermissions because Salesforce rejects such deployments. That makes checking object metadata before XML generation necessary. The skill targets API version 60.0.

What it helps with

  • generate PermissionSet XML with object CRUD access
  • grant access to explicitly requested object fields
  • configure application and tab visibility
  • add Apex class and Visualforce page access
  • keep required fields out of field permissions

Example prompts for the agent

  • Create PermissionSet XML for Account with read, create, and edit access.
  • Add field access for Account.SSN__c and confirm that the field is not required.
  • Configure visibility for Sales_Console and the standard-Account tab in this permission set.

How to install platform-permission-set-generate

1Skills CLI (Vercel)

npx skills add forcedotcom/sf-skills --skill platform-permission-set-generate -a claude-code

2Manually: put the files in place

~/.claude/skills/platform-permission-set-generate/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/platform-permission-set-generate/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about platform-permission-set-generate

How do I install platform-permission-set-generate in Claude Code?

Run npx skills add forcedotcom/sf-skills --skill platform-permission-set-generate -a claude-code, then run npx skills add forcedotcom/sf-skills --skill platform-permission-set-generate -a claude-code again. The skill file is located at ~/.claude/skills/platform-permission-set-generate/SKILL.md.

What does platform-permission-set-generate do?

It creates and edits Salesforce PermissionSet XML for object, field, user, app, and tab permissions. It also covers Apex, Visualforce, record type, and agent access settings.

Why are required fields excluded from fieldPermissions?

Salesforce does not allow field-level security entries for required fields, and deployment fails when they are included. Check the field metadata before adding it to the permission set.

Source text

SKILL.md · Apache-2.0
---
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:

```xml
<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:

```xml
<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:

```xml
<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

```xml
<fields>
    <fullName>FieldName__c</fullName>
    <required>true</required>
</fields>
```
- Use format `ObjectName.FieldName` for 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
- Only grant field permissions for fields the request explicitly names. Never invent a field by pattern-matching another one mentioned in the request (e.g., a request naming `BillingAddress`/`BillingCity` is not license to also add the parallel `Shipping*` fields) — an invented field can fail deployment even when the pattern-matched name looks legitimate.

## Step 4: Grant User Permissions

Add system-level permissions for features and capabilities:

```xml
<userPermissions>
    <enabled>true</enabled>
    <name>ApiEnabled</name>
</userPermissions>
<userPermissions>
    <enabled>true</enabled>
    <name>RunReports</name>
</userPermissions>
```

**Common permissions:**
- `ApiEnabled`: API access
- `ViewSetup`: View Setup menu
- `ManageUsers`: User management
- `RunReports`: Report execution

**Security review required for:**
- `ViewAllData`: Read all records
- `ModifyAllData`: Edit all records
- `ManageUsers`: User administration

## Step 5: Configure App and Tab Visibility

Make applications and tabs visible to users:

```xml
<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 app
- `None`: 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:

```xml
<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:

```xml
<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 `__c` for custom objects, fields, tabs) cause failure.
- **Invented fields:** A field permission for a field that doesn't exist on the object (including a plausible-looking one pattern-matched from another field in the request) fails deployment. Only grant field permissions for fields the request actually names.
- **Missing permission dependencies:** Some user permissions (e.g. `ModifyAllData`) fail to deploy unless their dependent permissions are also enabled. Do not add unrequested user permissions to work around a dependency error — escalate org-wide or administrative requests for security review instead.

## Deployment

Deploy using Salesforce CLI

© forcedotcom · Apache-2.0 · forcedotcom/sf-skills

Similar skills

Everything for Backend and APIs →

From the same set167

platform-soql-query Writes and tunes Salesforce SOQL/SOSL: turns a plain-language request into a query, checks selectivity and reads the query plan. CX Codex +1 6,800installs platform-apex-logs-debug This skill reads Salesforce debug logs: finds the root cause of a failure, spots governor limit hits and explains stack traces. CX Codex +1 6,800installs platform-metadata-deploy Automates Salesforce metadata deployments using sf CLI v2, enforces dry-run validations, and routes production rollouts through safe quick-deploy jobs. CX Codex +1 6,700installs platform-metadata-retrieve Pulls metadata from a Salesforce org into your local project with sf project retrieve start: all changes, a source directory, a type, a manifest or a package. CX Codex +1 6,600installs platform-docs-get Pulls official Salesforce documentation and keeps the agent answering from it instead of third-party blogs. Useful when pages are JS-heavy and a plain fetch returns an empty shell. CX Codex +1 6,500installs platform-custom-field-generate Generates and validates Salesforce CustomField metadata XML for SFDX projects. It prevents Metadata API deployment failures across relationship fields, picklists, and formulas. CX Codex +1 6,500installs platform-custom-object-generate Generates and validates Salesforce custom object XML, and keeps the object description current after field or validation rule edits. CX Codex +1 6,400installs dx-code-analyzer-run Runs Salesforce Code Analyzer over your project and works through the results: engines, categories, severities, auto-fixes. Useful ahead of an AppExchange review. CX Codex +1 6,400installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor