@salesforce/webapp-template-feature-react-file-upload-experimental 1.109.0 → 1.109.1

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.
@@ -149,6 +149,19 @@ const res = await sdk.fetch?.("/services/data/v65.0/chatter/users/me");
149
149
 
150
150
  ---
151
151
 
152
+ ## Clarifying Vague Data Requests
153
+
154
+ When a user asks about data and the request is vague, **clarify before implementing**. Ask which of the following they want:
155
+
156
+ - **Application code** — Add or modify code in a specific web app so the app performs the data interaction at runtime (e.g., GraphQL query in the React app)
157
+ - **Local SF CLI** — Run Salesforce CLI commands locally (e.g., `sf data query`, `sf data import tree`) to interact with the org from the terminal
158
+ - **Local example data** — Update or add local fixture/example data files (e.g., JSON in `data/`) for development or testing
159
+ - **Other** — Data export, report generation, setup script, etc.
160
+
161
+ Do not assume. A request like "fetch accounts" could mean: (1) add a GraphQL query to the app, (2) run `sf data query` in the terminal, or (3) update sample data files. Confirm the intent before proceeding.
162
+
163
+ ---
164
+
152
165
  ## Decision Flow
153
166
 
154
167
  1. **Need to query or mutate Salesforce records?** → Use GraphQL via the Data SDK. Invoke the `using-graphql` skill.
