/sf-platform:platform-role-hierarchy-applyfrom Salesforce — Platform & Apex
Bulk-realign a Salesforce UserRole hierarchy from an external org-chart artifact (PDF, xlsx, or plain text) in one admin-approved manifest. Resolves identities, diffs against the current tree, and submits create/rename/reparent/delete/user-assignment mutations together.
Ships in Salesforce — Platform & Apex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Apply many UserRole changes from an artifact in one admin-approved manifest.
If the admin only asks which roles exist or how they are nested, hand off to managing-roles. Do not query, do not ask the step 0 questions, and do not submit.
.xlsx / .csv with role_name and parent_role_name (empty parent = top-level), or plain text with one Role: Parent pair per line.{roleName, parentRoleName} objects.Name or DeveloperName.Ask anything still unresolved. Do not guess.
AssignUser or MoveUser without an explicit yes.If the artifact matches fewer than 20% of its roles to the current tree, stop and ask whether it is a greenfield replacement, the wrong file, or a mapping problem. Do not build a manifest until the admin confirms a greenfield replacement. Between 20% and 50%, show the fraction in the preview and continue.
SELECT Id, DeveloperName, Name, ParentRoleId
FROM UserRole
LIMIT 10000
Match artifact roles by DeveloperName, then case-insensitive Name.
Normalize to {roleName, parentRoleName, users?} and show that list to the admin before the diff. A PDF that is not text-selectable cannot be parsed. Ask for a plain-text Role: Parent list.
Roles: exact DeveloperName, then case-insensitive Name. No fuzzy match. When more than one role matches, list each candidate's DeveloperName and Id and wait. Do not pick one. Unresolved names go back to step 0.
Users, only after reassignment was confirmed:
005 → User.IdUser.EmailUser.UsernameUser.Name, and only when exactly one active user matchesIsActive = false is a non-match. A user listed under two roles is a conflict. Ask which role that user should land under, or whether to drop the reassignment. Do not submit until the admin answers.
Stop on a cycle in the target graph. Report the path, for example A → B → C → A, and ask for a corrected artifact. Do not submit.
Each mutation has operationId, operationType, dependsOnOperationIds, and one nested payload. dependsOnOperationIds is the order that matters.
| operationType | Nested object | Use when |
|---|---|---|
CreateRole | createRole | Role is in the artifact and not in the org. Set roleReference, developerName, name, and parentRoleId or parentRoleReference. Default the three account-owner access fields to the org defaults when the artifact omits them. |
ReparentRole | reparentRole | Role exists and the parent differs. Set targetRoleId or targetRoleReference, expectedParentRoleId, and desiredParentRoleId or desiredParentRoleReference. |
RenameRole | renameRole | Same role, different label or developer name. Set the expected and desired name fields. |
DeleteRole | deleteRole | Admin asked to remove an empty role. Set targetRoleId, expectedParentRoleId, expectedAssignedUserIds, and expectedDirectChildRoleIds. |
AssignUser or MoveUser | userRoleAssignment | Reassignment was confirmed. Set userId, expectedCurrentRoleId, and desiredRoleId or desiredRoleReference. |
DeleteRole applies only when the role has no direct children and no assigned users at the moment it runs. Reparent those children and move those users in earlier mutations, and put those operationIds in dependsOnOperationIds. The delete's expected user and child lists are then empty. If the admin declined reassignment, do not delete a role that still has users.
A mutation that names a role neither in the org nor created in this manifest is missing-parent. Name the roles that point at it. Ask whether to add a CreateRole for it in this manifest, skip those rows, or abort. Do not submit with that parent missing.
A cycle in dependsOnOperationIds blocks the submit. Give every new role a roleReference string and point parents and assignments at that string.
Block the submit when any of these remain: a cycle, a missing parent, a duplicate developerName, a dependency cycle, an AssignUser or MoveUser without the step 0 yes, a DeleteRole whose expected user or child lists are not empty, or overlap under 20% without a confirmed greenfield replacement.
On a duplicate developerName, show both rows and wait until the admin picks one or renames one.
Warn in the preview, and continue only after an explicit yes:
Territory2.UserRoleId or a forecast hierarchy override.PortalType != 'None'.SELECT COUNT() FROM User WHERE UserRoleId = :id).Restructure preview
-------------------
ReparentRole : 42
CreateRole : 3
RenameRole : 1
DeleteRole : 2
MoveUser : 2
Territory / forecast references : 1
Portal roles : 0
Roles with more than 500 users : 2
Approve this restructure? [yes / no]
yes submits. Anything else does not. Roles left in the org and absent from the artifact stay in place.
POST /services/data/v{version}/sharing/role-hierarchy-restructure
{
"operation": "Save",
"mutations": [
{
"operationId": "reparent-sales-vp",
"operationType": "ReparentRole",
"dependsOnOperationIds": [],
"reparentRole": {
"targetRoleId": "00E000000000001",
"expectedParentRoleId": "00E000000000002",
"desiredParentRoleReference": "cro"
}
},
{
"operationId": "delete-legacy-region",
"operationType": "DeleteRole",
"dependsOnOperationIds": ["reparent-legacy-children"],
"deleteRole": {
"targetRoleId": "00E000000000003",
"expectedParentRoleId": "00E000000000002",
"expectedAssignedUserIds": [],
"expectedDirectChildRoleIds": []
}
}
]
}
CreateRole, RenameRole, AssignUser, and MoveUser use the same envelope with their nested object from step 3.
Send the approved manifest once. Do not edit UserRole records one by one.
Applied — structural and sharing changes committed.AppliedSharingPending — hierarchy is live; sharing catches up on its own. Do not poll.AsyncExecutionRequired — the server queued the manifest. Do not poll.RoleOperationInProgress — another restructure is running. Stop. Do not queue the manifest. Ask the admin to retry once the other operation finishes.NotApplied — nothing committed. Show reasonCodes and stop.404 on submit — API not enabled for this client tier. Halt, tell the admin, do not retry, do not fall back to per-record /sobjects/UserRole edits.For each operationResults[] entry, outcome is Applied, NotApplied, or DependencyNotApplied. Show reasonCode for any entry that is not Applied. Do not retry and do not roll back.
managing-roles).Operations this skill uses — routing and dependency reference.
| Operation | Purpose | Status | Call | Depends on |
|---|---|---|---|---|
read-role-hierarchy | read | — | GET /services/data/v68.0/query | — |
count-users-per-role | read | — | GET /services/data/v68.0/query | read-role-hierarchy |
submit-role-hierarchy-restructure | write | — | POST /services/data/v68.0/sharing/role-hierarchy-restructure | read-role-hierarchy |
verify-role-hierarchy-restructure | verify | — | GET /services/data/v68.0/query | submit-role-hierarchy-restructure |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub reej-consulting/reej-sf-skills --plugin sf-platform43 skills in this plugin
/crm-analytics-wave-generateUse to build a Wave Recipe, deploy a CRM Analytics dataset or dashboard, or author the full CRMA asset stack — apps, Wave Recipes (.wdpr), datasets, and dashboards — against a connected Salesforce org via REST and Metadata APIs, without CRM Analytics Studio or Dashboard Builder. TRIGGER when: user asks to build or create a Wave Recipe, generate a .wdpr or .wdpr-meta.xml, deploy a .wdash or .wapp, run a recipe or dataflowjob programmatically, upload CSV data via InsightsExternalData, validate a dataset schema with synthetic data, fetch dataset XMD, audit dashboard SAQL re-encoding, or find unused dataset fields. TRIGGER on keywords: Wave Recipe, CRMA, CRM Analytics, wdpr, wdash, wapp, WaveRecipe, Wave dataflow, dataflowjob, InsightsExternalData, SAQL, dataset XMD, Analytics Studio, R3 format, wave/recipes, wave/dashboards, or analytics on Salesforce objects (opportunities, leads, cases, accounts, sales). DO NOT TRIGGER for standard Salesforce reports or LWC components unrelated to CRM Analytics./design-systems-slds2-migrateMigrate Lightning Web Components from SLDS 1 to SLDS 2 by running the SLDS linter and fixing violations. Use this skill whenever users mention SLDS 2, SLDS uplift, linter violations, LWC token migration, class overrides, hardcoded CSS values that need SLDS hook replacement, or styling hook selection. Covers all styling hook categories — color, spacing, sizing, typography, borders, radius, and shadows. Also use when users mention no-hardcoded-values, no-slds-class-overrides, lwc-to-slds-hooks, no-deprecated-tokens-slds1, or ask about SLDS component migration — even if they don't explicitly say "uplift" or "migration"./design-systems-slds-validateAudit Lightning Web Components for SLDS design-system compliance and produce a scored quality report. Runs the SLDS linter and analyzes CSS for theming hook usage and pairing, scoring SLDS findings across categories into an overall grade. Use when asked to "score my component's SLDS", "SLDS scorecard", "SLDS quality report", "audit SLDS compliance", "how good is my SLDS", "check SLDS quality", "rate my SLDS styling", "evaluate my component's SLDS", "is this component's SLDS ready to ship?", "look at my LWC for SLDS issues", "audit SLDS before I submit", "review my component's SLDS before code review", or any time a user wants an SLDS quality assessment or SLDS production-readiness check on an LWC. Not for fixing violations (use design-systems-slds2-migrate), building new components (use design-systems-slds-apply), or accessibility/WCAG/ARIA audits (use experience-accessibility-validate)./dx-apexguru-scanRun an ApexGuru performance scan on a Salesforce Apex project via the ApexGuru SFAP Scan API. Zips the project's Apex (any layout), submits it, polls to completion, decodes the base64 report, and presents performance antipattern violations (SOQL in loop, DML in loop, Schema.getGlobalDescribe(), SOQL without WHERE/LIMIT, unused SOQL fields) grouped by rule with severity, file:line, and suggested fixes — clearly attributed as 'Static only' or 'Production insights'. TRIGGER when the user says 'run ApexGuru', 'ApexGuru scan', 'check Apex performance', 'find governor-limit / performance antipatterns', 'SOQL in loop', 'scan my Apex for performance', or 'ApexGuru performance insights'. DO NOT TRIGGER for general static analysis or security scans (use dx-code-analyzer-run), for fixing code without scanning, or for onboarding an org to ApexGuru./dx-code-analyzer-configureSet 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 setup. TRIGGER when: user says 'set up code analyzer', 'configure code analyzer', 'install code analyzer', 'code analyzer not working', 'fix my setup', 'scan failing', 'check my setup', 'enable/disable engine', 'exclude files', 'change severity', 'set up GitHub Actions', 'set up CI/CD', 'add to pipeline', 'pipeline fail', 'update my workflow', 'quality gate', 'fail on violations', 'scan changed files only', 'add SARIF', 'code-analyzer.yml', 'ESLint config', 'increase SFGE memory', or reports errors running Code Analyzer. DO NOT TRIGGER when: user wants to run a scan (use dx-code-analyzer-run), fix violations, explain rules, create custom rules (use dx-code-analyzer-custom-rule-create), or suppress violations./dx-code-analyzer-custom-rule-createCreate 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 built-in set. TRIGGER when: user says 'create a rule', 'ban System.debug', 'enforce naming convention', 'detect hardcoded IDs', 'custom rule', 'xpath rule', 'regex rule', 'add a PMD rule', 'enforce a policy', 'create a check for', 'flag this pattern', 'make a rule that catches', 'metadata rule', 'check permissions', 'enforce API version', 'eslint rule', 'lwc rule', 'override rule threshold', 'customize complexity', or describes a pattern to enforce. DO NOT TRIGGER when: user wants to run a scan (use dx-code-analyzer-run), configure engines (use dx-code-analyzer-configure), or explain existing rules (use dx-code-analyzer-run).3 plugins ship this exact skill · first indexed Nov 1, 2026
Other plugins' skills for the same job