К основному содержанию
скилл CX Codex

platform-sharing-owd-configure — скилл для Claude Code: OWD

Скилл читает и меняет Organization-Wide Default для объектов Salesforce: показывает текущие уровни доступа и правит sharingModel в метаданных.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add forcedotcom/sf-skills --skill platform-sharing-owd-configure -a claude-code
Открыть на GitHub

Что делает platform-sharing-owd-configure

Скилл закрывает одну задачу: настройку базового уровня доступа к записям, которые пользователь не создавал. Сначала он запрашивает текущие значения через Tooling API — InternalSharingModel и ExternalSharingModel по нужному объекту или сразу по всем настраиваемым. Потом показывает их таблицей.

Если нужно поменять доступ, скилл вытягивает метаданные объекта командой sf project retrieve start --metadata CustomObject:<ObjectName>, правит <sharingModel> и <externalSharingModel> в .object-meta.xml и деплоит обратно. Перед деплоем идёт проверка: внешний доступ не должен быть шире внутреннего, объекты со связью Master-Detail обязаны стоять на ControlledByParent, а значение должно быть допустимым для конкретного объекта. Для Price Book внутренний OWD принимает только Use или No Access, внешний всегда None — попытка выставить Private или Read/Write провалится, и скилл об этом скажет до деплоя.

Есть жёсткий лимит: не больше двух попыток деплоя на одно изменение. После двух неудач скилл откатывает локальные правки и спрашивает, что делать дальше. Учтите и другое: перевод OWD в более закрытое состояние запускает пересчёт правил доступа, на большой организации это долго. Новые кастомные объекты создаются с Public Read/Write — многие узнают об этом уже после инцидента. Нужен установленный Salesforce CLI версии 2.0.0 или выше и подключённая организация.

Какие задачи решает

  • посмотреть текущие OWD по объекту или сразу по всем настраиваемым
  • сделать записи приватными и не сломать внешний доступ
  • поменять sharingModel в .object-meta.xml и задеплоить
  • проверить, что объект со связью Master-Detail стоит на ControlledByParent
  • выяснить, какие уровни доступа вообще допустимы для объекта

Примеры запросов агенту

  • покажи текущие org-wide defaults для объекта Account
  • сделай внутренний доступ к Invoice__c приватным
  • выставь внешний доступ для Contact на Public Read Only

Как установить platform-sharing-owd-configure

1Через Skills CLI (Vercel)

npx skills add forcedotcom/sf-skills --skill platform-sharing-owd-configure -a claude-code

2Вручную: положить файлы

~/.claude/skills/platform-sharing-owd-configure/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/platform-sharing-owd-configure/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора167

commerce-b2b-open-code-components-replace Меняет стандартные B2B Commerce компоненты на открытые аналоги в content.json метаданных сайта. Или просто показывает соответствия, если менять файлы не нужно. CX Codex +1 4 600установок commerce-b2b-open-code-components-integrate Копирует открытые компоненты Salesforce B2B Commerce из GitHub в метаданные сайта магазина, чтобы они появились в палитре Experience Builder. CX Codex +1 4 600установок platform-policy-rule-generate Помогает писать метаданные PolicyRuleDefinition и PolicyRuleDefinitionSet для Salesforce Data Cloud: схема, дерево категорий, проверки перед деплоем. CX Codex +1 4 100установок platform-custom-report-type-generate Помогает агенту создавать и проверять метаданные Salesforce Custom Report Type: база, связи, доступные поля. Пригодится при разборе ошибок деплоя .reportType-meta.xml. CX Codex +1 4 000установок platform-encryption-configure Скилл для настройки Salesforce Shield Platform Encryption через метаданные и консультаций по архитектуре управления ключами. CX Codex +1 3 600установок platform-dataspace-access-configure Настраивает и проверяет доступ наборов разрешений к DataSpace в Salesforce Data Cloud. Нужен для областей DataSpace и объектных прав DMO, DLO или CIO. CX Codex +1 3 700установок dx-pkg-post-install-configure Настраивает Salesforce managed package после установки по его документации: права, FLS, макеты страниц и доступ к вкладкам. CX Codex +1 3 500установок experience-ui-bundle-project-generate Генерирует готовый к разработке проект Salesforce UI bundle из шаблона через Salesforce CLI. Пригодится при старте нового приложения на React или Angular в SFDX. CX Codex +1 3 200установок

Похожие