@@ -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 **`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).
49
+ - **Bar chart** — read `implementation/bar-line-chart.md` (categorical data)
50
+ - **Line / area chart** — read `implementation/bar-line-chart.md` (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`
@@ -0,0 +1,316 @@
1
+ # Bar & Line / Area Chart — Implementation Guide
2
+
3
+ Requires **recharts** (install from the web app directory; see SKILL.md Step 2).
4
+
5
+ ---
6
+
7
+ ## Data shapes
8
+
9
+ ### Time-series (line / area chart)
10
+
11
+ Use when data represents a trend over time or ordered sequence.
12
+
13
+ ```ts
14
+ interface TimeSeriesDataPoint {
15
+ x: string; // date or label on the x-axis
16
+ y: number; // numeric value
17
+ }
18
+ ```
19
+
20
+ Map raw fields to this shape: e.g. `date` → `x`, `revenue` → `y`.
21
+
22
+ ### Categorical (bar chart)
23
+
24
+ Use when data compares discrete categories.
25
+
26
+ ```ts
27
+ interface CategoricalDataPoint {
28
+ name: string; // category label
29
+ value: number; // numeric value
30
+ }
31
+ ```
32
+
33
+ Map raw fields to this shape: e.g. `product` → `name`, `sales` → `value`.
34
+
35
+ ### How to decide
36
+
37
+ | Signal | Type |
38
+ |--------|------|
39
+ | "over time", "trend", date-like keys | Time-series → line chart |
40
+ | "by category", "by X", label-like keys | Categorical → bar chart |
41
+
42
+ ---
43
+
44
+ ## Theme colors
45
+
46
+ Pick a theme based on the data's sentiment:
47
+
48
+ | Theme | Stroke / Fill | When to use |
49
+ |-------|---------------|-------------|
50
+ | `green` | `#22c55e` | Growth, gain, positive trend |
51
+ | `red` | `#ef4444` | Decline, loss, negative trend |
52
+ | `neutral` | `#6366f1` | Default or mixed data |
53
+
54
+ Define colors as constants — do not use inline hex values.
55
+
56
+ ```ts
57
+ const THEME_COLORS = {
58
+ red: "#ef4444",
59
+ green: "#22c55e",
60
+ neutral: "#6366f1",
61
+ } as const;
62
+
63
+ type ChartTheme = keyof typeof THEME_COLORS;
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Line chart component
69
+
70
+ Create at `components/LineChart.tsx` (or colocate with the page):
71
+
72
+ ```tsx
73
+ import React from "react";
74
+ import {
75
+ LineChart as RechartsLineChart,
76
+ Line,
77
+ XAxis,
78
+ YAxis,
79
+ CartesianGrid,
80
+ Tooltip,
81
+ Legend,
82
+ ResponsiveContainer,
83
+ } from "recharts";
84
+
85
+ const THEME_COLORS = {
86
+ red: "#ef4444",
87
+ green: "#22c55e",
88
+ neutral: "#6366f1",
89
+ } as const;
90
+
91
+ type ChartTheme = keyof typeof THEME_COLORS;
92
+
93
+ interface TimeSeriesDataPoint {
94
+ x: string;
95
+ y: number;
96
+ }
97
+
98
+ interface TimeSeriesChartProps {
99
+ data: TimeSeriesDataPoint[];
100
+ theme?: ChartTheme;
101
+ title?: string;
102
+ className?: string;
103
+ }
104
+
105
+ export function TimeSeriesChart({
106
+ data,
107
+ theme = "neutral",
108
+ title,
109
+ className = "",
110
+ }: TimeSeriesChartProps) {
111
+ if (data.length === 0) {
112
+ return <p className="text-muted-foreground text-center py-8">No data to display</p>;
113
+ }
114
+
115
+ const color = THEME_COLORS[theme];
116
+
117
+ return (
118
+ <div className={className}>
119
+ {title && (
120
+ <h3 className="text-sm font-medium text-primary mb-2 uppercase tracking-wide">
121
+ {title}
122
+ </h3>
123
+ )}
124
+ <ResponsiveContainer width="100%" height={300}>
125
+ <RechartsLineChart data={data}>
126
+ <CartesianGrid strokeDasharray="3 3" />
127
+ <XAxis dataKey="x" />
128
+ <YAxis />
129
+ <Tooltip />
130
+ <Legend />
131
+ <Line type="monotone" dataKey="y" stroke={color} strokeWidth={2} dot={false} />
132
+ </RechartsLineChart>
133
+ </ResponsiveContainer>
134
+ </div>
135
+ );
136
+ }
137
+ ```
138
+
139
+ ---
140
+
141
+ ## Bar chart component
142
+
143
+ Create at `components/BarChart.tsx` (or colocate with the page):
144
+
145
+ ```tsx
146
+ import React from "react";
147
+ import {
148
+ BarChart as RechartsBarChart,
149
+ Bar,
150
+ XAxis,
151
+ YAxis,
152
+ CartesianGrid,
153
+ Tooltip,
154
+ Legend,
155
+ ResponsiveContainer,
156
+ } from "recharts";
157
+
158
+ const THEME_COLORS = {
159
+ red: "#ef4444",
160
+ green: "#22c55e",
161
+ neutral: "#6366f1",
162
+ } as const;
163
+
164
+ type ChartTheme = keyof typeof THEME_COLORS;
165
+
166
+ interface CategoricalDataPoint {
167
+ name: string;
168
+ value: number;
169
+ }
170
+
171
+ interface CategoricalChartProps {
172
+ data: CategoricalDataPoint[];
173
+ theme?: ChartTheme;
174
+ title?: string;
175
+ className?: string;
176
+ }
177
+
178
+ export function CategoricalChart({
179
+ data,
180
+ theme = "neutral",
181
+ title,
182
+ className = "",
183
+ }: CategoricalChartProps) {
184
+ if (data.length === 0) {
185
+ return <p className="text-muted-foreground text-center py-8">No data to display</p>;
186
+ }
187
+
188
+ const color = THEME_COLORS[theme];
189
+
190
+ return (
191
+ <div className={className}>
192
+ {title && (
193
+ <h3 className="text-sm font-medium text-primary mb-2 uppercase tracking-wide">
194
+ {title}
195
+ </h3>
196
+ )}
197
+ <ResponsiveContainer width="100%" height={300}>
198
+ <RechartsBarChart data={data}>
199
+ <CartesianGrid strokeDasharray="3 3" />
200
+ <XAxis dataKey="name" />
201
+ <YAxis />
202
+ <Tooltip />
203
+ <Legend />
204
+ <Bar dataKey="value" fill={color} radius={[4, 4, 0, 0]} />
205
+ </RechartsBarChart>
206
+ </ResponsiveContainer>
207
+ </div>
208
+ );
209
+ }
210
+ ```
211
+
212
+ ---
213
+
214
+ ## Area chart variant
215
+
216
+ For a filled area chart (useful for volume-over-time), swap `Line` for `Area`:
217
+
218
+ ```tsx
219
+ import { AreaChart, Area, XAxis, YAxis, CartesianGrid, Tooltip, ResponsiveContainer } from "recharts";
220
+
221
+ <ResponsiveContainer width="100%" height={300}>
222
+ <AreaChart data={data}>
223
+ <CartesianGrid strokeDasharray="3 3" />
224
+ <XAxis dataKey="x" />
225
+ <YAxis />
226
+ <Tooltip />
227
+ <Area type="monotone" dataKey="y" stroke={color} fill={color} fillOpacity={0.2} />
228
+ </AreaChart>
229
+ </ResponsiveContainer>
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Chart container wrapper
235
+
236
+ Wrap any chart in a styled card for consistent spacing:
237
+
238
+ ```tsx
239
+ import { Card } from "@/components/ui/card";
240
+
241
+ interface ChartContainerProps {
242
+ children: React.ReactNode;
243
+ className?: string;
244
+ }
245
+
246
+ export function ChartContainer({ children, className = "" }: ChartContainerProps) {
247
+ return (
248
+ <Card className={`p-4 border-gray-200 shadow-sm ${className}`}>
249
+ {children}
250
+ </Card>
251
+ );
252
+ }
253
+ ```
254
+
255
+ Usage:
256
+
257
+ ```tsx
258
+ <ChartContainer>
259
+ <TimeSeriesChart data={monthlyData} theme="green" title="Monthly Revenue" />
260
+ </ChartContainer>
261
+ ```
262
+
263
+ ---
264
+
265
+ ## Preparing raw data
266
+
267
+ Map API responses to the expected shape before passing to the chart:
268
+
269
+ ```tsx
270
+ const timeSeriesData = useMemo(
271
+ () => apiRecords.map((r) => ({ x: r.date, y: r.revenue })),
272
+ [apiRecords],
273
+ );
274
+
275
+ const categoricalData = useMemo(
276
+ () => apiRecords.map((r) => ({ name: r.product, value: r.sales })),
277
+ [apiRecords],
278
+ );
279
+ ```
280
+
281
+ ---
282
+
283
+ ## Key Recharts concepts
284
+
285
+ | Component | Purpose |
286
+ |-----------|---------|
287
+ | `ResponsiveContainer` | Wraps chart to fill parent width |
288
+ | `CartesianGrid` | Background grid lines |
289
+ | `XAxis` / `YAxis` | Axis labels; `dataKey` maps to the data field |
290
+ | `Tooltip` | Hover info |
291
+ | `Legend` | Series labels |
292
+ | `Line` | Line series; `type="monotone"` for smooth curves |
293
+ | `Bar` | Bar series; `radius` rounds top corners |
294
+ | `Area` | Filled area; `fillOpacity` controls transparency |
295
+
296
+ ---
297
+
298
+ ## Accessibility
299
+
300
+ - Always include a text legend (not just colors).
301
+ - Chart should be wrapped in a section with a visible heading.
302
+ - For critical data, provide a text summary or table alternative.
303
+ - Use sufficient color contrast between the chart stroke/fill and background.
304
+ - Consider `prefers-reduced-motion` for chart animations.
305
+
306
+ ---
307
+
308
+ ## Common mistakes
309
+
310
+ | Mistake | Fix |
311
+ |---------|-----|
312
+ | Missing `ResponsiveContainer` | Chart won't resize; always wrap |
313
+ | Fixed width/height on chart | Let `ResponsiveContainer` control sizing |
314
+ | No empty-data handling | Show "No data" message when `data.length === 0` |
315
+ | Inline colors | Extract to `THEME_COLORS` constant |
316
+ | Using raw Recharts for every chart type | Use `DonutChart` (see `donut-chart.md`) for pie/donut |
@@ -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 **`building-analytics-charts`** skill for usage.
159
+ For **bar charts** and **line / area charts**, see `bar-line-chart.md` in this directory.
160
160
 
