@salesforce/webapp-template-feature-react-file-upload-experimental 1.105.0 → 1.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +1 -1
  2. package/dist/.a4drules/skills/{feature-react-chart-analytics-charts → building-analytics-charts}/SKILL.md +1 -1
  3. package/dist/.a4drules/skills/{webapp-react-data-visualization → building-data-visualization}/SKILL.md +3 -3
  4. package/dist/.a4drules/skills/{webapp-react-data-visualization → building-data-visualization}/implementation/donut-chart.md +1 -1
  5. package/dist/.a4drules/skills/{webapp-react-interactive-map → building-interactive-map}/SKILL.md +1 -1
  6. package/dist/.a4drules/skills/{webapp-react → building-react-components}/SKILL.md +1 -1
  7. package/dist/.a4drules/skills/{webapp-react-weather-widget → building-weather-widget}/SKILL.md +2 -2
  8. package/dist/.a4drules/skills/{webapp-csp-trusted-sites → configuring-csp-trusted-sites}/SKILL.md +1 -1
  9. package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/SKILL.md +14 -14
  10. package/dist/.a4drules/skills/{feature-micro-frontend-micro-frontend → generating-micro-frontend-lwc}/SKILL.md +1 -1
  11. package/{skills/file-upload → dist/.a4drules/skills/implementing-file-upload}/SKILL.md +1 -1
  12. package/dist/.a4drules/skills/{webapp-features → installing-webapp-features}/SKILL.md +1 -1
  13. package/dist/.a4drules/skills/{feature-react-agentforce-conversation-client-embedded-agent → integrating-agentforce-conversation-client}/SKILL.md +1 -1
  14. package/dist/.a4drules/skills/{webapp-unsplash-images → integrating-unsplash-images}/SKILL.md +1 -1
  15. package/dist/.a4drules/skills/salesforce-data-access/SKILL.md +165 -0
  16. package/dist/.a4drules/skills/salesforce-graphql/SKILL.md +323 -0
  17. package/dist/.a4drules/skills/salesforce-graphql-explore-schema/SKILL.md +160 -0
  18. package/dist/.a4drules/skills/{feature-graphql-graphql-data-access/docs/generate-mutation-query.md → salesforce-graphql-mutation-query/SKILL.md} +72 -42
  19. package/dist/.a4drules/skills/salesforce-graphql-read-query/SKILL.md +253 -0
  20. package/dist/.a4drules/skills/salesforce-rest-api-fetch/SKILL.md +167 -0
  21. package/dist/.a4drules/webapp-react.md +2 -50
  22. package/dist/AGENT.md +5 -0
  23. package/dist/CHANGELOG.md +19 -0
  24. package/dist/force-app/main/default/webapplications/feature-react-file-upload/eslint.config.js +42 -27
  25. package/dist/package.json +1 -1
  26. package/package.json +2 -2
  27. package/{dist/.a4drules/skills/feature-react-file-upload-file-upload → skills/implementing-file-upload}/SKILL.md +1 -1
  28. package/dist/.a4drules/features/feature-graphql-graphql-data-access-rule.md +0 -470
  29. package/dist/.a4drules/skills/feature-graphql-graphql-data-access/SKILL.md +0 -155
  30. package/dist/.a4drules/skills/feature-graphql-graphql-data-access/docs/explore-schema.md +0 -256
  31. package/dist/.a4drules/skills/feature-graphql-graphql-data-access/docs/generate-read-query.md +0 -202
  32. /package/dist/.a4drules/skills/{feature-react-chart-analytics-charts → building-analytics-charts}/docs/schema-mapping.md +0 -0
  33. /package/dist/.a4drules/skills/{webapp-react-data-visualization → building-data-visualization}/implementation/dashboard-layout.md +0 -0
  34. /package/dist/.a4drules/skills/{webapp-react-data-visualization → building-data-visualization}/implementation/stat-card.md +0 -0
  35. /package/dist/.a4drules/skills/{webapp-react-interactive-map → building-interactive-map}/implementation/geocoding.md +0 -0
  36. /package/dist/.a4drules/skills/{webapp-react-interactive-map → building-interactive-map}/implementation/leaflet-map.md +0 -0
  37. /package/dist/.a4drules/skills/{webapp-react → building-react-components}/implementation/component.md +0 -0
  38. /package/dist/.a4drules/skills/{webapp-react → building-react-components}/implementation/header-footer.md +0 -0
  39. /package/dist/.a4drules/skills/{webapp-react → building-react-components}/implementation/page.md +0 -0
  40. /package/dist/.a4drules/skills/{webapp-react-weather-widget → building-weather-widget}/implementation/weather-hook.md +0 -0
  41. /package/dist/.a4drules/skills/{webapp-react-weather-widget → building-weather-widget}/implementation/weather-ui.md +0 -0
  42. /package/dist/.a4drules/skills/{webapp-csp-trusted-sites → configuring-csp-trusted-sites}/implementation/metadata-format.md +0 -0
  43. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/charts.csv +0 -0
  44. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/colors.csv +0 -0
  45. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/icons.csv +0 -0
  46. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/landing.csv +0 -0
  47. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/products.csv +0 -0
  48. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/react-performance.csv +0 -0
  49. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/stacks/html-tailwind.csv +0 -0
  50. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/stacks/react.csv +0 -0
  51. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/stacks/shadcn.csv +0 -0
  52. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/styles.csv +0 -0
  53. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/typography.csv +0 -0
  54. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/ui-reasoning.csv +0 -0
  55. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/ux-guidelines.csv +0 -0
  56. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/data/web-interface.csv +0 -0
  57. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/scripts/core.js +0 -0
  58. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/scripts/design_system.js +0 -0
  59. /package/dist/.a4drules/skills/{webapp-ui-ux → designing-webapp-ui-ux}/scripts/search.js +0 -0
  60. /package/dist/.a4drules/skills/{feature-react-agentforce-conversation-client-embedded-agent → integrating-agentforce-conversation-client}/docs/embed-examples.md +0 -0
  61. /package/dist/.a4drules/skills/{feature-react-agentforce-conversation-client-embedded-agent → integrating-agentforce-conversation-client}/docs/troubleshooting.md +0 -0
  62. /package/dist/.a4drules/skills/{webapp-unsplash-images → integrating-unsplash-images}/implementation/usage.md +0 -0
  63. /package/dist/.a4drules/skills/{feature-graphql-graphql-data-access/docs → salesforce-graphql}/shared-schema.graphqls +0 -0
package/README.md CHANGED
@@ -311,7 +311,7 @@ onProgress: (progress) => {
311
311
 
312
312
  The sample includes a **skill** to show how a feature can bundle an on-demand workflow.
313
313
 
314
- Copy the `skills/file-upload/` folder into `.cline/skills/` (Cline) or `.cursor/skills/` (Cursor) to try it, or use it as a template for your own skills.
314
+ Copy the `skills/implementing-file-upload/` folder into `.cline/skills/` (Cline) or `.cursor/skills/` (Cursor) to try it, or use it as a template for your own skills.
315
315
 
316
316
  ## Dependencies
317
317
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: feature-react-chart-analytics-charts
2
+ name: building-analytics-charts
3
3
  description: Add or change charts from raw data. Use when the user asks for a chart, graph, or analytics visualization from JSON/data.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-react-data-visualization
2
+ name: building-data-visualization
3
3
  description: Adds data visualization components (charts, stat cards, KPI metrics) to React pages using Recharts. Use when the user asks to add a chart, graph, donut chart, pie chart, bar chart, stat card, KPI metric, dashboard visualization, or analytics component to the web application.
4
4
  ---
5
5
 
@@ -46,8 +46,8 @@ Recharts is built on D3 and provides declarative React components. No additional
46
46
 
47
47
  Read the corresponding guide:
48
48
 
49
- - **Bar chart** — use the **`analytics-charts`** skill in `feature-react-chart` (AnalyticsChart component for categorical data).
50
- - **Line / area chart** — use the **`analytics-charts`** skill in `feature-react-chart` (AnalyticsChart component for time-series data).
49
+ - **Bar chart** — use the **`building-analytics-charts`** skill in `feature-react-chart` (AnalyticsChart component for categorical data).
50
+ - **Line / area chart** — use the **`building-analytics-charts`** skill in `feature-react-chart` (AnalyticsChart component for time-series data).
51
51
  - **Donut / pie chart** — read `implementation/donut-chart.md`
52
52
  - **Stat card with trend** — read `implementation/stat-card.md`
53
53
  - **Dashboard layout** — read `implementation/dashboard-layout.md`
@@ -156,7 +156,7 @@ Keep chart colors consistent with the app's design system. Define them as consta
156
156
 
157
157
  ## Other chart types
158
158
 
159
- For **bar charts** and **line charts**, use the `AnalyticsChart` component from `feature-react-chart` instead of raw Recharts. See the **`analytics-charts`** skill for usage.
159
+ For **bar charts** and **line charts**, use the `AnalyticsChart` component from `feature-react-chart` instead of raw Recharts. See the **`building-analytics-charts`** skill for usage.
160
160
 
161
161
  ---
162
162
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-react-interactive-map
2
+ name: building-interactive-map
3
3
  description: Adds interactive Leaflet maps with geocoded markers to React pages. Use when the user asks to add a map, show locations on a map, display property pins, add a map view, or integrate mapping into the web application.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-react
2
+ name: building-react-components
3
3
  description: Use when editing any React code in the web application — creating or modifying components, pages, layout, headers, footers, or any TSX/JSX files. Follow this skill for add component, add page, header/footer, and general React UI implementation patterns (shadcn UI and Tailwind CSS).
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-react-weather-widget
2
+ name: building-weather-widget
3
3
  description: Adds a weather widget to React pages using the free Open-Meteo API. Use when the user asks to add weather, show a forecast, display current conditions, add a weather card, or integrate weather data into the web application.
4
4
  ---
5
5
 
@@ -34,7 +34,7 @@ The widget needs a latitude/longitude. Identify where this comes from:
34
34
 
35
35
  - **Fixed default** — hardcoded city (e.g. San Francisco: `37.7749, -122.4194`)
36
36
  - **User's location** — browser Geolocation API
37
- - **Address-based** — geocode an address to lat/lng (see the `webapp-react-interactive-map` skill for geocoding)
37
+ - **Address-based** — geocode an address to lat/lng (see the `building-interactive-map` skill for geocoding)
38
38
  - **Prop-driven** — parent component passes lat/lng
39
39
 
40
40
  ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-csp-trusted-sites
2
+ name: configuring-csp-trusted-sites
3
3
  description: Creates Salesforce CSP Trusted Site metadata when adding external domains. Use when the user adds an external API, CDN, image host, font provider, map tile server, or any third-party URL that the web application needs to load resources from — or when a browser console shows a CSP violation error.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-ui-ux
2
+ name: designing-webapp-ui-ux
3
3
  description: Use when editing any UI code in the web application — styling, layout, design, appearance, Tailwind, shadcn, colors, typography, icons, or visual/UX changes. Comprehensive design guide and searchable database for React + Tailwind + shadcn/ui (styles, color palettes, font pairings, UX guidelines, chart types).
4
4
  ---
5
5
 
@@ -35,7 +35,7 @@ Extract key information from user request:
35
35
  **Always start with `--design-system`** to get comprehensive recommendations with reasoning:
36
36
 
37
37
  ```bash
38
- node skills/ui-ux/scripts/search.js "<product_type> <industry> <keywords>" --design-system [-p "Project Name"]
38
+ node skills/designing-webapp-ui-ux/scripts/search.js "<product_type> <industry> <keywords>" --design-system [-p "Project Name"]
39
39
  ```
40
40
 
41
41
  This command:
@@ -46,7 +46,7 @@ This command:
46
46
 
47
47
  **Example:**
48
48
  ```bash
49
- node skills/ui-ux/scripts/search.js "beauty spa wellness service" --design-system -p "Serenity Spa"
49
+ node skills/designing-webapp-ui-ux/scripts/search.js "beauty spa wellness service" --design-system -p "Serenity Spa"
50
50
  ```
51
51
 
52
52
  ### Step 2b: Persist Design System (Master + Overrides Pattern)
@@ -54,7 +54,7 @@ node skills/ui-ux/scripts/search.js "beauty spa wellness service" --design-syste
54
54
  To save the design system for hierarchical retrieval across sessions, add `--persist`:
55
55
 
56
56
  ```bash
57
- node skills/ui-ux/scripts/search.js "<query>" --design-system --persist -p "Project Name"
57
+ node skills/designing-webapp-ui-ux/scripts/search.js "<query>" --design-system --persist -p "Project Name"
58
58
  ```
59
59
 
60
60
  This creates:
@@ -63,7 +63,7 @@ This creates:
63
63
 
64
64
  **With page-specific override:**
65
65
  ```bash
66
- node skills/ui-ux/scripts/search.js "<query>" --design-system --persist -p "Project Name" --page "dashboard"
66
+ node skills/designing-webapp-ui-ux/scripts/search.js "<query>" --design-system --persist -p "Project Name" --page "dashboard"
67
67
  ```
68
68
 
69
69
  This also creates:
@@ -79,7 +79,7 @@ This also creates:
79
79
  After getting the design system, use domain searches to get additional details:
80
80
 
81
81
  ```bash
82
- node skills/ui-ux/scripts/search.js "<keyword>" --domain <domain> [-n <max_results>]
82
+ node skills/designing-webapp-ui-ux/scripts/search.js "<keyword>" --domain <domain> [-n <max_results>]
83
83
  ```
84
84
 
85
85
  **When to use detailed searches:**
@@ -97,7 +97,7 @@ node skills/ui-ux/scripts/search.js "<keyword>" --domain <domain> [-n <max_resul
97
97
  Get implementation-specific best practices for React, Tailwind, or shadcn/ui:
98
98
 
99
99
  ```bash
100
- node skills/ui-ux/scripts/search.js "<keyword>" --stack shadcn
100
+ node skills/designing-webapp-ui-ux/scripts/search.js "<keyword>" --stack shadcn
101
101
  ```
102
102
 
103
103
  Available stacks: `html-tailwind`, `react`, `shadcn`
@@ -143,7 +143,7 @@ Available stacks: `html-tailwind`, `react`, `shadcn`
143
143
  ### Step 2: Generate Design System (REQUIRED)
144
144
 
145
145
  ```bash
146
- node skills/ui-ux/scripts/search.js "beauty spa wellness service elegant" --design-system -p "Serenity Spa"
146
+ node skills/designing-webapp-ui-ux/scripts/search.js "beauty spa wellness service elegant" --design-system -p "Serenity Spa"
147
147
  ```
148
148
 
149
149
  **Output:** Complete design system with pattern, style, colors, typography, effects, and anti-patterns.
@@ -152,17 +152,17 @@ node skills/ui-ux/scripts/search.js "beauty spa wellness service elegant" --desi
152
152
 
153
153
  ```bash
154
154
  # Get UX guidelines for animation and accessibility
155
- node skills/ui-ux/scripts/search.js "animation accessibility" --domain ux
155
+ node skills/designing-webapp-ui-ux/scripts/search.js "animation accessibility" --domain ux
156
156
 
157
157
  # Get alternative typography options if needed
158
- node skills/ui-ux/scripts/search.js "elegant luxury serif" --domain typography
158
+ node skills/designing-webapp-ui-ux/scripts/search.js "elegant luxury serif" --domain typography
159
159
  ```
160
160
 
161
161
  ### Step 4: Stack Guidelines
162
162
 
163
163
  ```bash
164
- node skills/ui-ux/scripts/search.js "layout responsive form" --stack html-tailwind
165
- node skills/ui-ux/scripts/search.js "form dialog" --stack shadcn
164
+ node skills/designing-webapp-ui-ux/scripts/search.js "layout responsive form" --stack html-tailwind
165
+ node skills/designing-webapp-ui-ux/scripts/search.js "form dialog" --stack shadcn
166
166
  ```
167
167
 
168
168
  **Then:** Synthesize design system + detailed searches and implement the design.
@@ -175,10 +175,10 @@ The `--design-system` flag supports two output formats:
175
175
 
176
176
  ```bash
177
177
  # ASCII box (default) - best for terminal display
178
- node skills/ui-ux/scripts/search.js "fintech crypto" --design-system
178
+ node skills/designing-webapp-ui-ux/scripts/search.js "fintech crypto" --design-system
179
179
 
180
180
  # Markdown - best for documentation
181
- node skills/ui-ux/scripts/search.js "fintech crypto" --design-system -f markdown
181
+ node skills/designing-webapp-ui-ux/scripts/search.js "fintech crypto" --design-system -f markdown
182
182
  ```
183
183
 
184
184
  ---
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: feature-micro-frontend-micro-frontend
2
+ name: generating-micro-frontend-lwc
3
3
  description: Generate a Micro Frontend LWC component for a Web Application.
4
4
  license: Proprietary. LICENSE.txt has complete terms
5
5
  metadata:
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: feature-react-file-upload
2
+ name: implementing-file-upload
3
3
  description: Add file upload functionality to React webapps with progress tracking and Salesforce ContentVersion integration. Use when the user wants to upload files, attach documents, handle file input, create file dropzones, track upload progress, or link files to Salesforce records. This feature provides programmatic APIs ONLY — no components or hooks are exported. Build your own custom UI using the upload() API. ALWAYS use this feature instead of building file upload from scratch with FormData or XHR.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-features
2
+ name: installing-webapp-features
3
3
  description: Search, describe, and install pre-built UI features (authentication, shadcn components, navigation, charts, search, GraphQL, Agentforce AI) into Salesforce webapps. Use this when the user wants to add functionality to a webapp, or when determining what salesforce-provided features are available — whether prompted by the user or on your own initiative. Always check for an existing feature before building from scratch.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: feature-react-agentforce-conversation-client-embedded-agent
2
+ name: integrating-agentforce-conversation-client
3
3
  description: Embed an Agentforce conversation client (chat UI) into a React web application using the AgentforceConversationClient component. Use when the user wants to add or integrate a chat widget, chatbot, conversation client, agent chat, or conversational interface in a React app, or when they mention Agentforce chat, Agentforce widget, employee agent, travel agent, HR agent, or embedding a Salesforce agent. ALWAYS use this skill instead of building a chat UI from scratch. NEVER generate custom chat components, use third-party chat libraries, or implement chat with WebSockets or REST APIs. Do NOT use for Lightning Web Components (LWC), non-React frameworks.
4
4
  ---
5
5
 
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: webapp-unsplash-images
2
+ name: integrating-unsplash-images
3
3
  description: Adds high-quality Unsplash images to React pages. Use when the user asks to add a hero image, background image, placeholder image, stock photo, decorative image, or any Unsplash-sourced imagery to the web application.
4
4
  ---
5
5
 
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: salesforce-data-access
3
+ description: Salesforce data access patterns. Use when adding or modifying any code that fetches data from Salesforce (records, Chatter, Connect API, etc.).
4
+ paths:
5
+ - "**/*.ts"
6
+ - "**/*.tsx"
7
+ - "**/*.graphql"
8
+ ---
9
+
10
+ # Salesforce Data Access
11
+
12
+ Guidance for accessing Salesforce data from web apps. **All Salesforce data fetches MUST use the Data SDK** (`@salesforce/sdk-data`). The SDK provides authentication, CSRF handling, and correct base URL resolution — direct `fetch` or `axios` calls bypass these and are not allowed.
13
+
14
+ ## Mandatory: Use the Data SDK
15
+
16
+ > **Every Salesforce data fetch must go through the Data SDK.** Obtain it via `createDataSDK()`, then use `sdk.graphql?.()` or `sdk.fetch?.()`. Never call `fetch()` or `axios` directly for Salesforce endpoints.
17
+
18
+ ## Optional Chaining and Graceful Handling
19
+
20
+ **Always use optional chaining** when calling `sdk.graphql` or `sdk.fetch` — these methods may be undefined in some surfaces (e.g., Salesforce ACC, MCP Apps). Handle the case where they are not available gracefully:
21
+
22
+ ```typescript
23
+ const sdk = await createDataSDK();
24
+
25
+ // ✅ Use optional chaining
26
+ const response = await sdk.graphql?.(query);
27
+
28
+ // ✅ Check before using fetch
29
+ if (!sdk.fetch) {
30
+ throw new Error("Data SDK fetch is not available in this context");
31
+ }
32
+ const res = await sdk.fetch(url);
33
+ ```
34
+
35
+ For GraphQL, if `sdk.graphql` is undefined, the call returns `undefined` — handle that in your logic (e.g., throw a clear error or return a fallback). For `sdk.fetch`, check availability before calling when the operation is required.
36
+
37
+ ## Preference: GraphQL First
38
+
39
+ **GraphQL is the preferred method** for querying and mutating Salesforce records. Use it when:
40
+
41
+ - Querying records (Account, Contact, Opportunity, custom objects)
42
+ - Creating, updating, or deleting records (when GraphQL supports the operation)
43
+ - Fetching related data, filters, sorting, pagination
44
+
45
+ **Use `sdk.fetch` only when GraphQL is not sufficient.** For REST API usage, invoke the `salesforce-rest-api-fetch` skill, which documents:
46
+
47
+ - Chatter API (e.g., `/services/data/v65.0/chatter/users/me`)
48
+ - Connect REST API (e.g., `/services/data/v65.0/connect/file/upload/config`)
49
+ - Apex REST (e.g., `/services/apexrest/auth/login`)
50
+ - UI API REST (e.g., `/services/data/v65.0/ui-api/records/{recordId}`)
51
+ - Einstein LLM Gateway
52
+
53
+ ---
54
+
55
+ ## Getting the SDK
56
+
57
+ ```typescript
58
+ import { createDataSDK } from "@salesforce/sdk-data";
59
+
60
+ const sdk = await createDataSDK();
61
+ ```
62
+
63
+ ---
64
+
65
+ ## Example 1: GraphQL (Preferred)
66
+
67
+ For record queries and mutations, use GraphQL via the Data SDK. Invoke the `salesforce-graphql` skill for the full workflow (schema exploration, query authoring, codegen, lint validate).
68
+
69
+ ```typescript
70
+ import { createDataSDK, gql } from "@salesforce/sdk-data";
71
+ import type { GetAccountsQuery } from "../graphql-operations-types";
72
+
73
+ const GET_ACCOUNTS = gql`
74
+ query GetAccounts {
75
+ uiapi {
76
+ query {
77
+ Account(first: 10) {
78
+ edges {
79
+ node {
80
+ Id
81
+ Name { value }
82
+ }
83
+ }
84
+ }
85
+ }
86
+ }
87
+ }
88
+ `;
89
+
90
+ export async function getAccounts() {
91
+ const sdk = await createDataSDK();
92
+ const response = await sdk.graphql?.<GetAccountsQuery>(GET_ACCOUNTS);
93
+
94
+ if (response?.errors?.length) {
95
+ throw new Error(response.errors.map((e) => e.message).join("; "));
96
+ }
97
+
98
+ return response?.data?.uiapi?.query?.Account?.edges?.map((e) => e?.node) ?? [];
99
+ }
100
+ ```
101
+
102
+ ---
103
+
104
+ ## Example 2: Fetch (When GraphQL Is Not Sufficient)
105
+
106
+ For REST endpoints that have no GraphQL equivalent, use `sdk.fetch`. **Invoke the `salesforce-rest-api-fetch` skill** for full documentation of Chatter, Connect REST, Apex REST, UI API REST, and Einstein LLM endpoints.
107
+
108
+ ```typescript
109
+ import { createDataSDK } from "@salesforce/sdk-data";
110
+
111
+ declare const __SF_API_VERSION__: string;
112
+ const API_VERSION = typeof __SF_API_VERSION__ !== "undefined" ? __SF_API_VERSION__ : "65.0";
113
+
114
+ export async function getCurrentUser() {
115
+ const sdk = await createDataSDK();
116
+ const response = await sdk.fetch?.(`/services/data/v${API_VERSION}/chatter/users/me`);
117
+
118
+ if (!response?.ok) throw new Error(`HTTP ${response?.status}`);
119
+ const data = await response.json();
120
+ return { id: data.id, name: data.name };
121
+ }
122
+ ```
123
+
124
+ ---
125
+
126
+ ## Anti-Patterns (Forbidden)
127
+
128
+ ### Direct fetch to Salesforce
129
+
130
+ ```typescript
131
+ // ❌ FORBIDDEN — bypasses Data SDK auth and CSRF
132
+ const res = await fetch("/services/data/v65.0/chatter/users/me");
133
+ ```
134
+
135
+ ### Direct axios to Salesforce
136
+
137
+ ```typescript
138
+ // ❌ FORBIDDEN — bypasses Data SDK
139
+ const res = await axios.get("/services/data/v65.0/chatter/users/me");
140
+ ```
141
+
142
+ ### Correct approach
143
+
144
+ ```typescript
145
+ // ✅ CORRECT — use Data SDK
146
+ const sdk = await createDataSDK();
147
+ const res = await sdk.fetch?.("/services/data/v65.0/chatter/users/me");
148
+ ```
149
+
150
+ ---
151
+
152
+ ## Decision Flow
153
+
154
+ 1. **Need to query or mutate Salesforce records?** → Use GraphQL via the Data SDK. Invoke the `salesforce-graphql` skill.
155
+ 2. **Need Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM?** → Use `sdk.fetch`. Invoke the `salesforce-rest-api-fetch` skill.
156
+ 3. **Never** use `fetch`, `axios`, or similar directly for Salesforce API calls.
157
+
158
+ ---
159
+
160
+ ## Reference
161
+
162
+ - GraphQL workflow: invoke the `salesforce-graphql` skill (`.a4drules/skills/salesforce-graphql/`)
163
+ - REST API via fetch: invoke the `salesforce-rest-api-fetch` skill (`.a4drules/skills/salesforce-rest-api-fetch/`)
164
+ - Data SDK package: `@salesforce/sdk-data` (`createDataSDK`, `gql`, `NodeOfConnection`)
165
+ - `createRecord` for UI API record creation: `@salesforce/webapp-experimental/api` (uses Data SDK internally)