writing-mappings celigo Помогает писать маппинги полей и трансформации в интеграциях Celigo: Mapper 2.0, Transformation 2.0, лукапы и response mapping. CX Codex +1 3 000установок salesforce-flow-design официальный github Проверяет архитектуру Salesforce Flow: выбор типа, bulk-безопасность и обработку ошибок. Подходит для проектирования и ревью Flow перед активацией. 839установок salesforce-development Mindrally Скилл задаёт агенту правила разработки на Salesforce: Apex, триггеры, Lightning Web Components, SOQL и метаданные. Пригодится, когда пишете код для org и хотите, чтобы агент держал стиль и лимиты платформы. CX Codex +1 659установок Salesforce Visualforce Development официальный github Субагент для GitHub Copilot, который пишет и проверяет страницы Visualforce вместе с их Apex-контроллерами. ★ 40 418звёзд репо salesforce-apex-cursorrules-prompt-file PatrickJS Правило для Cursor, которое настраивает ИИ на разработку Salesforce на Apex: очередь вместо @future, паттерны GoF и минимум комментариев. ★ 41 011звёзд репо integration-listing-optimization Samuel Berthe Оптимизирует карточки B2B SaaS в каталогах AppExchange, Shopify, Atlassian, HubSpot и Slack. Помогает поднять конверсию просмотров в установки и легально собирать отзывы. CX Codex +1 7 700установок

Рядом в теме «DevOps и инфраструктура»

Всё по теме «DevOps и инфраструктура» →

Вопросы о platform-sharing-owd-configure

Как установить platform-sharing-owd-configure в Claude?

Через npx: npx skills add forcedotcom/sf-skills --skill platform-sharing-owd-configure -a claude-code. После этого файл скилла лежит в ~/.claude/skills/platform-sharing-owd-configure/SKILL.md.

Что делает platform-sharing-owd-configure?

Читает Organization-Wide Default для стандартных и кастомных объектов Salesforce и меняет уровни внутреннего и внешнего доступа через правку метаданных объекта с последующим деплоем.

Чем этот скилл отличается от platform-sharing-rules-generate?

Он работает только с базовым уровнем доступа к записям. Правила sharing, иерархия ролей и ручной шаринг — не его область, для них есть отдельный скилл.

Исходный текст

SKILL.md · Apache-2.0
---
name: platform-sharing-owd-configure
description: "Use when the user wants to retrieve or update Organization-Wide Default (OWD) sharing settings for Salesforce objects. TRIGGER on org-wide defaults, checking/viewing sharing defaults, changing default access levels (Private, Public Read Only, Public Read/Write, Controlled by Parent), internal/external access for standard or custom objects, making records private, or sharingModel in .object-meta.xml files. DO NOT TRIGGER for sharing rules, criteria-based sharing, role hierarchy, or manual sharing — delegate to platform-sharing-rules-generate."
metadata:
  relatedSkills:
    - "platform-metadata-deploy"
    - "platform-sharing-rules-generate"
  version: "1.2"
  domains: ["Platform"]
  cliTools:
    - tool: ["sf"]
      semver: ">=2.0.0"
---

# Managing Org-Wide Defaults

Retrieve and update Organization-Wide Default (OWD) sharing settings for standard and custom objects in a Salesforce org. OWDs define the baseline level of access users have to records they do not own.

## Scope

- **In scope**: Retrieving current OWD settings, updating internal/external access levels for standard and custom objects
- **Out of scope**: Sharing rules, role hierarchy configuration, manual sharing, permission sets, criteria-based sharing — delegate to appropriate skills

---

## Clarifying Questions

Before proceeding, confirm with the user if not already clear:

- Which object(s) do you want to get or update OWD settings for?
- What access level do you want to set? (Private, Public Read Only, Public Read/Write, Controlled by Parent)
- Do you need to change both internal and external access, or just one?

---

## Required Inputs

Gather or infer before proceeding:

- **Target org**: The org alias or username to query/update (use default org if not specified)
- **Object name(s)**: Standard object API name (e.g., `Account`, `Contact`) or custom object API name (e.g., `Invoice__c`)
- **Operation**: Get (retrieve current settings) or Update (change access levels)
- **Access levels** (for update): Internal access and/or external access values

Defaults unless specified:
- Use the default connected org
- If only one access level is provided, assume it applies to internal access

---

## Workflow

All steps are sequential. Do not skip or reorder.

### Phase 1 — Retrieve Current Settings

1. **Query current OWD settings** using the Salesforce CLI Tooling API:
   `sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE QualifiedApiName = '<ObjectName>'" --use-tooling-api --target-org <org>`

2. **For retrieving all OWD settings at once:**
   `sf data query --query "SELECT QualifiedApiName, InternalSharingModel, ExternalSharingModel FROM EntityDefinition WHERE IsCustomizable = true ORDER BY QualifiedApiName" --use-tooling-api --target-org <org>`

3. **Present results clearly** — read `references/access_levels.md` for valid values and display a formatted table to the user.

### Phase 2 — Update Settings (if requested)

4. **Check for immutable/fixed OWD** — read `references/access_levels.md` "Immutable / Fixed OWD Objects" section. If the requested change targets a fixed value (e.g., Price Book external OWD), **stop immediately** and explain to the user that this value is platform-fixed and cannot be changed by any means. Do not attempt a deploy.