161
161
  ---
162
162
 
@@ -68,13 +68,29 @@ Once you have identified the type and gathered answers to the clarifying questio
68
68
 
69
69
  ---
70
70
 
71
- ## Verification
71
+ ## TypeScript Standards
72
+
73
+ - **Never use `any`** — use proper types, generics, or `unknown` with type guards.
74
+ - **Event handlers:** `(event: React.FormEvent<HTMLFormElement>): void`
75
+ - **State:** `useState<User | null>(null)` — always provide the type parameter.
76
+ - **No unsafe assertions** (`obj as User`). Use type guards:
77
+ ```typescript
78
+ function isUser(obj: unknown): obj is User {
79
+ return typeof obj === 'object' && obj !== null && typeof (obj as User).id === 'string';
80
+ }
81
+ ```
72
82
 
73
- Before completing, run from the web app directory `force-app/main/default/webapplications/<appName>/` (use the actual app folder name):
83
+ ---
84
+
85
+ ## Verification (MANDATORY)
86
+
87
+ Before completing, run from the web app directory `force-app/main/default/webapplications/<appName>/`:
74
88
 
75
89
  ```bash
76
90
  cd force-app/main/default/webapplications/<appName> && npm run lint && npm run build
77
91
  ```
78
92
 
79
- - **Lint:** MUST result in 0 errors. Fix any ESLint or TypeScript issues.
80
- - **Build:** MUST succeed. Resolve any compilation or Vite build failures before finishing.
93
+ - **Lint:** MUST result in 0 errors.
94
+ - **Build:** MUST succeed (includes TypeScript check).
95
+
96
+ If either fails, fix the errors and re-run. Do not leave the session with failing quality gates.
@@ -11,7 +11,10 @@ paths:
11
11
 
12
12
  # Skills-First (MUST FOLLOW)
13
13
 
14
- **Before writing any code or running any command**, search for relevant skills (`SKILL.md` files) that cover your task. Read the full skill and follow its instructions. Skills live in `.a4drules/skills/` and `feature/*/skills/`. See **webapp-skills-first.md** for the full protocol and a task-to-skill lookup table.
14
+ **Before writing any code or running any command**, search for relevant skills (`SKILL.md` files) that cover your task. Read the full skill and follow its instructions. Skills live in `.a4drules/skills/` and `feature/*/skills/`.
15
+
16
+ - Do not write custom scripts or complex bash commands for a workflow already covered by a loaded skill.
17
+ - Only proceed with manual execution after confirming no relevant skill exists.
15
18
 
16
19
  # Deployment Order (MUST FOLLOW)
17
20
 
@@ -91,6 +94,25 @@ Agents consistently miss these. **You must not leave them default.**
91
94
  | Root page content | Component at root route (often `Home` in `routes.tsx`) |
92
95
 
93
96
 
97
+ # React & TypeScript Constraints
98
+
99
+ ## Routing (React Router)
100
+
101
+ Use a **single** router package. When using `createBrowserRouter` / `RouterProvider`, all imports MUST come from **`react-router`** — not `react-router-dom`.
102
+
103
+ ## Component Library + Styling
104
+
105
+ - **shadcn/ui** for components: `import { Button } from '@/components/ui/button';`
106
+ - **Tailwind CSS** utility classes
107
+
108
+ ## URL & Path Handling
109
+
110
+ Apps run behind dynamic base paths. Router navigation (`<Link to>`, `navigate()`) prefer absolute paths (`/x`). Non-router attributes (`<img src>`) use dot-relative (`./x`) to resolve against `<base>`. Prefer Vite `import` for static assets.
111
+
112
+ ## Module Restrictions
113
+
114
+ React apps must NOT import Salesforce platform modules like `lightning/*` or `@wire` (LWC-only). For data access, invoke the **accessing-data** skill.
115
+
94
116
  # Frontend Aesthetics
95
117
 
96
118
  **Avoid AI slop.** Make creative, distinctive frontends:
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: installing-webapp-features
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.
3
+ description: Search, describe, and install pre-built UI features (authentication, shadcn components, navigation, 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
 
6
6
  # webapps-features-experimental CLI — Agent Reference
7
7
 
8
- **Always check for an existing feature before building something yourself.** This CLI installs pre-built, tested feature packages into Salesforce webapps. Features range from foundational UI component libraries (shadcn/ui with Button, Card, Input, Table, etc.) to full-stack application capabilities like authentication (login, registration, password flows, session management, and Apex backend classes), global search, navigation menus, data visualization charts, GraphQL integrations, and Agentforce AI conversation UIs. Each feature ships as a complete implementation — including React components, context providers, route guards, and any required Salesforce server-side code — that already handles platform-specific concerns like Salesforce API integration, session management, and SFDX metadata structure. Building these from scratch is error-prone and unnecessary when a feature exists. **If no existing feature is found, ask the user before proceeding with a custom implementation — a relevant feature may exist under a different name or keyword.**
8
+ **Always check for an existing feature before building something yourself.** This CLI installs pre-built, tested feature packages into Salesforce webapps. Features range from foundational UI component libraries (shadcn/ui with Button, Card, Input, Table, etc.) to full-stack application capabilities like authentication (login, registration, password flows, session management, and Apex backend classes), global search, navigation menus, GraphQL integrations, and Agentforce AI conversation UIs. Each feature ships as a complete implementation — including React components, context providers, route guards, and any required Salesforce server-side code — that already handles platform-specific concerns like Salesforce API integration, session management, and SFDX metadata structure. Building these from scratch is error-prone and unnecessary when a feature exists. **If no existing feature is found, ask the user before proceeding with a custom implementation — a relevant feature may exist under a different name or keyword.**
9
9
 
10
10
  ```
11
11
  npx @salesforce/webapps-features-experimental <command> [options]
package/dist/AGENT.md CHANGED
@@ -54,10 +54,12 @@ cd <sfdx-source>/webapplications/<appName>
54
54
 
55
55
  **Before finishing changes:** run `npm run build` and `npm run lint` from the web app directory; both must succeed.
56
56
 
57
- ## Agent rules (.a4drules)
57
+ ## Agent skills (.a4drules/skills/)
58
58
 
59
- This project includes **.a4drules/** at the project root. Follow them when generating or editing code.
59
+ This project includes **.a4drules/skills/** at the project root. Follow them when generating or editing code.
60
60
 
61
+ - **Creating Webapp** (`.a4drules/skills/creating-webapp/`): First steps, skills-first protocol, React/TypeScript constraints, deployment order, navigation, aesthetics, and code quality.
62
+ - **Building React Components** (`.a4drules/skills/building-react-components/`): Component/page/header-footer workflow, TypeScript standards, and mandatory lint+build verification.
61
63
  - **Accessing Data** (`.a4drules/skills/accessing-data/`): Use for all Salesforce data fetches. Enforces Data SDK usage (`createDataSDK()` + `sdk.graphql` or `sdk.fetch`); GraphQL preferred, fetch when GraphQL is not sufficient.
62
64
  - **Fetching REST API** (`.a4drules/skills/fetching-rest-api/`): Use when implementing Chatter, Connect REST, Apex REST, UI API REST, or Einstein LLM calls via `sdk.fetch`.
63
65
  - **Using GraphQL** (`.a4drules/skills/using-graphql/`): Use when implementing Salesforce GraphQL queries or mutations. Sub-skills: `exploring-graphql-schema`, `generating-graphql-read-query`, `generating-graphql-mutation-query`.
package/dist/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.109.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.109.0...v1.109.1) (2026-03-18)
7
+
8
+ **Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
9
+
10
+
11
+
12
+
13
+
6
14
  # [1.109.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.108.1...v1.109.0) (2026-03-18)
7
15
 
8
16
  **Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
@@ -15,8 +15,8 @@
15
15
  "graphql:schema": "node scripts/get-graphql-schema.mjs"
16
16
  },
17
17
  "dependencies": {
18
- "@salesforce/sdk-data": "^1.109.0",
19
- "@salesforce/webapp-experimental": "^1.109.0",
18
+ "@salesforce/sdk-data": "^1.109.1",
19
+ "@salesforce/webapp-experimental": "^1.109.1",
20
20
  "@tailwindcss/vite": "^4.1.17",
21
21
  "@tanstack/react-form": "^1.28.5",
22
22
  "class-variance-authority": "^0.7.1",
@@ -42,7 +42,7 @@
42
42
  "@graphql-eslint/eslint-plugin": "^4.1.0",
43
43
  "@graphql-tools/utils": "^11.0.0",
44
44
  "@playwright/test": "^1.49.0",
45
- "@salesforce/vite-plugin-webapp-experimental": "^1.109.0",
45
+ "@salesforce/vite-plugin-webapp-experimental": "^1.109.1",
46
46
  "@testing-library/jest-dom": "^6.6.3",
47
47
  "@testing-library/react": "^16.1.0",
48
48
  "@testing-library/user-event": "^14.5.2",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
3
- "version": "1.109.0",
3
+ "version": "1.109.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
9
- "version": "1.109.0",
9
+ "version": "1.109.1",
10
10
  "license": "SEE LICENSE IN LICENSE.txt",
11
11
  "devDependencies": {
12
12
  "@lwc/eslint-plugin-lwc": "^3.3.0",
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-base-sfdx-project-experimental",
3
- "version": "1.109.0",
3
+ "version": "1.109.1",
4
4
  "description": "Base SFDX project template",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "publishConfig": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/webapp-template-feature-react-file-upload-experimental",
3
- "version": "1.109.0",
3
+ "version": "1.109.1",
4
4
  "description": "File upload feature with a component to upload files to core",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "author": "",
@@ -41,7 +41,7 @@
41
41
  }
42
42
  },
43
43
  "devDependencies": {
44
- "@salesforce/webapp-experimental": "^1.109.0",
44
+ "@salesforce/webapp-experimental": "^1.109.1",
45
45
  "@types/react": "^19.2.7",
46
46
  "@types/react-dom": "^19.2.3",
47
47
  "nodemon": "^3.1.0",
@@ -1,42 +0,0 @@
1
- ---
2
- paths:
3
- - "**/*.tsx"
4
- - "**/components/**/*.ts"
5
- ---
6
-
7
- # Agentforce Conversation Client (standards)
8
-
9
- ## DO NOT build a chat UI from scratch
10
-
11
- When the user asks for a chat UI, chat widget, chatbot, agent, or conversational interface — **always use the existing `AgentforceConversationClient` component**. Never generate custom chat implementations, third-party chat libraries, WebSocket/REST chat, or direct calls to `embedAgentforceClient`.
12
-
13
- ## NEVER edit implementation files
14
-
15
- **CRITICAL: Only edit files where AgentforceConversationClient is USED, never the component implementation itself.**
16
-
17
- ❌ **DO NOT edit**: `AgentforceConversationClient.tsx`, `index.tsx`, or any files in:
18
-
19
- - `node_modules/@salesforce/webapp-template-feature-react-agentforce-conversation-client-experimental/`
20
- - `packages/template/feature/feature-react-agentforce-conversation-client/src/`
21
- - `src/components/AgentforceConversationClient.tsx` (patched templates)
22
-
23
- If you're reading a file named `AgentforceConversationClient.tsx`, stop and search for the USAGE instead.
24
-
25
- ## Invalid Props
26
-
27
- AgentforceConversationClient does NOT accept:
28
-
29
- - ❌ `containerStyle` - Use `width`/`height` props directly instead
30
- - ❌ `style` - Use `styleTokens` prop for theming
31
- - ❌ `className` - Not supported
32
-
33
- ## Styling
34
-
35
- **For ANY styling, theming, branding, or color changes - ONLY use `styleTokens` prop.**
36
-
37
- NEVER use: CSS files, `<style>` tags, `className`, inline styles, CSS modules, or CSS-in-JS libraries.
38
-
39
- ## Hard Constraints
40
-
41
- - **`agentId` is required** - Always ask the user for their agent ID before proceeding
42
- - **Use the React wrapper only** - Never call `embedAgentforceClient` directly
@@ -1,27 +0,0 @@
1
- ---
2
- paths:
3
- - "**/*.tsx"
4
- - "**/components/**/*.ts"
5
- ---
6
-
7
- # Analytics charts (standards)
8
-
9
- When adding or editing chart UI in this project, follow these conventions.
10
-
11
- ## Components and library
12
-
13
- - Use the shared **AnalyticsChart** component (and **ChartContainer** when a framed block is needed). Do not use raw Recharts components for standard line or bar charts.
14
- - The project must have **recharts** installed (`npm install recharts`).
15
-
16
- ## Data shape
17
-
18
- - **Time-series** (line): data must be an array of `{ x: string, y: number }`. Map raw fields (e.g. `date`, `value`) to these keys before passing to the chart.
19
- - **Categorical** (bar): data must be an array of `{ name: string, value: number }`. Map raw fields (e.g. `category`, `total`) accordingly.
20
-
21
- ## Theming
22
-
23
- - Use only the **theme** prop on AnalyticsChart: `red` (decline/loss), `green` (growth/gain), `neutral` (default or mixed). Do not introduce ad-hoc color schemes for these semantics.
24
-
25
- ## Placement
26
-
27
- - Render charts inside the existing application frame (e.g. main content or a route). Do not replace the full app shell with a single chart.
@@ -1,41 +0,0 @@
1
- ---
2
- name: building-analytics-charts
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
- ---
5
-
6
- # Analytics charts (workflow)
7
-
8
- When the user wants a chart or visualization from data, follow this workflow. Charts use **Recharts** via the **AnalyticsChart** component.
9
-
10
- ## Dependencies
11
-
12
- Ensure the following package is installed in the project:
13
-
14
- ```bash
15
- npm install recharts
16
- ```
17
-
18
- ## 1. Interpret data type
19
-
20
- - **Time-series**: data over time or ordered (dates, timestamps). Use a line chart. Raw shape often has date-like keys and a numeric value.
21
- - **Categorical**: data by category (labels, segments). Use a bar chart. Raw shape often has a category name and a numeric value.
22
-
23
- If the user says "over time", "trend", or uses date-like keys → time-series. If they say "by category", "by X", or use label-like keys → categorical.
24
-
25
- ## 2. Map data to chart shape
26
-
27
- - **Time-series**: produce `[{ x: string, y: number }, ...]` (e.g. map `date`→`x`, `value`→`y`).
28
- - **Categorical**: produce `[{ name: string, value: number }, ...]` (e.g. map `category`→`name`, `total`→`value`).
29
-
30
- See [schema-mapping.md](docs/schema-mapping.md) for examples.
31
-
32
- ## 3. Choose theme
33
-
34
- - **red**: declining, loss, negative trend.
35
- - **green**: growth, gain, positive trend.
36
- - **neutral**: default or mixed.
37
-
38
- ## 4. Generate and place the chart
39
-
40
- - Use **AnalyticsChart** with `chartType` (`"time-series"` or `"categorical"`), `data` (mapped array), `theme`, and optional `title`. Wrap in **ChartContainer** if the app uses it for chart blocks.
41
- - Insert the chart inside the existing app (e.g. main content or a route), not as the entire page.
@@ -1,4 +0,0 @@
1
- # Schema mapping (Recharts)
2
-
3
- - **Time-series**: `{ x: string, y: number }` — e.g. map `date`→`x`, `value`→`y`.
4
- - **Categorical**: `{ name: string, value: number }` — e.g. map `category`→`name`, `total`→`value`.
@@ -1,31 +0,0 @@
1
- ---
2
- description: Code quality and build validation standards
3
- paths:
4
- - "**/webapplications/**/*"
5
- ---
6
-
7
- # Code Quality & Build Validation
8
-
9
- Enforces ESLint, TypeScript, and build validation for consistent, maintainable code.
10
-
11
- ## MANDATORY Quality Gates
12
-
13
- **Before completing any coding session** (from the web app directory `force-app/main/default/webapplications/<appName>/`):
14
-
15
- ```bash
16
- npm run lint # MUST result in 0 errors
17
- npm run build # MUST succeed (includes TypeScript check)
18
- ```
19
-
20
- **Must Pass:**
21
- - `npm run build` completes successfully
22
- - No TypeScript compilation errors
23
- - No critical ESLint errors (0 errors)
24
-
25
- **Can Be Warnings:**
26
- - ESLint warnings (fix when convenient)
27
- - Minor TypeScript warnings
28
-
29
- ## When Failures Occur
30
-
31
- If `npm run lint` or `npm run build` fails, the agent **must** attempt to resolve the issues and retry. Do not leave the session with failing quality gates. Fix the reported errors (TypeScript, ESLint), then re-run the failing command. Repeat until all steps pass.
@@ -1,25 +0,0 @@
1
- ---
2
- description: Salesforce data access for web apps — when and how to use the accessing-data skill
3
- paths:
4
- - "**/*"
5
- ---
6
-
7
- # Web App Data Access
8
-
9
- For all Salesforce data access from web apps (GraphQL, REST, Chatter, Connect, Apex REST, UI API, Einstein LLM), invoke the **`accessing-data`** skill (`.a4drules/skills/accessing-data/`). It enforces Data SDK usage (`createDataSDK()` + `sdk.graphql` or `sdk.fetch`), GraphQL-first preference, optional chaining, and documents when to use `sdk.fetch` via the `fetching-rest-api` skill.
10
-
11
- ## Sub-skills
12
-
13
- - **GraphQL** — For queries and mutations, invoke the **`using-graphql`** skill (`.a4drules/skills/using-graphql/`). Covers schema exploration, query patterns, codegen, and type generation.
14
- - **REST / UI API** — When GraphQL cannot cover the use case, use `sdk.fetch?.()`. See the **`fetching-rest-api`** skill (`.a4drules/skills/fetching-rest-api/`) for Chatter, Connect REST, Apex REST, UI API REST, and Einstein LLM.
15
-
16
- ## Clarifying Vague Data Requests
17
-
18
- When a user asks about data and the request is vague, **clarify before implementing**. Ask which of the following they want:
19
-
20
- - **Application code** — Add or modify code in a specific web app so the app performs the data interaction at runtime (e.g., GraphQL query in the React app)
21
- - **Local SF CLI** — Run Salesforce CLI commands locally (e.g., `sf data query`, `sf data import tree`) to interact with the org from the terminal
22
- - **Local example data** — Update or add local fixture/example data files (e.g., JSON in `data/`) for development or testing
23
- - **Other** — Data export, report generation, setup script, etc.
24
-
25
- Do not assume. A request like "fetch accounts" could mean: (1) add a GraphQL query to the app, (2) run `sf data query` in the terminal, or (3) update sample data files. Confirm the intent before proceeding.
@@ -1,32 +0,0 @@
1
- ---
2
- description: Always invoke the deploying-to-salesforce skill for deployment, schema fetch, or org sync
3
- paths:
4
- - "**/*"
5
- ---
6
-
7
- # Web App Deployment
8
-
9
- **This rule always applies.** Before running any deployment, schema fetch, codegen, or org sync command, you MUST invoke the **deploying-to-salesforce** skill (`.a4drules/skills/deploying-to-salesforce/SKILL.md`).
10
-
11
- ## When to Invoke
12
-
13
- Invoke the skill whenever the task involves:
14
-
15
- - Deploying metadata (`sf project deploy start`)
16
- - Assigning permission sets, permission set groups, or profiles
17
- - Fetching GraphQL schema (`npm run graphql:schema`)
18
- - Running GraphQL codegen (`npm run graphql:codegen`)
19
- - Data import or cleaning existing records
20
- - Any command that touches the Salesforce org
21
-
22
- ## Required Behavior
23
-
24
- 1. **Read the skill first** — Open and read the full deploying-to-salesforce skill before executing deployment-related steps.
25
- 2. **Follow the canonical sequence** — Execute steps in the exact order defined in the skill.
26
- 3. **Evaluate before each step** — Use the skill's "Run when" / "Omit when" criteria; do not run steps blindly.
27
- 4. **Proactive post-deploy actions** — After a successful deploy, the agent MUST either run or explicitly offer:
28
- - **Permission set assignment:** Discover permsets in `force-app/main/default/permissionsets/` and assign each to the org (or ask: "Do you want me to assign the permission sets?")
29
- - **Data import:** If `data/data-plan.json` exists, ask: "Do you want me to import the sample data now?" — never import without explicit user confirmation.
30
- 5. **Ask before data operations** — Never import data or clean existing records without explicit user confirmation.
31
-
32
- Do not bypass this skill. It enforces the correct deployment order and prevents schema/codegen failures.
@@ -1,43 +0,0 @@
1
- ---
2
- description: Strict TypeScript standards for type-safe React applications
3
- paths:
4
- - "**/webapplications/**/*"
5
- ---
6
-
7
- ## Type Safety Rules
8
-
9
- ### Never Use `any`
10
- ```typescript
11
- // FORBIDDEN
12
- const result: any = getSomething();
13
- ```
14
-
15
- ## React TypeScript Patterns
16
-
17
- ### Event Handlers
18
- ```typescript
19
- const handleSubmit = (event: React.FormEvent<HTMLFormElement>): void => {
20
- event.preventDefault();
21
- };
22
- ```
23
-
24
- ### State and Hooks
25
- ```typescript
26
- // Type useState properly
27
- const [user, setUser] = useState<User | null>(null);
28
- ```
29
-
30
- ### Type Assertions
31
- ```typescript
32
- // FORBIDDEN: Unsafe assertions
33
- const user = obj as User;
34
-
35
- // REQUIRED: Type guards
36
- function isUser(obj: unknown): obj is User {
37
- return typeof obj === 'object' && obj !== null && typeof (obj as User).id === 'string';
38
- }
39
-
40
- if (isUser(obj)) {
41
- console.log(obj.name); // Now safely typed
42
- }
43
- ```
@@ -1,28 +0,0 @@
1
- ---
2
- description: React-specific patterns for SFDX web apps
3
- paths:
4
- - "**/webapplications/**/*"
5
- ---
6
-
7
- # React Web App (SFDX)
8
-
9
- For layout, navigation, and generation rules, see **creating-webapp** (`.a4drules/skills/creating-webapp/SKILL.md`).
10
-
11
- ## Deployment
12
-
13
- For deployment, schema fetch, codegen, or org sync, invoke the **`deploying-to-salesforce`** skill (`.a4drules/skills/deploying-to-salesforce/`).
14
-
15
- ## Routing (React Router)
16
-
17
- Use a **single** router package for the app. When using `createBrowserRouter` and `RouterProvider` from `react-router`, all routing imports MUST come from **`react-router`** — not from `react-router-dom`.
18
-
19
- ## Component Library + Styling (MANDATORY)
20
-
21
- - Use **shadcn/ui** for UI components: `import { Button } from '@/components/ui/button';`
22
- - Use **Tailwind CSS** utility classes
23
-
24
- ## Module & Platform Restrictions
25
-
26
- React apps must NOT import Salesforce platform modules like `lightning/*` or `@wire` (LWC-only)
27
-
28
- For Salesforce data access, see **webapp-data-access** (`.a4drules/webapp-data-access.md`).
@@ -1,23 +0,0 @@
1
- ---
2
- description: Always search for and read relevant skills before starting any task
3
- paths:
4
- - "**/webapplications/**/*"
5
- ---
6
-
7
- # Skills-First Protocol (MUST FOLLOW)
8
-
9
- **Before planning, executing any task, generating code, or running terminal commands**, you MUST explicitly check if an existing Skill is available to handle the request. Do not default to manual implementation if a specialized domain Skill exists.
10
-
11
- ## Pre-Task Sequence
12
- 1. **Skill Discovery:** Review the names and descriptions of all available/loaded Skills in your current context.
13
- 2. **Match Analysis:** Evaluate if the user's current task aligns with any Skill's described use case (e.g., code reviews, PR generation, database migrations, specific framework debugging).
14
- 3. **Explicit Declaration:** If a matching Skill is found, your first output MUST be:
15
- > "Skill identified: [Skill Name]. Executing via Skill instructions..."
16
- You must then strictly adhere to the instructions defined in that specific Skill.
17
-
18
- ## Prohibited Actions
19
- * Do not write custom utility scripts or complex bash commands for a workflow that is already covered by a loaded Skill.
20
- * Do not bypass or ignore the loaded `SKILL.md` instructions if a relevant Skill is triggered.
21
-
22
- ## Manual Fallback
23
- Only proceed with standard/manual execution if you have actively evaluated your available Skills and confirmed that no relevant Skill exists for the current prompt.