platform-sharing-rules-generate
БесплатноЗапускает вложенные скриптыНе проверенUse when users get, create, edit, delete, or retrieve Salesforce Sharing Rules metadata for record-level access. TRIGGER on sharing rules…
от forcedotcom★ 1 200 звёзд на GitHubОб этом скилле
Sharing Rules Generator
Get, create, edit, and delete Salesforce Sharing Rules metadata to control record-level access beyond org-wide defaults. Supports criteria-based rules, role/group-based owner rules, and guest user rules for Experience Sites.
Scope
- In scope: Creating, editing, deleting, and retrieving (getting)
sharingCriteriaRules,sharingOwnerRules, andsharingGuestRulesmetadata; retrieving existing sharing rules from an org using the Metadata API Retrieve pattern; appending new rules to existing files; modifying rule criteria or access levels; removing rules from metadata files; configuring rules for Guest and Portal profiles. - Out of scope: Changing org-wide defaults (OWD/sharing model), creating Experience Sites, configuring permission sets or profiles (use
platform-permission-set-generate), territory-based sharing rules.
Clarifying Questions
Before proceeding, confirm with the user if not already clear:
For Get operations:
- Which object's sharing rules should be retrieved? (standard or custom object API name, or all objects)
- Which target org should the rules be retrieved from? (org alias or default)
For Create operations:
- Which object should the sharing rule apply to? (standard or custom object API name)
- What type of rule? (criteria-based, role/group-based owner rule, or guest user rule)
- Who should records be shared with? (role name, public group, portal role, or guest user nickname; a queue can't be shared with)
- What access level? (Read or Read/Write)
- For criteria-based rules: what field conditions should match?
For Edit operations:
- Which existing rule should be modified? (rule fullName or label)
- What should change? (access level, criteria, label — note:
sharedToandsharedFromcannot be edited in place)
For Delete operations:
- Which rule(s) should be removed? (rule fullName or label)
- Confirm the object the rule belongs to
Required Inputs
Gather or infer before proceeding:
- Object API name: The sObject the rule targets (e.g.,
Account,Property__c) - Rule type: One of
sharingCriteriaRules,sharingOwnerRules, orsharingGuestRules - Shared-to target: Role, public group, portal role, or guest user community nickname. A queue can't be a shared-to target
- Access level:
ReadorEdit(maps to Read-Only or Read/Write) - Criteria (for criteria/guest rules): Field name, operation, and value for each filter item
Defaults unless specified:
- Access level:
Read includeRecordsOwnedByAll:truefor criteria rulesincludeHVUOwnedRecords:falsefor guest rules- Account sharing rules include
accountSettingswith all sub-access levels set toNone
Workflow
Steps are sequential within each phase. Phase 3 branches by operation type — execute only the matching branch. Phase 4 applies to create, edit, and delete only (get operations end at Phase 3).
Phase 1 — Discover
Resolve the SFDX project path — find the project's
sfdx-project.jsonand identify the package directory forsharingRules/.Always retrieve the latest sharing rules from the org using the Metadata API Retrieve pattern:
sf project retrieve start --metadata "SharingRules:<ObjectName>" --target-org <org>This ensures the local file reflects the current org state. Never trust a local file that may be stale — edits or deletes against a stale file can recreate rules that were already removed in the org or overwrite changes made by other users.
Read the retrieved file — parse
<packageDir>/sharingRules/<ObjectName>.sharingRules-meta.xmlto understand existing rules and avoid duplicates.
Phase 2 — Determine Operation and Rule Type
Identify the operation — determine whether the user wants to get, create, edit, or delete a sharing rule.
Select the rule type based on user intent. Read
references/rule-types.mdfor the complete schema of each type and its required elements.For Account sharing rules: the
accountSettingselement is required. Default sub-access levels toNoneunless the user specifies otherwise.For Guest rules: the
sharedTomust use<guestUser>with the site guest user's community nickname. Never use<role>or<group>for guest rules.
A queue can't be the shared-to target. A queue is valid only as the <sharedFrom> of an owner rule (records owned by the queue). If the user asks to share records with a queue, or the shared-with name doesn't resolve as a role or public group, check whether it is a queue:
sf data query --query "SELECT Id, DeveloperName, Name FROM Group WHERE Type = 'Queue' AND (DeveloperName = '<name>' OR Name = '<name>')" --target-org <org>
If it is a queue, stop before writing any file: tell the user a sharing rule can't share records with a queue, and offer a public group with the same members or a role instead. Never put a queue in `<shared
Установить platform-sharing-rules-generate в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл platform-sharing-rules-generate?
Use when users get, create, edit, delete, or retrieve Salesforce Sharing Rules metadata for record-level access. TRIGGER on sharing rules, record/criteria-based/role-based/guest-user sharing, sharingCriteriaRules/sharingOwnerRules/sharingGuestRules, .sharingRules-meta.xml files, or sharing records with roles or groups, including viewing or modifying existing rules. DO NOT TRIGGER for permission sets/profiles or object-level (not record-level) security (use platform-permission-set-generate).
Как установить скилл platform-sharing-rules-generate?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл platform-sharing-rules-generate запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic