/dx-org-permission-set-assign
ALWAYS USE THIS SKILL to assign permission sets to org users. Assign one or more permission sets to org users using the sf org assign permset command. TRIGGER when the user asks to assign, grant, give, add, or apply permission sets to users, admins, specific orgs, or specific
$ npx -y skills add forcedotcom/sf-skills --skill dx-org-permission-set-assign --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/dx-org-permission-set-assign
Context preview
The summary Claude sees to decide when to auto-load this skill.
ALWAYS USE THIS SKILL to assign permission sets to org users. Assign one or more permission sets to org users using the sf org assign permset command. TRIGGER when the user asks to assign, grant, give, add, or apply permission sets to users, admins, specific orgs, or specific
SKILL.md
dx-org-permission-set-assign.SKILL.mdname: dx-org-permission-set-assign
description: "ALWAYS USE THIS SKILL to assign permission sets to org users. Assign one or more permission sets to org users using the sf org assign permset command. TRIGGER when the user asks to assign, grant, give, add, or apply permission sets to users, admins, specific orgs, or specific users. Supports granting permissions, giving access, and adding permission sets to default admin or specific users via --on-behalf-of. DO NOT TRIGGER for listing permission sets or checking user permissions."
metadata:
version: "1.0"
relatedSkills:
- "platform-permission-set-generate"
cliTools:
- tool: ["sf"]
semver: ">=2.0.0"dx-org-permission-set-assign
Assigns one or more permission sets to org users using `sf org assign permset`. Handles all variants: default admin user, specific org targets, multiple permission sets, and assignment to specific users.
---
Tool Restrictions
**Use ONLY the Bash tool** to execute `sf org assign permset`. Do NOT use MCP tools like `assign_permission_set` — ignore them completely.
---
Scope
- **In scope**: Assigning permission sets to users via `sf org assign permset`
- **Out of scope**: Creating permission sets (use `platform-permission-set-generate`), listing permission sets, checking user permissions
---
Required Inputs
Infer from the user's request:
- **Permission set name(s)**: Extract from user message (can be multiple)
- **Target org**: Use default unless specific alias/username mentioned
- **Target user(s)**: Default is org's default admin user; use `--on-behalf-of` if specific users mentioned
---
Workflow
1. Match user request to command in table below 2. Execute via Bash tool: `sf org assign permset` with appropriate flags and `--json` flag 3. Return result
If error occurs, check the `failures` array in JSON output for details.
Command Decision Table
| User intent | Execute via Bash tool | |-------------|---------| | Assign one permission set to default admin | `sf org assign permset --name <PermSetName> --json` | | Assign multiple permission sets to default admin | `sf org assign permset --name <PermSet1> --name <PermSet2> --json` | | Assign to specific org | `sf org assign permset --name <PermSetName> --target-org <alias> --json` | | Assign to specific user(s) | `sf org assign permset --name <PermSetName> --on-behalf-of <username1> --on-behalf-of <username2> --json` | | Assign multiple sets to specific users | `sf org assign permset --name <PermSet1> --name <PermSet2> --on-behalf-of <username1> --on-behalf-of <username2> --json` |
---
Rules / Constraints
| Constraint | Rationale | |-----------|-----------| | Always use `--json` flag | Provides structured output for reliable parsing and error handling | | Permission set names are case-sensitive | Use exact API names as they appear in the org | | Multiple `--name` flags can be combined in one command | More efficient than separate commands per permission set | | Multiple `--on-behalf-of` flags assign to multiple users | Batch assignment in single command; processed sequentially to avoid auth file collisions | | Use CLI username aliases, not Salesforce User.Alias field | The `--target-org` and `--on-behalf-of` flags expect CLI aliases set via `sf alias set`, not the User object's Alias field | | Duplicate assignments are idempotent | Re-assigning an already-assigned permission set succeeds silently | | Partial success is possible | Command can return both successes and failures in one run; non-zero exit code if any failures |
---
Gotchas
| Issue | Resolution | |-------|------------| | Permission set name with spaces | Enclose in double quotes: `--name "Permission Set Name"` | | "PermissionSet not found" error | Verify permission set exists in target org; check for typos in name | | Assignment succeeds but user doesn't see permissions | Check `<hasActivationRequired>` in permission set metadata — may need manual activation in Setup | | "User not found" error | Username/alias doesn't exist in target org — verify with `sf org display user --target-org <alias>` | | Partial success (some users succeed, others fail) | Check JSON output — command returns both `successes` and `failures` arrays; exit code will be non-zero if any failures occurred |
---
Output Expectations
The command returns JSON output with status code and result details.
See `examples/success_output.json` and `examples/error_output.json` for response structures.
---
Reference File Index
| File | When to read | |------|-------------| | `examples/success_output.json` | To understand successful assignment response structure | | `examples/error_output.json` | To handle common error scenarios | | `references/cli_flags.md` | For detailed explanation of all available flags |
Read more
name: dx-org-permission-set-assign
description: "ALWAYS USE THIS SKILL to assign permission sets to org users. Assign one or more permission sets to org users using the sf org assign permset command. TRIGGER when the user asks to assign, grant, give, add, or apply permission sets to users, admins, specific orgs, or specific users. Supports granting permissions, giving access, and adding permission sets to default admin or specific users via --on-behalf-of. DO NOT TRIGGER for listing permission sets or checking user permissions."
metadata:
version: "1.0"
relatedSkills:
- "platform-permission-set-generate"
cliTools:
- tool: ["sf"]
semver: ">=2.0.0"dx-org-permission-set-assign
Assigns one or more permission sets to org users using `sf org assign permset`. Handles all variants: default admin user, specific org targets, multiple permission sets, and assignment to specific users.
---
Tool Restrictions
**Use ONLY the Bash tool** to execute `sf org assign permset`. Do NOT use MCP tools like `assign_permission_set` — ignore them completely.
---
Scope
- **In scope**: Assigning permission sets to users via `sf org assign permset`
- **Out of scope**: Creating permission sets (use `platform-permission-set-generate`), listing permission sets, checking user permissions
---
Required Inputs
Infer from the user's request:
- **Permission set name(s)**: Extract from user message (can be multiple)
- **Target org**: Use default unless specific alias/username mentioned
- **Target user(s)**: Default is org's default admin user; use `--on-behalf-of` if specific users mentioned
---
Workflow
1. Match user request to command in table below 2. Execute via Bash tool: `sf org assign permset` with appropriate flags and `--json` flag 3. Return result
If error occurs, check the `failures` array in JSON output for details.
Command Decision Table
| User intent | Execute via Bash tool | |-------------|---------| | Assign one permission set to default admin | `sf org assign permset --name <PermSetName> --json` | | Assign multiple permission sets to default admin | `sf org assign permset --name <PermSet1> --name <PermSet2> --json` | | Assign to specific org | `sf org assign permset --name <PermSetName> --target-org <alias> --json` | | Assign to specific user(s) | `sf org assign permset --name <PermSetName> --on-behalf-of <username1> --on-behalf-of <username2> --json` | | Assign multiple sets to specific users | `sf org assign permset --name <PermSet1> --name <PermSet2> --on-behalf-of <username1> --on-behalf-of <username2> --json` |
---
Rules / Constraints
| Constraint | Rationale | |-----------|-----------| | Always use `--json` flag | Provides structured output for reliable parsing and error handling | | Permission set names are case-sensitive | Use exact API names as they appear in the org | | Multiple `--name` flags can be combined in one command | More efficient than separate commands per permission set | | Multiple `--on-behalf-of` flags assign to multiple users | Batch assignment in single command; processed sequentially to avoid auth file collisions | | Use CLI username aliases, not Salesforce User.Alias field | The `--target-org` and `--on-behalf-of` flags expect CLI aliases set via `sf alias set`, not the User object's Alias field | | Duplicate assignments are idempotent | Re-assigning an already-assigned permission set succeeds silently | | Partial success is possible | Command can return both successes and failures in one run; non-zero exit code if any failures |
---
Gotchas
| Issue | Resolution | |-------|------------| | Permission set name with spaces | Enclose in double quotes: `--name "Permission Set Name"` | | "PermissionSet not found" error | Verify permission set exists in target org; check for typos in name | | Assignment succeeds but user doesn't see permissions | Check `<hasActivationRequired>` in permission set metadata — may need manual activation in Setup | | "User not found" error | Username/alias doesn't exist in target org — verify with `sf org display user --target-org <alias>` | | Partial success (some users succeed, others fail) | Check JSON output — command returns both `successes` and `failures` arrays; exit code will be non-zero if any failures occurred |
---
Output Expectations
The command returns JSON output with status code and result details.
See `examples/success_output.json` and `examples/error_output.json` for response structures.
---
Reference File Index
| File | When to read | |------|-------------| | `examples/success_output.json` | To understand successful assignment response structure | | `examples/error_output.json` | To handle common error scenarios | | `references/cli_flags.md` | For detailed explanation of all available flags |
This repository provides a curated collection of Salesforce agent skills for building applications.
Repo: forcedotcom/sf-skills
Other skills on sf-skills.
- /agentforce-generate
Build, modify, optimize, debug, and deploy agents with Agentforce Agent Script. TRIGGER when: user creates, modifies, optimizes, or asks about .agent files or aiAuthoringBundle metadata; changes agent behavior, responses, or conversation logic; designs agent actions, tools,
Open skill - /agentforce-observe
Analyze production Agentforce agent behavior using session traces and Data Cloud. TRIGGER when: user queries STDM session data or Data Cloud trace records; investigates production agent failures, regressions, or performance issues; asks about session traces, conversation logs,
Open skill - /agentforce-test
Write, run, and analyze structured test suites for Agentforce agents — functional AND security. TRIGGER when: user writes or modifies test spec YAML (AiEvaluationDefinition); runs sf agent test create, run, run-eval, or results commands; asks about test coverage strategy, metric
Open skill - /automation-flow-generate
Generate Salesforce Flows using the MCP tool execute_metadata_action. Use when the user asks to create, build, or generate a flow — including Screen, Autolaunched, Record-Triggered (before/after-save), Scheduled. Also trigger for flow-like requests such as \"when a record is
Open skill - /dx-code-analyzer-configure
Set up, configure, and troubleshoot Salesforce Code Analyzer for any project. Handles installation, prerequisite checks, diagnosing broken setups, creating and editing code-analyzer.yml overrides, engine-specific settings, ignore patterns, severity overrides, and CI/CD pipeline
Open skill - /dx-code-analyzer-custom-rule-create
Create custom Code Analyzer rules for Regex (pattern matching), PMD (XPath/AST for Apex and metadata XML), and ESLint (LWC/JavaScript/TypeScript). Use when users want to enforce coding standards, ban patterns, detect hardcoded values, govern metadata, or add rules not in the
Open skill