5. **Validate the requested access level** — read `references/access_levels.md` to confirm the value is valid for the target object. If the value is not in the allowed set for that object, explain what values are valid and ask the user to choose one. Do not guess alternative values.

6. **Retrieve the object metadata** using the Metadata API (same command for both standard and custom objects): `sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>`. This retrieves `<ObjectName>.object-meta.xml` containing `<sharingModel>` and `<externalSharingModel>`. See `references/metadata_api_approach.md` for the full procedure.

7. **Modify the sharing settings** — update the `<sharingModel>` (internal access) and/or `<externalSharingModel>` (external access) in the object's `.object-meta.xml`. Read `references/metadata_api_approach.md` for details.

8. **Pre-deploy verification** — before deploying, confirm:
   - [ ] External access is not more permissive than internal access
   - [ ] Objects with Master-Detail relationships use `ControlledByParent`
   - [ ] The requested access level is valid for the target object (see `references/access_levels.md`)
   - [ ] Cross-object constraints are satisfied (see "Cross-Object Constraints" in `references/access_levels.md`)
   - [ ] The target field is not listed as immutable/fixed in `references/access_levels.md`

9. **Deploy the updated settings:** `sf project deploy start --metadata CustomObject:<ObjectName> --target-org <org>`.

10. **Handle deploy failure (max 2 attempts):** If the deploy fails:
    - Read the error message and identify the root cause.
    - If the error indicates the value is invalid or unsupported for the object, **stop** — report the failure to the user with the exact error message and explain what is and isn't possible. Do not try alternative values unless the user explicitly requests a different valid value.
    - If the error is transient (network timeout, auth expired), retry **once**.
    - **Never attempt more than 2 total deploys for the same change.** After 2 failures, report the error, discard local edits (`sf project retrieve start --metadata CustomObject:<ObjectName> --target-org <org>`), and ask the user how to proceed.

11. **Verify the change** by re-running the query from Phase 1, Step 1.

---

## Rules / Constraints

| Constraint | Rationale |
|-----------|-----------|
| Objects with Master-Detail relationships must use `ControlledByParent` | Platform enforces this — attempting other values fails |
| External access cannot be more permissive than internal access | Salesforce rejects configurations where external > internal |
| Some objects have immutable/fixed OWD (e.g., Price Book external, User, Activity external) | These are platform-enforced — explain impossibility upfront, never attempt a deploy |
| Price Book only accepts `Use` (`ReadSelect`) or `No Access` (`None`) for internal OWD; external is always `None` | Standard access levels (Private/Read/ReadWrite) are invalid for Price Book |
| Changing OWD to more restrictive triggers sharing recalculation | This can take significant time on large orgs — warn the user |
| Custom objects default to `Public Read/Write` when created | Users may not realize the default is permissive |
| For managed package custom objects, use the full API name including namespace prefix (e.g., `ns__Object__c`) | Namespace-prefixed objects require the prefix in both queries and metadata retrieval |
| Always verify the org connection before querying | Prevents confusing error messages |
| Maximum 2 deploy attempts per change | Prevents unbounded retry loops — after 2 failures, stop and report to the user |

---

## Gotchas

| Issue | Resolution |
|-------|------------|
| `INSUFFICIENT_ACCESS` error when updating | User needs Manage Sharing permission or System Administrator profile |
| OWD change appears stuck | Sharing recalculation is running — check Setup > Sharing Settings for progress |
| Custom object not found in query | Use the full API name including `__c` suffix |
| `ControlledByParent` not available | Object has no Master-Detail relationship — use Private, Public Read Only, or Public Read/Write |
| External access field not showing | External sharing model only appears when external org-wide defaults are enabled |
| Query returns no results | Object may not be customizable or API name may be incorrect — verify spelling |
| Deploy fails with invalid value for Price Book | Price Book only accepts `Use`/`None` (internal) and external is fixed at `None` — do not retry with other values, explain to user |

---

## Output Expectations

Deliverables:
- **For get operations**: Formatted table showing object name, internal access level, and external access level
- **For update operations**: Confirmation of the change with before/after comparison

---

## Cross-Skill Integration

| Need | Delegate to |
|------|-------------|
| Creating sharing rules after restricting OWD | `platform-sharing-rules-generate` skill |
| Deploying metadata changes to another org | `platform-metadata-deploy` skill |

---

## Reference File Index

| File | When to read |
|------|-------------|
| `references/access_levels.md` | When validating or explaining OWD access level values |
| `references/metadata_api_approach.md` | When using Metadata API to update OWD instead of Tooling API |
| `examples/get_owd_output.md` | To verify formatted output matches expected structure |
| `examples/update_owd_output.md` | To verify update confirmation matches expected structure |

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

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой