using-ui-bundle-salesforce-data
MUST activate when the project contains a uiBundles/*/src/ directory and the task involves ANY Salesforce record operation — reading, creating, updating, or deleting. Use this skill when building forms that submit to Salesforce, pages that display Salesforce records, or any code that touches Salesforce objects or custom objects. Activate when files under uiBundles/*/src/ import from @salesforce/sdk-data, or when *.graphql files or codegen.yml exist. This skill owns all Salesforce data access pat
Security Assessment
About using-ui-bundle-salesforce-data
A skill that owns Salesforce data-access patterns inside React UI bundles (projects with a uiBundles/*/src/ directory). It activates for any Salesforce record operation — reading, creating, updating, or deleting — such as building forms that submit to Salesforce, pages that display records, or any code touching standard or custom objects, including when files import from @salesforce/sdk-data or when .graphql files or codegen.yml exist. It explicitly does not cover authentication/OAuth setup, schema changes, the Bulk/Tooling/Metadata APIs, or declarative automation. All data access must go through the Data SDK (@salesforce/sdk-data), which handles authentication, CSRF, and base URL resolution, using sdk.graphql for queries and mutations and sdk.fetch for REST, always with optional chaining because those methods may be undefined in some surfaces.
Before starting, it verifies preconditions: the SDK installed, a schema.graphql at the project root, and custom objects/fields deployed (checked with graphql-search.sh). If preconditions are unmet it may scaffold components, routes, and UI logic with empty data and TODO markers, but does not write GraphQL strings until the schema workflow is complete. Only a fixed set of APIs is permitted — GraphQL via the uiapi namespace, UI API REST, Apex REST, Connect REST, and Einstein LLM — and unsupported paths such as the SOQL query endpoint (blocked at the proxy), Aura-enabled Apex, and the Chatter API are called out with sanctioned alternatives. GraphQL is preferred for record operations, with REST reserved for cases GraphQL cannot cover.
A set of non-negotiable GraphQL rules reflects Salesforce-specific behavior: HTTP 200 does not mean success, so the errors array must always be parsed; the schema is the single source of truth and every name must be confirmed via the search script; @optional belongs on all read-query record fields to survive field-level security; mutations wrap under uiapi(input: { allOrNone }); pagination must always set first: and include pageInfo; and SOQL-derived limits cap subqueries, traversal depth, and records per subquery. The workflow acquires the schema (without ever opening the 265K-line file directly), looks up entities with graphql-search.sh, generates queries and types, and validates with lint and codegen.
FAQ
How must Salesforce data be accessed in a UI bundle?
Through the Data SDK (@salesforce/sdk-data), which handles authentication, CSRF, and base URL resolution. Use sdk.graphql for record queries and mutations and sdk.fetch for REST, always with optional chaining since those methods may be undefined in some surfaces.
Why must I always check the errors array even on HTTP 200?
Because Salesforce GraphQL returns HTTP 200 even when operations fail. Treating a 200 as success without parsing the errors array in the response body leads to silent runtime failures.
Can I run SOQL through the standard query endpoint?
No. The Enterprise REST query endpoint (/services/data/v*/query with SOQL) is blocked at the proxy level. Use GraphQL for record reads, or Apex REST if server-side SOQL aggregates are required.
Why is the @optional directive applied to read-query fields?
Salesforce field-level security causes a query to fail entirely if the user lacks access to even one field. The @optional directive (v65+) tells the server to omit inaccessible fields instead of failing, and consuming code should use optional chaining and nullish coalescing.
How are entity and field names confirmed before writing a query?
The schema is the single source of truth and the 265K-line schema.graphql is never opened directly. Instead, names, types, and relationships are confirmed by running scripts/graphql-search.sh for the relevant entities from the project root.
Install using-ui-bundle-salesforce-data
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
forcedotcom/sf-skills