PranavNagrecha/AwesomeSalesforceSkills / skills/admin/delegated-administration
delegated-administration
VerifiedUse when configuring delegated administration to allow non-system-admin users to manage specific user groups, reset passwords, assign permission sets, or administer custom objects. Covers the DelegateGroup metadata type (delegateGroups/*.delegateGroup-meta.xml), its roles / profiles / permissionSets / permissionSetGroups / groups / customObjects / loginAccess fields, delegate-group log-in-as, and the deploy and review path for them. NOT for creating, deactivating or licensing users yourself — use admin/user-management. NOT for auto-assigning permission sets from user attributes — use admin/user-access-policies.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 26.3 KB |
| references/examples.md | markdown | 6.1 KB |
| references/gotchas.md | markdown | 17.1 KB |
| references/llm-anti-patterns.md | markdown | 10.4 KB |
| references/metadata-examples.md | markdown | 12.0 KB |
| references/well-architected.md | markdown | 7.5 KB |
| scripts/check_delegated_administration.pyexecutable | script | 15.9 KB |
| templates/delegated-administration-template.md | markdown | 4.8 KB |
references/llm-anti-patterns.md
View on GitHub# LLM Anti-Patterns — Delegated Administration
Common mistakes AI coding assistants make when generating or advising on Salesforce Delegated Administration.
These patterns help the consuming agent self-check its own output.
## Anti-Pattern 1: Ignoring the role hierarchy requirement for delegated admin scope
**What the LLM generates:** "Create a delegated admin group and add the regional manager. They can now manage all users in the org."
**Why it happens:** LLMs describe delegated administration as org-wide user management. Scope comes from one field. The Metadata API Developer Guide defines `DelegateGroup.roles` as "the roles and subordinates for which delegated administrators of the group can create and edit users" — nothing else in the type widens or narrows which users are reachable.
**Correct pattern:**
```
Delegated admin scope is exactly the group's `roles` field:
1. Every role listed in <roles> is in scope, AND every role
beneath it in the hierarchy ("roles and subordinates").
2. Nothing else scopes users. <profiles>, <permissionSets>,
<permissionSetGroups> and <groups> are menus of what may be
assigned INSIDE that population — they never narrow it.
3. A user with no role matches no entry and is unreachable.
4. An empty <roles> means the group manages nobody, whatever
else the file lists.
Example: <roles>West_Region_Manager</roles> covers the West branch
entire — West Sales Rep, West SDR, and anything added under it
later — but no East role, because East is a different branch.
```
UNVERIFIED (2026-09-04): the common additional rule that the listed roles must sit *at or below the delegated administrator's own role* does not appear in the `DelegateGroup` documentation. Aligning the administrator's role with the top of the branch remains good practice for consistent report and sharing visibility; do not present it as an enforced boundary without testing it.
**Detection hint:** If the output says a delegated admin can manage "all users", or claims that trimming the assignable-profile list narrows who they can reach, the scope model is wrong. Search for `roles` and `subordinates` in the delegated admin instructions.
---
## Anti-Pattern 2: Assuming delegated admins can assign any profile
**What the LLM generates:** "The delegated admin can create new users and assign them whatever profile they need."
**Why it happens:** LLMs generalize user creation as unrestricted. Delegated admins can only assign profiles that are explicitly listed in the Delegated Admin group configuration. They cannot assign System Administrator or any other profile not in their allowed list.
**Correct pattern:**
```
Profile assignment is restricted:
1. In Setup → Delegated Administration → [Group] → User Administration:
- Specify which profiles the delegated admin can assign.
- Only these profiles appear in the Profile dropdown when the
delegated admin creates or edits a user.
2. Best practice: include only the profiles for the business unit
the delegated admin manages.
3. NEVER include the System Administrator profile in the allowed list
unless you intend the delegated admin to create full admins.
```
**Detection hint:** If the output says delegated admins can assign "any profile" without mentioning the allowed profile list, the restriction is being ignored. Search for `allowed profiles` or `specify which profiles`.
---
## Anti-Pattern 3: Confusing delegated administration with the System Administrator profile
**What the LLM generates:** "Give the manager a System Administrator profile so they can manage their team's users."
**Why it happens:** LLMs reach for the simplest solution. System Administrator grants full access to everything in the org, not just user management. Delegated administration exists specifically to provide scoped user management without granting full system access.
**Correct pattern:**
```
Delegated Administration vs System Administrator:
- System Administrator: full access to all data, metadata, setup,
and user management across the entire org. Not appropriate for
limited user management tasks.
- Delegated Administration: scoped to specific roles, profiles,
permission sets, and custom objects. No access to org-wide settings,
metadata, Apex, or other administrative functions.
Use delegated admin for:
- Department heads who need to create/deactivate team members.
- Regional managers who reset passwords for their team.
- HR coordinators who manage user profiles for a business unit.
```
**Detection hint:** If the output recommends the System Administrator profile for someone who only needs to manage users in their team, the solution is over-provisioned. Search for `System Administrator` as a solution for user management.
---
## Anti-Pattern 4: Forgetting to configure permission set assignment delegation
**What the LLM generates:** "Set up delegated administration for the manager. They can now create users, reset passwords, and assign permission sets."
**Why it happens:** LLMs assume permission set assignment is included by default. Delegated admins can only assign permission sets that are explicitly listed in the Delegated Admin group's "Assignable Permission Sets" section. If no permission sets are listed, the delegated admin cannot assign any.
**Correct pattern:**
```
Configure permission set delegation explicitly:
1. In the Delegated Admin group, go to "Assignable Permission Sets."
2. Add the specific permission sets the delegated admin should be
able to assign to their users.
3. If this section is empty, the delegated admin cannot assign
any permission sets — only profiles (from the allowed list).
4. Review this list when new permission sets are created to ensure
delegated admins can assign them if needed.
```
**Detection hint:** If the output says delegated admins can "assign permission sets" without mentioning the explicit assignable permission sets configuration, the setup is incomplete. Search for `Assignable Permission Sets` in the instructions.
---
## Anti-Pattern 5: Not testing delegated admin permissions from the delegated admin's perspective
**What the LLM generates:** "Configure the delegated admin group and the setup is complete."
**Why it happens:** LLMs stop at configuration and skip verification. The admin configuring delegation is a System Administrator who sees everything. Without testing as the delegated admin, issues like missing "Manage Users" button, invisible profiles in dropdowns, or inability to reset passwords go undetected until the delegated admin reports the problem.
**Correct pattern:**
```
Post-configuration verification:
1. Log in as the delegated admin (or use "Login As" from Setup → Users).
2. Verify they can see the "Manage Users" option in Setup.
3. Create a test user and confirm only the allowed profiles appear.
4. Reset a password for a user in an allowed role.
5. Attempt to assign a permission set from the allowed list.
6. Attempt to manage a user OUTSIDE their role scope — confirm it fails.
7. Attempt to assign a profile NOT in the allowed list — confirm it fails.
8. Document the verification results.
```
**Detection hint:** If the output ends at group configuration without a verification/testing step from the delegated admin's perspective, the setup is untested. Search for `log in as` or `verify` or `test` after the configuration steps.
---
## Anti-Pattern 6: Copying `loginAccess` straight out of the guide's sample definition
**What the LLM generates:**
```
<DelegateGroup xmlns="http://soap.sforce.com/2006/04/metadata">
<label>Regional Admins</label>
<loginAccess>true</loginAccess>
... <!-- the rest of the group -->
```
**Why it happens:** The Metadata API Developer Guide's only sample definition for `DelegateGroup` has `<loginAccess>true</loginAccess>`, and the field is **required**, so a model generating a valid file has to emit something — the sample's value is the path of least resistance. The result is an impersonation grant nobody asked for: the guide defines the field as allowing "users in this group to log in as users in the role hierarchy that they administer".
**Correct pattern:**
```
Set loginAccess deliberately, defaulting to false:
<loginAccess>false</loginAccess> <!-- onboarding, password resets,
profile assignment: no
impersonation needed -->
<loginAccess>true</loginAccess> <!-- only with a named approver,
recorded as privileged access,
and after checking the org's
SecuritySettings:
canUsersGrantLoginAccess /
enableAdminLoginAsAnyUser -->
```
**Detection hint:** If a generated `DelegateGroup` has `loginAccess` true and the surrounding prose never mentions logging in as another user, the value was copied, not chosen. Also flag any explanation of the file that walks through `roles` and `profiles` but skips `loginAccess` entirely — a required field explained nowhere is a field nobody decided.
---
## Anti-Pattern 7: Verifying with SOQL against a delegate-group object that does not exist
**What the LLM generates:** "After deploying, confirm the configuration with `SELECT Id, DelegateGroupId, UserId FROM DelegateGroupMember` — or query `DelegateGroupGrant` to list what each group can assign."
**Why it happens:** Nearly every other admin artefact in this library verifies with SOQL, so the pattern generalises. It does not hold here: the Object Reference for the Salesforce Platform documents no `DelegateGroup`, `DelegateGroupMember`, or `DelegateGroupGrant` SObject. The queries above are plausible-looking and will fail with an invalid-sObject error.
**Correct pattern:**
```
Verify a delegate group three ways, none of them SOQL:
1. Retrieve round-trip —
sf project retrieve start --metadata DelegateGroup:<Name>
then diff against the file you deployed. A dropped <roles> or
<permissionSets> entry means the name did not resolve.
2. Setup — Users > Delegated Administrators > <group>: confirm each
related list matches the file, including login access.
3. Behaviour — log in as one of the group's administrators and run
the negative tests (a user outside the role branch; a profile
not in the list).
```
**Detection hint:** Any SOQL query naming an object that starts with `DelegateGroup` is invented. Search generated verification steps for `FROM DelegateGroup` and replace with the retrieve round-trip.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 323k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |