@salesforce/afv-skills 1.2.0 → 1.4.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.
- package/package.json +5 -4
- package/skills/building-webapp-data-visualization/SKILL.md +72 -0
- package/skills/building-webapp-data-visualization/implementation/bar-line-chart.md +316 -0
- package/skills/building-webapp-data-visualization/implementation/dashboard-layout.md +189 -0
- package/skills/building-webapp-data-visualization/implementation/donut-chart.md +181 -0
- package/skills/building-webapp-data-visualization/implementation/stat-card.md +150 -0
- package/skills/building-webapp-react-components/SKILL.md +96 -0
- package/skills/building-webapp-react-components/implementation/component.md +78 -0
- package/skills/building-webapp-react-components/implementation/header-footer.md +132 -0
- package/skills/building-webapp-react-components/implementation/page.md +93 -0
- package/skills/configuring-webapp-csp-trusted-sites/SKILL.md +90 -0
- package/skills/configuring-webapp-csp-trusted-sites/implementation/metadata-format.md +281 -0
- package/skills/configuring-webapp-metadata/SKILL.md +158 -0
- package/skills/creating-webapp/SKILL.md +140 -0
- package/skills/deploying-webapp-to-salesforce/SKILL.md +226 -0
- package/skills/{salesforce-custom-application → generating-custom-application}/SKILL.md +2 -3
- package/skills/{salesforce-custom-field → generating-custom-field}/SKILL.md +2 -2
- package/skills/{salesforce-custom-lightning-type → generating-custom-lightning-type}/SKILL.md +37 -3
- package/skills/{salesforce-custom-object → generating-custom-object}/SKILL.md +2 -2
- package/skills/{salesforce-custom-tab → generating-custom-tab}/SKILL.md +2 -2
- package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/SKILL.md +2 -2
- package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/handle-ui-components.md +1 -1
- package/skills/generating-experience-react-site/SKILL.md +67 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-custom-site.md +41 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience-bundle.md +17 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience-config.md +21 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-digital-experience.md +38 -0
- package/skills/generating-experience-react-site/docs/configure-metadata-network.md +72 -0
- package/skills/{salesforce-flexipage → generating-flexipage}/SKILL.md +87 -10
- package/skills/{salesforce-flow → generating-flow}/SKILL.md +2 -2
- package/skills/{salesforce-fragment → generating-fragment}/SKILL.md +2 -2
- package/skills/generating-lightning-app/SKILL.md +423 -0
- package/skills/{salesforce-list-view → generating-list-view}/SKILL.md +2 -2
- package/skills/{generate-permission-set → generating-permission-set}/SKILL.md +2 -2
- package/skills/{salesforce-validation-rule → generating-validation-rule}/SKILL.md +2 -2
- package/skills/implementing-webapp-file-upload/SKILL.md +396 -0
- package/skills/installing-webapp-features/SKILL.md +210 -0
- package/skills/managing-webapp-agentforce-conversation-client/SKILL.md +186 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/constraints.md +134 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/examples.md +132 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/style-tokens.md +101 -0
- package/skills/managing-webapp-agentforce-conversation-client/references/troubleshooting.md +57 -0
- package/skills/switching-org/SKILL.md +28 -0
- package/skills/trigger-refactor-pipeline/SKILL.md +1 -1
- package/skills/using-webapp-salesforce-data/SKILL.md +363 -0
- package/skills/using-webapp-salesforce-data/graphql-search.sh +139 -0
- package/skills/salesforce-lightning-app-build/SKILL.md +0 -346
- package/skills/salesforce-web-app-creating-records/SKILL.md +0 -84
- package/skills/salesforce-web-app-feature/SKILL.md +0 -70
- package/skills/salesforce-web-app-list-and-create-records/SKILL.md +0 -36
- package/skills/salesforce-web-application/SKILL.md +0 -34
- /package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/bootstrap-template-byo-lwr.md +0 -0
- /package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/configure-content-brandingSet.md +0 -0
- /package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/configure-content-route.md +0 -0
- /package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/configure-content-themeLayout.md +0 -0
- /package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/configure-content-view.md +0 -0
- /package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/configure-guest-sharing-rules.md +0 -0
- /package/skills/{salesforce-experience-lwr-site → generating-experience-lwr-site}/docs/handle-component-and-region-ids.md +0 -0
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: creating-webapp
|
|
3
|
+
description: "Use this skill when creating or setting up a new SFDX React web application. Covers first steps, npm install, skills-first protocol, deployment order, and core web app rules."
|
|
4
|
+
paths:
|
|
5
|
+
- "**/webapplications/**/*"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# First Steps (MUST FOLLOW)
|
|
9
|
+
|
|
10
|
+
**Always run `npm install` before doing anything else** when working in a web app directory (e.g. `force-app/main/default/webapplications/<appName>/` or a dist app path). Dependencies must be installed before running `npm run dev`, `npm run build`, `npm run lint`, or any other script. If `node_modules` is missing or stale, commands will fail.
|
|
11
|
+
|
|
12
|
+
# Skills-First (MUST FOLLOW)
|
|
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/`.
|
|
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.
|
|
18
|
+
|
|
19
|
+
# Deployment Order (MUST FOLLOW)
|
|
20
|
+
|
|
21
|
+
**Metadata deployments must complete before fetching GraphQL schema or running codegen.** The schema reflects the current org state; custom objects and fields appear only after metadata is deployed. Running schema fetch or codegen too early produces incomplete or incorrect types.
|
|
22
|
+
|
|
23
|
+
**Invoke the `deploying-to-salesforce` skill** (`.a4drules/skills/deploying-to-salesforce/`) whenever the task involves:
|
|
24
|
+
- Deploying metadata (objects, permission sets, layouts)
|
|
25
|
+
- Fetching GraphQL schema (`npm run graphql:schema`)
|
|
26
|
+
- Running GraphQL codegen (`npm run graphql:codegen`)
|
|
27
|
+
- Generating deploy/setup commands or syncing with the org
|
|
28
|
+
|
|
29
|
+
The skill enforces the correct sequence: **deploy metadata → assign permset → schema fetch → codegen**.
|
|
30
|
+
|
|
31
|
+
**Critical rules:**
|
|
32
|
+
- Do **not** run `npm run graphql:schema` before metadata (objects, permission sets) is deployed — the schema will not include custom objects/fields.
|
|
33
|
+
- Do **not** skip schema refetch after any metadata deployment — re-run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir.
|
|
34
|
+
|
|
35
|
+
# Web App Generation
|
|
36
|
+
|
|
37
|
+
## Before `sf webapp generate`
|
|
38
|
+
|
|
39
|
+
**Webapp name (`-n`):** Must be **alphanumerical only**—no spaces, hyphens, underscores, or special characters. Use only letters (A–Z, a–z) and digits (0–9). Example: `CoffeeBoutique` not `Coffee Boutique`.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
sf webapp generate -n MyWebApp -t reactbasic
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Do not use `create-react-app`, Vite, or other generic scaffolds; use `sf webapp generate` so the app is SFDX-aware.
|
|
46
|
+
|
|
47
|
+
## After Generation (MANDATORY)
|
|
48
|
+
|
|
49
|
+
After generating or when touching an existing app:
|
|
50
|
+
|
|
51
|
+
1. **Replace all default boilerplate** — "React App", "Vite + React", default `<title>`, placeholder text in shell. Use the actual app name.
|
|
52
|
+
2. **Populate the home page** — Never leave it as default template. Add real content: landing section, banners, hero, navigation to features.
|
|
53
|
+
3. **Update navigation and placeholders** — See [Navigation & Layout section](#navigation--layout-mandatory) below.
|
|
54
|
+
|
|
55
|
+
# Navigation & Layout (MANDATORY)
|
|
56
|
+
|
|
57
|
+
Agents consistently miss these. **You must not leave them default.**
|
|
58
|
+
|
|
59
|
+
## appLayout.tsx is the Source of Truth
|
|
60
|
+
|
|
61
|
+
- **Build navigation into the app layout** (`appLayout.tsx`). The layout must include nav (header, sidebar, or both) so every page shares the same shell.
|
|
62
|
+
- Path: `force-app/main/default/webapplications/<appName>/src/appLayout.tsx`
|
|
63
|
+
|
|
64
|
+
## When Making UI Changes
|
|
65
|
+
|
|
66
|
+
**When making any change** that affects navigation, header, footer, sidebar, theme, or overall layout:
|
|
67
|
+
|
|
68
|
+
1. **You MUST edit `src/appLayout.tsx`** (the layout used by `routes.tsx`).
|
|
69
|
+
2. Do not only edit pages/components and leave `appLayout.tsx` unchanged.
|
|
70
|
+
3. Before finishing: confirm you opened and modified `appLayout.tsx`. If you did not, the task is incomplete.
|
|
71
|
+
|
|
72
|
+
## Navigation Menu (Critical)
|
|
73
|
+
|
|
74
|
+
- **Always edit the navigation menu** in `appLayout.tsx`. Replace default nav items and labels with **app-specific** links and names.
|
|
75
|
+
- Do **not** leave template items (e.g. "Home", "About", generic placeholder links).
|
|
76
|
+
- Use real routes and labels matching the app (e.g. "Dashboard", "Products", "Orders").
|
|
77
|
+
|
|
78
|
+
**Check before finishing:** Did I change the nav items and labels to match this app?
|
|
79
|
+
|
|
80
|
+
## Placeholder Name & Design (Critical)
|
|
81
|
+
|
|
82
|
+
- **Replace the placeholder app name** everywhere: header, nav brand/logo, footer, `<title>` in `index.html`, any "Welcome to…" text.
|
|
83
|
+
- **Replace placeholder design** in the shell: default header/footer styling, generic branding.
|
|
84
|
+
|
|
85
|
+
**Check before finishing:** Is the app name and shell design still the template default? If yes, update it.
|
|
86
|
+
|
|
87
|
+
## Where to Edit
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
| What | Where |
|
|
91
|
+
| ------------------- | -------------------------------------------------------------------- |
|
|
92
|
+
| Layout/nav/branding | `force-app/main/default/webapplications/<appName>/src/appLayout.tsx` |
|
|
93
|
+
| Document title | `force-app/main/default/webapplications/<appName>/index.html` |
|
|
94
|
+
| Root page content | Component at root route (often `Home` in `routes.tsx`) |
|
|
95
|
+
|
|
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 **using-salesforce-data** skill.
|
|
115
|
+
|
|
116
|
+
# Frontend Aesthetics
|
|
117
|
+
|
|
118
|
+
**Avoid AI slop.** Make creative, distinctive frontends:
|
|
119
|
+
|
|
120
|
+
- **Typography:** Avoid Inter, Roboto, Arial, Space Grotesk as defaults. Choose distinctive fonts.
|
|
121
|
+
- **Color:** Use cohesive color with sharp accents via CSS variables. Avoid purple-on-white clichés.
|
|
122
|
+
- **Motion:** Use high-impact motion (e.g. staggered reveals).
|
|
123
|
+
- **Depth:** Add atmosphere/depth in backgrounds.
|
|
124
|
+
|
|
125
|
+
# Shell Command Safety (MUST FOLLOW)
|
|
126
|
+
|
|
127
|
+
**Never use complex `node -e` one-liners** for file edits or multi-line transforms. They break in Zsh due to `!` history expansion and backtick interpolation. Use a temporary `.js` file, `sed`/`awk`, `jq`, or IDE file-editing tools instead.
|
|
128
|
+
|
|
129
|
+
# Development Cycle
|
|
130
|
+
|
|
131
|
+
- Execute tasks continuously until all planned items complete in the current iteration.
|
|
132
|
+
- Maintain a running checklist and proceed sequentially.
|
|
133
|
+
|
|
134
|
+
## Stop Conditions
|
|
135
|
+
|
|
136
|
+
Only stop when:
|
|
137
|
+
|
|
138
|
+
- All checklist items are completed and quality gates pass, or
|
|
139
|
+
- A blocking error cannot be resolved after reasonable remediation, or
|
|
140
|
+
- The user explicitly asks to pause.
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deploying-webapp-to-salesforce
|
|
3
|
+
description: "Enforces the correct order for deploying metadata, assigning permission sets, and fetching GraphQL schema. Use for ANY deployment to a Salesforce org — webapps, LWC, Aura, Apex, metadata, schema fetch, or org sync. Codifies setup-cli.mjs."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Deploying to Salesforce
|
|
7
|
+
|
|
8
|
+
Guidance for AI agents deploying metadata to a Salesforce org or syncing with the org. **The order of operations is critical.** This skill codifies the exact sequence from `scripts/setup-cli.mjs` and documents **every Salesforce interaction**.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
Invoke this skill whenever the task involves:
|
|
13
|
+
|
|
14
|
+
- Deploying metadata (objects, permission sets, layouts, Apex, web applications)
|
|
15
|
+
- Generating deploy commands or setup instructions
|
|
16
|
+
- Fetching the GraphQL schema (`npm run graphql:schema`)
|
|
17
|
+
- Running GraphQL codegen (`npm run graphql:codegen`)
|
|
18
|
+
- Full org setup (login, deploy, permset, data, schema, build)
|
|
19
|
+
- Any manual step that touches the Salesforce org
|
|
20
|
+
|
|
21
|
+
## Canonical Sequence (from setup-cli.mjs)
|
|
22
|
+
|
|
23
|
+
Execute steps in this **exact order**. Steps marked **(SF)** perform a Salesforce API or CLI interaction.
|
|
24
|
+
|
|
25
|
+
### Step 1: Login — org authentication
|
|
26
|
+
|
|
27
|
+
| Action | Salesforce interaction? | Command |
|
|
28
|
+
|--------|-------------------------|---------|
|
|
29
|
+
| Check if org is connected | **(SF)** | `sf org display --target-org <alias> --json` |
|
|
30
|
+
| If not connected: authenticate | **(SF)** | `sf org login web --alias <alias>` |
|
|
31
|
+
|
|
32
|
+
- **Run when:** Org is not connected. **Omit when:** Org is already authenticated (check via `sf org display`).
|
|
33
|
+
- All subsequent steps require an authenticated org.
|
|
34
|
+
|
|
35
|
+
### Step 2: Webapp build — pre-deploy (required for entity deployment)
|
|
36
|
+
|
|
37
|
+
| Action | Salesforce interaction? | Command |
|
|
38
|
+
|--------|-------------------------|---------|
|
|
39
|
+
| Install dependencies | No | `npm install` (in each webapp dir) |
|
|
40
|
+
| Build web app | No | `npm run build` (in each webapp dir) |
|
|
41
|
+
|
|
42
|
+
- Produces `dist/` so `sf project deploy start` can deploy web application entities. Run **before** deploy when deploying web apps.
|
|
43
|
+
- **Run when:** Deploying web apps AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** Not deploying, or `dist/` is current and no source changes.
|
|
44
|
+
|
|
45
|
+
### Step 3: Deploy metadata
|
|
46
|
+
|
|
47
|
+
| Action | Salesforce interaction? | Command |
|
|
48
|
+
|--------|-------------------------|---------|
|
|
49
|
+
| Deploy metadata | **(SF)** | See below |
|
|
50
|
+
|
|
51
|
+
**Check for a manifest (package.xml) first.** Only use it if present:
|
|
52
|
+
|
|
53
|
+
- **If `manifest/package.xml` (or `package.xml`) exists:** Deploy using the manifest:
|
|
54
|
+
```bash
|
|
55
|
+
sf project deploy start --manifest manifest/package.xml --target-org <alias>
|
|
56
|
+
```
|
|
57
|
+
- **If no manifest exists:** Deploy all metadata from the project (packageDirectories in sfdx-project.json):
|
|
58
|
+
```bash
|
|
59
|
+
sf project deploy start --target-org <alias>
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Do not assume a manifest exists. Check the project root and common locations (e.g., `manifest/`, `config/`) before choosing the deploy command.
|
|
63
|
+
|
|
64
|
+
- Deploys objects, layouts, permission sets, Apex classes, web applications, and all other metadata.
|
|
65
|
+
- **Must complete successfully before schema fetch** — the schema reflects org state; custom objects/fields appear only after deployment.
|
|
66
|
+
- **Run when:** Metadata has changed since last deploy, or never deployed. **Omit when:** No metadata changes and deploy has already run successfully.
|
|
67
|
+
|
|
68
|
+
### Step 4: Post-deployment configuration — assign permissions and configure
|
|
69
|
+
|
|
70
|
+
| Action | Salesforce interaction? | Command |
|
|
71
|
+
|--------|-------------------------|---------|
|
|
72
|
+
| Assign permission set or group | **(SF)** | `sf org assign permset --name <name> --target-org <alias>` (works for both permsets and permset groups) |
|
|
73
|
+
| Assign profile to user | **(SF)** | `sf data update record` or at user creation |
|
|
74
|
+
| Other post-deploy config | **(SF)** | Varies (e.g., named credentials, connected apps, custom settings) |
|
|
75
|
+
|
|
76
|
+
**Example commands:**
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Permission set (assigns to default user of target org)
|
|
80
|
+
sf org assign permset --name Property_Management_Access --target-org myorg
|
|
81
|
+
|
|
82
|
+
# Permission set group (same command; pass the group name)
|
|
83
|
+
sf org assign permset --name My_Permset_Group --target-org myorg
|
|
84
|
+
|
|
85
|
+
# Assign to a specific user
|
|
86
|
+
sf org assign permset --name Property_Management_Access --target-org myorg --on-behalf-of user@example.com
|
|
87
|
+
|
|
88
|
+
# Profile — update existing user's profile (requires ProfileId and User Id)
|
|
89
|
+
sf data update record --sobject User --record-id <userId> --values "ProfileId=<profileId>" --target-org myorg
|
|
90
|
+
|
|
91
|
+
# Profile — get ProfileId first
|
|
92
|
+
sf data query --query "SELECT Id, Name FROM Profile WHERE Name='Standard User'" --target-org myorg
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
- **Deploying does not mean assigning.** Even after permission sets, permission set groups, and profiles are deployed to the org, they must be explicitly assigned or configured for users. Deployment makes them available; assignment/configuration grants access.
|
|
96
|
+
- **Permission sets** — Assign to users so they have access to custom objects and fields. Required for GraphQL introspection to return the correct schema.
|
|
97
|
+
- **Permission set groups** — Assign to users when using grouped permission sets.
|
|
98
|
+
- **Profiles** — Ensure users have the correct profile; profile assignment may be done at user creation or via Setup.
|
|
99
|
+
- **Other post-deploy configuration** — Named credentials, connected apps, custom settings, flow activation, and any metadata that requires manual configuration after deploy.
|
|
100
|
+
- All of the above must exist in the org (deployed in Step 3).
|
|
101
|
+
- **Run when:** Any permission set, permission set group, profile, or other post-deploy config was deployed or changed and not yet assigned/configured. **Omit when:** All required assignments and configuration are already in place.
|
|
102
|
+
|
|
103
|
+
**Proactive behavior:** After a successful deploy, discover permission sets in the project (e.g., `force-app/main/default/permissionsets/*.permissionset-meta.xml`) and assign each one. Extract the API name from the filename (e.g., `Property_Management_Access.permissionset-meta.xml` → `Property_Management_Access`). If the user has not explicitly requested a full setup, you may ask: "Do you want me to assign the permission sets to your org?" — but do not skip this step silently; either run it or ask.
|
|
104
|
+
|
|
105
|
+
### Step 5: Data — prepare and import (optional)
|
|
106
|
+
|
|
107
|
+
| Action | Salesforce interaction? | Command |
|
|
108
|
+
|--------|-------------------------|---------|
|
|
109
|
+
| Prepare unique fields | No | `node scripts/prepare-import-unique-fields.js --data-dir <dataDir>` |
|
|
110
|
+
| Clean existing records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per sobject, reverse plan order) |
|
|
111
|
+
| Import records | **(SF)** | `sf apex run --target-org <alias> --file <apex>` (per batch) |
|
|
112
|
+
|
|
113
|
+
- Only runs if `data/data-plan.json` and `data/` exist.
|
|
114
|
+
- Delete runs in reverse plan order (children before parents).
|
|
115
|
+
- Import uses Anonymous Apex with `Database.DMLOptions.duplicateRuleHeader.allowSave = true`.
|
|
116
|
+
- **Run when:** Data plan exists AND (never imported OR data files or plan changed). **Omit when:** No data plan, or data already imported and unchanged.
|
|
117
|
+
|
|
118
|
+
**Proactive behavior:** If `data/data-plan.json` and `data/` exist, you MUST ask the user: "Do you want me to import the sample data now? This will prepare unique fields, optionally clean existing records, and import data. Reply yes to proceed." Do not skip this step silently; either run it (after confirmation) or ask. Never import or clean without explicit user confirmation.
|
|
119
|
+
|
|
120
|
+
### Step 6: GraphQL schema and codegen
|
|
121
|
+
|
|
122
|
+
| Action | Salesforce interaction? | Command |
|
|
123
|
+
|--------|-------------------------|---------|
|
|
124
|
+
| Install webapp deps | No | `npm install` (in webapp dir) |
|
|
125
|
+
| Set default org | **(SF)** | `sf config set target-org <alias> --global` |
|
|
126
|
+
| Fetch schema (introspection) | **(SF)** | `npm run graphql:schema` (from webapp dir) |
|
|
127
|
+
| Generate types | No | `npm run graphql:codegen` (from webapp dir) |
|
|
128
|
+
|
|
129
|
+
- `graphql:schema` performs GraphQL introspection against the org — a **Salesforce API call**.
|
|
130
|
+
- Schema is written to `schema.graphql` at the SFDX project root.
|
|
131
|
+
- Codegen reads the schema file locally; no Salesforce interaction.
|
|
132
|
+
- **Run when:** Schema does not exist, OR metadata was deployed/changed since last schema fetch, OR permissions or post-deploy config was assigned since last schema fetch. **Omit when:** Schema exists and is current relative to org state.
|
|
133
|
+
|
|
134
|
+
### Step 7: Webapp build (if not done in Step 2)
|
|
135
|
+
|
|
136
|
+
| Action | Salesforce interaction? | Command |
|
|
137
|
+
|--------|-------------------------|---------|
|
|
138
|
+
| Build web app | No | `npm run build` (in webapp dir) |
|
|
139
|
+
|
|
140
|
+
- **Run when:** Build is needed (e.g., for dev server or deploy) AND (`dist/` does not exist OR webapp source has changed since last build). **Omit when:** `dist/` is current and no build needed.
|
|
141
|
+
|
|
142
|
+
### Step 8: Dev server (optional)
|
|
143
|
+
|
|
144
|
+
| Action | Salesforce interaction? | Command |
|
|
145
|
+
|--------|-------------------------|---------|
|
|
146
|
+
| Launch dev server | No | `npm run dev` (in webapp dir) |
|
|
147
|
+
|
|
148
|
+
- **Run when:** User requests to launch the dev server. **Omit when:** Not requested.
|
|
149
|
+
|
|
150
|
+
## Summary: All Salesforce Interactions (in order)
|
|
151
|
+
|
|
152
|
+
1. `sf org display` — check org connection
|
|
153
|
+
2. `sf org login web` — authenticate (if needed)
|
|
154
|
+
3. `sf project deploy start` — deploy metadata
|
|
155
|
+
4. `sf org assign permset` (permsets and permset groups) / profile assignment / other post-deploy config — assign permissions and configure
|
|
156
|
+
5. `sf apex run` — delete existing data (if data plan)
|
|
157
|
+
6. `sf apex run` — import data (if data plan)
|
|
158
|
+
7. `sf config set target-org` — set default org for schema
|
|
159
|
+
8. `npm run graphql:schema` — GraphQL introspection (Salesforce API)
|
|
160
|
+
|
|
161
|
+
## Post-Deploy Checklist (MUST NOT SKIP)
|
|
162
|
+
|
|
163
|
+
After **every successful metadata deploy**, the agent MUST address these before considering the task complete:
|
|
164
|
+
|
|
165
|
+
1. **Permission sets** — Discover `force-app/main/default/permissionsets/*.permissionset-meta.xml`, extract API names, and assign each via `sf org assign permset --name <name> --target-org <alias>`. If unsure, ask: "Do you want me to assign the permission sets (e.g., Property_Management_Access, Tenant_Maintenance_Access) to your org?"
|
|
166
|
+
2. **Data import** — If `data/data-plan.json` exists, ask: "Do you want me to import the sample data now? Reply yes to proceed." Do not import without confirmation.
|
|
167
|
+
3. **Schema refetch** — Run `npm run graphql:schema` and `npm run graphql:codegen` from the webapp dir (required after deploy).
|
|
168
|
+
|
|
169
|
+
Do not silently skip permission set assignment or data import. Either run them or ask the user.
|
|
170
|
+
|
|
171
|
+
## Agent Decision Criteria
|
|
172
|
+
|
|
173
|
+
Evaluate each step before running it. Ask:
|
|
174
|
+
|
|
175
|
+
- **Has this step ever run before?** If not, it is likely needed.
|
|
176
|
+
- **Have changes been made that require this step?** (e.g., metadata edits → deploy; deploy → schema refetch)
|
|
177
|
+
- **Is the current state sufficient?** (e.g., org connected, schema exists and is current, permissions and post-deploy config assigned)
|
|
178
|
+
|
|
179
|
+
Do not rely on CLI flags. Decide based on project state and what has changed.
|
|
180
|
+
|
|
181
|
+
## Evaluation: When Each Step Touches Salesforce
|
|
182
|
+
|
|
183
|
+
| Step | Salesforce interaction | Run when |
|
|
184
|
+
|------|------------------------|----------|
|
|
185
|
+
| 1. Login | Yes | Org not connected |
|
|
186
|
+
| 2. Webapp build | No | Deploying web apps AND dist missing or source changed |
|
|
187
|
+
| 3. Deploy | Yes | Metadata changed or never deployed |
|
|
188
|
+
| 4. Post-deploy config | Yes | Permission sets, permset groups, profiles, or other config deployed/changed and not assigned |
|
|
189
|
+
| 5. Data | Yes | Data plan exists AND (never imported OR data changed) |
|
|
190
|
+
| 6. GraphQL | Yes (schema only) | Schema missing or metadata/permissions changed since last fetch |
|
|
191
|
+
| 7. Webapp build | No | Build needed AND dist missing or source changed |
|
|
192
|
+
| 8. Dev | No | User requests dev server |
|
|
193
|
+
|
|
194
|
+
**Critical rule:** Steps 3 (deploy) and 4 (post-deploy config) must complete **before** step 6 (graphql:schema). The schema reflects the org state; running introspection too early yields an incomplete schema.
|
|
195
|
+
|
|
196
|
+
## Schema Refetch Rule (CRITICAL)
|
|
197
|
+
|
|
198
|
+
**After any metadata deployment**, you MUST re-run schema fetch and codegen:
|
|
199
|
+
|
|
200
|
+
- New custom objects
|
|
201
|
+
- New custom fields
|
|
202
|
+
- New or updated permission sets
|
|
203
|
+
- Any change to metadata that affects the GraphQL schema
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# From webapp dir (force-app/main/default/webapplications/<appName>/)
|
|
207
|
+
npm run graphql:schema
|
|
208
|
+
npm run graphql:codegen
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Do **not** assume the existing `schema.graphql` is current after metadata changes.
|
|
212
|
+
|
|
213
|
+
## One-Command Setup (Reference)
|
|
214
|
+
|
|
215
|
+
The project includes `scripts/setup-cli.mjs` which runs this sequence in batch. Use it when the user wants a full setup; otherwise, follow this skill and run only the steps that are needed based on current state.
|
|
216
|
+
|
|
217
|
+
## Prohibited Actions
|
|
218
|
+
|
|
219
|
+
- **Do not** run `npm run graphql:schema` before metadata is deployed — the schema will not include custom objects/fields
|
|
220
|
+
- **Do not** skip schema refetch after deploying new metadata — types and queries will be out of sync
|
|
221
|
+
- **Do not** assign permissions or configure before deploying — permission sets, permset groups, and profiles must exist in the org first
|
|
222
|
+
- **Do not** run GraphQL introspection before assigning permissions — the user may lack FLS for custom fields
|
|
223
|
+
|
|
224
|
+
## Related Skills
|
|
225
|
+
|
|
226
|
+
- **using-salesforce-data** — Full data access workflow (GraphQL queries/mutations, REST APIs, schema exploration, webapp integration)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Use this skill when users need to create or configure Salesforce Custom Applications. Trigger when users mention custom apps, application metadata, app navigation, or organizing tabs into applications. Use when users want to create app containers for tabs and pages. Always use this skill for custom application work.
|
|
2
|
+
name: generating-custom-application
|
|
3
|
+
description: "Use this skill when users need to create or configure Salesforce Custom Applications. Trigger when users mention custom apps, application metadata, app navigation, or organizing tabs into applications. Use when users want to create app containers for tabs and pages. Always use this skill for custom application work."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## When to Use This Skill
|
|
@@ -11,7 +11,6 @@ Use this skill when you need to:
|
|
|
11
11
|
- Configure application navigation and branding
|
|
12
12
|
- Set up custom page layouts for objects
|
|
13
13
|
- Troubleshoot deployment errors related to custom applications
|
|
14
|
-
|
|
15
14
|
# CustomApplication (Lightning App) Metadata Specification
|
|
16
15
|
|
|
17
16
|
## Overview
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Use this skill when users need to create, generate, or validate Salesforce Custom Field metadata. Trigger when users mention custom fields, field types, Roll-up Summary fields, Master-Detail relationships, Lookup relationships, formula fields, picklists, or field metadata. Also use when users encounter field deployment errors, especially around Roll-up Summary format, Master-Detail constraints, or formula issues. Always use this skill for any custom field metadata work, field generation, or field troubleshooting.
|
|
2
|
+
name: generating-custom-field
|
|
3
|
+
description: "Use this skill when users need to create, generate, or validate Salesforce Custom Field metadata. Trigger when users mention custom fields, field types, Roll-up Summary fields, Master-Detail relationships, Lookup relationships, formula fields, picklists, or field metadata. Also use when users encounter field deployment errors, especially around Roll-up Summary format, Master-Detail constraints, or formula issues. Always use this skill for any custom field metadata work, field generation, or field troubleshooting."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## When to Use This Skill
|
package/skills/{salesforce-custom-lightning-type → generating-custom-lightning-type}/SKILL.md
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Use this skill when users need to create Custom Lightning Types (CLTs) for Einstein Agent actions or structured input/output schemas. Trigger when users mention CLT, Custom Lightning Types, JSON schemas for agents, type definitions, lightning__objectType, or editor/renderer configurations. This is complex - always use this skill for CLT work.
|
|
2
|
+
name: generating-custom-lightning-type
|
|
3
|
+
description: "Use this skill when users need to create Custom Lightning Types (CLTs) for Einstein Agent actions or structured input/output schemas. Trigger when users mention CLT, Custom Lightning Types, JSON schemas for agents, type definitions, lightning__objectType, or editor/renderer configurations. This is complex - always use this skill for CLT work."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## When to Use This Skill
|
|
@@ -103,9 +103,11 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
103
103
|
- Top-level `editor` object.
|
|
104
104
|
- Use `editor.componentOverrides` for component overrides.
|
|
105
105
|
- Use `editor.layout` for layout.
|
|
106
|
+
- **DEPRECATED**: Do NOT use `propertyRenderers` or `view` — these are legacy keys. Always use `componentOverrides` and `layout` instead.
|
|
106
107
|
- **Root override pattern** (most common for fully custom editing UI):
|
|
107
108
|
- `editor.componentOverrides["$"] = { "definition": "c/<yourEditorComponent>", "attributes": { ... } }`
|
|
108
109
|
- When passing schema data into a custom LWC, use attribute mapping with the `{!$attrs.<name>}` syntax: e.g. `"attributes": { "myField": "{!$attrs.value}" }` so the runtime binds schema values to your component's attributes.
|
|
110
|
+
- **CRITICAL**: The `<name>` in `{!$attrs.<name>}` must be a property defined in your type schema. For example, if your schema has a property called `temperature`, use `{!$attrs.temperature}`, not `{!$attrs.value}` unless `value` is an actual property.
|
|
109
111
|
- **Property-level override pattern** (for individual fields):
|
|
110
112
|
- `editor.componentOverrides["<propertyName>"] = { "definition": "es_property_editors/<...>" }`
|
|
111
113
|
- **Valid editor components** (examples): `es_property_editors/inputText`, `es_property_editors/inputNumber`, `es_property_editors/inputRichText`, `es_property_editors/inputImage`, `es_property_editors/inputTextarea`. **Do not use** `es_property_editors/inputList`.
|
|
@@ -113,6 +115,7 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
113
115
|
- **Layout pattern**:
|
|
114
116
|
- `editor.layout.definition = "lightning/verticalLayout"`
|
|
115
117
|
- `editor.layout.children[*].definition = "lightning/propertyLayout"` with `attributes.property = "<propertyName>"`
|
|
118
|
+
- **CRITICAL**: `lightning/propertyLayout` only accepts the `property` attribute. Do NOT add `label`, `title`, or any other attributes — these will fail validation with `additionalProperties: false` errors.
|
|
116
119
|
- **Avoid known-invalid patterns**:
|
|
117
120
|
- Do not use `es_property_editors/inputList`.
|
|
118
121
|
- Do not use `itemSchema` attributes.
|
|
@@ -121,18 +124,41 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
121
124
|
- Top-level `renderer` object.
|
|
122
125
|
- Use `renderer.componentOverrides` for component overrides.
|
|
123
126
|
- Use `renderer.layout` for layout.
|
|
127
|
+
- **DEPRECATED**: Do NOT use `propertyRenderers` or `view` — these are legacy keys. Always use `componentOverrides` and `layout` instead.
|
|
124
128
|
- **Root override pattern** (most common for fully custom rendering UI):
|
|
125
129
|
- `renderer.componentOverrides["$"] = { "definition": "c/<yourRendererComponent>", "attributes": { ... } }`
|
|
126
130
|
- Use `{!$attrs.<name>}` in attribute mappings when binding schema data to custom renderer component attributes.
|
|
131
|
+
- **CRITICAL**: Attribute mappings like `{!$attrs.propertyName}` must reference properties that **actually exist** in your type schema. Referencing non-existent properties will fail validation.
|
|
132
|
+
- **Type matching**: Attribute values must match the expected type for the component. For example, if a component expects a string attribute, passing an integer will fail validation.
|
|
127
133
|
- **Property-level override pattern**:
|
|
128
134
|
- `renderer.componentOverrides["<propertyName>"] = { "definition": "es_property_editors/outputText" | "es_property_editors/outputNumber" | "es_property_editors/outputImage" | ... }`. **Valid renderer components** (examples): `es_property_editors/outputText`, `es_property_editors/outputNumber`, `es_property_editors/outputImage`. Avoid input-style components in the renderer.
|
|
135
|
+
- **Layout pattern for renderer**:
|
|
136
|
+
- `renderer.layout.definition = "lightning/verticalLayout"`
|
|
137
|
+
- `renderer.layout.children[*].definition = "lightning/propertyLayout"` with `attributes.property = "<propertyName>"`
|
|
138
|
+
- **CRITICAL**: Same as editor layouts, `lightning/propertyLayout` only accepts the `property` attribute. Do NOT add `label`, `title`, or any other attributes.
|
|
129
139
|
- **Collection renderer** (for root-level `lightning__listType` properties): Use `collection.renderer.componentOverrides["$"] = { "definition": "c/<yourListRendererComponent>" }` or `es_property_editors/genericListTypeRenderer` to render the list.
|
|
130
140
|
5. **Place files in the correct bundle structure**
|
|
131
141
|
- `lightningTypes/<TypeName>/schema.json`
|
|
132
142
|
- (Optional) `lightningTypes/<TypeName>/lightningDesktopGenAi/editor.json`
|
|
133
143
|
- (Optional) `lightningTypes/<TypeName>/lightningDesktopGenAi/renderer.json`
|
|
134
144
|
- For Gen AI / Copilot the standard path is `lightningDesktopGenAi/`. Other targets (e.g. Experience Builder, Mobile Copilot, Enhanced Web Chat) use different subfolders when supported: `experienceBuilder/`, `lightningMobileGenAi/`, `enhancedWebChat/`.
|
|
135
|
-
6. **
|
|
145
|
+
6. **Configure custom LWC components (if using custom components)**
|
|
146
|
+
- **CRITICAL**: Custom LWC components referenced in editor/renderer configs MUST have the correct target configuration in their `-meta.xml` files:
|
|
147
|
+
- **For editor components** (`c/<componentName>` used in `editor.json`): The LWC's `-meta.xml` file must include `<target>lightning__AgentforceInput</target>`
|
|
148
|
+
- **For renderer components** (`c/<componentName>` used in `renderer.json`): The LWC's `-meta.xml` file must include `<target>lightning__AgentforceOutput</target>`
|
|
149
|
+
- Without the correct target, deployment will fail with: `Invalid target configuration. To use 'c/componentName' as a renderer/editor, your js-meta.xml file must include valid target 'lightning__AgentforceOutput/Input'.`
|
|
150
|
+
- Example `-meta.xml` for a renderer component:
|
|
151
|
+
```xml
|
|
152
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
153
|
+
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
154
|
+
<apiVersion>60.0</apiVersion>
|
|
155
|
+
<isExposed>true</isExposed>
|
|
156
|
+
<targets>
|
|
157
|
+
<target>lightning__AgentforceOutput</target>
|
|
158
|
+
</targets>
|
|
159
|
+
</LightningComponentBundle>
|
|
160
|
+
```
|
|
161
|
+
7. **Deploy and validate**
|
|
136
162
|
- Deploy the bundle using your org's standard metadata deployment flow (e.g. Salesforce CLI or IDE). The MCP client or tooling in use should provide or integrate with the appropriate deploy/retrieve commands for Lightning Type bundles.
|
|
137
163
|
- Validate incrementally: if deployment fails, remove disallowed keywords first (especially `examples`, `items`, nested `lightning:type`).
|
|
138
164
|
|
|
@@ -144,6 +170,11 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
144
170
|
| Array property rejected | Use of `items` (or `lightning:type` in nested arrays) rejected by validator | For nested arrays: keep only `type: "array"`. For root arrays: use minimal structure; remove `items` if rejected |
|
|
145
171
|
| Apex-based CLT rejected | Extra fields added (e.g., `type`, `properties`) | Use only `title`, optional `description`, and `lightning:type` |
|
|
146
172
|
| Editor config rejected | Use of invalid patterns (`es_property_editors/inputList`, `itemSchema`) or unrecognized top-level keys | Use `editor.componentOverrides` and `editor.layout`; keep config minimal |
|
|
173
|
+
| `additionalProperties` error on layout attributes | Adding `label` or other attributes to `lightning/propertyLayout` | Only use `property` attribute in `lightning/propertyLayout`. Remove `label`, `title`, or any other attributes |
|
|
174
|
+
| Invalid target configuration for custom LWC | Custom LWC component's `-meta.xml` missing required target (`lightning__AgentforceInput` or `lightning__AgentforceOutput`) | Add correct target to LWC's `-meta.xml`: use `lightning__AgentforceInput` for editors, `lightning__AgentforceOutput` for renderers |
|
|
175
|
+
| Attribute mapping doesn't exist in type schema | Using `{!$attrs.propertyName}` where `propertyName` is not defined in schema | Ensure all attribute mappings reference actual properties in your type schema's `properties` section |
|
|
176
|
+
| `additionalProperties` error with deprecated keys | Using `propertyRenderers` or `view` in editor/renderer config | Replace deprecated `propertyRenderers` with `componentOverrides` and `view` with `layout` |
|
|
177
|
+
| Type mismatch in component attributes | Passing wrong type for component attribute (e.g., integer instead of string) | Ensure attribute values match the expected type defined by the component |
|
|
147
178
|
|
|
148
179
|
## Verification Checklist
|
|
149
180
|
- [ ] Root schema has `type: "object"`, `title`, `lightning:type: "lightning__objectType"`, and `unevaluatedProperties: false`
|
|
@@ -155,3 +186,6 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
155
186
|
- [ ] Bundle structure and filenames match Lightning Types requirements
|
|
156
187
|
- [ ] Editor config uses only allowed patterns (no `es_property_editors/inputList`, no `itemSchema`); use valid components (e.g. `es_property_editors/inputText`, `es_property_editors/inputNumber`) or custom `c/` components
|
|
157
188
|
- [ ] Renderer config uses output-style components (e.g. `es_property_editors/outputText`, `es_property_editors/outputNumber`) where applicable, not input editors
|
|
189
|
+
- [ ] Layout configurations use `lightning/propertyLayout` with ONLY the `property` attribute (no `label`, `title`, or other attributes)
|
|
190
|
+
- [ ] All attribute mappings (`{!$attrs.propertyName}`) reference properties that exist in the type schema
|
|
191
|
+
- [ ] Custom LWC components have correct targets in `-meta.xml`: `lightning__AgentforceInput` for editors, `lightning__AgentforceOutput` for renderers
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Use this skill when users need to create, generate, or validate Salesforce Custom Object metadata. Trigger when users mention custom objects, creating objects, object metadata, .object files, sharing models, name fields, or validation rules on objects. Also use when users say things like "create a custom object", "generate object metadata", "set up an object for
|
|
2
|
+
name: generating-custom-object
|
|
3
|
+
description: "Use this skill when users need to create, generate, or validate Salesforce Custom Object metadata. Trigger when users mention custom objects, creating objects, object metadata, .object files, sharing models, name fields, or validation rules on objects. Also use when users say things like \"create a custom object\", \"generate object metadata\", \"set up an object for...\", or when they're troubleshooting object deployment errors especially around sharing models and Master-Detail relationships. Always use this skill for any custom object metadata work."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## When to Use This Skill
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Use this skill when users need to create or configure Salesforce Custom Tabs. Trigger when users mention tabs, navigation tabs, object tabs, web tabs, Visualforce tabs, Lightning component tabs, app page tabs, or tab configuration. Also use when users want to add navigation to custom objects, create tabs for external content, or set up Lightning page tabs. Always use this skill for any custom tab work.
|
|
2
|
+
name: generating-custom-tab
|
|
3
|
+
description: "Use this skill when users need to create or configure Salesforce Custom Tabs. Trigger when users mention tabs, navigation tabs, object tabs, web tabs, Visualforce tabs, Lightning component tabs, app page tabs, or tab configuration. Also use when users want to add navigation to custom objects, create tabs for external content, or set up Lightning page tabs. Always use this skill for any custom tab work."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
## When to Use This Skill
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
|
-
name:
|
|
3
|
-
description: Creates, modifies, or manages Salesforce Experience Cloud LWR sites via DigitalExperience metadata. Always trigger when users mention Experience sites, LWR sites, DigitalExperience, Experience Cloud, community sites, portals, creating pages, adding routes, views, theme layouts, branding sets, previewing sites, or any DigitalExperience bundle work. Also use when users mention specific content types like sfdc_cms__route, sfdc_cms__themeLayout, etc. or when troubleshooting site deployment.
|
|
2
|
+
name: generating-experience-lwr-site
|
|
3
|
+
description: "Creates, modifies, or manages Salesforce Experience Cloud LWR sites via DigitalExperience metadata. Always trigger when users mention Experience sites, LWR sites, DigitalExperience, Experience Cloud, community sites, portals, creating pages, adding routes, views, theme layouts, branding sets, previewing sites, or any DigitalExperience bundle work. Also use when users mention specific content types like sfdc_cms__route, sfdc_cms__themeLayout, etc. or when troubleshooting site deployment."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Experience LWR Site Builder
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: generating-experience-react-site
|
|
3
|
+
description: "Use this skill when users need to create or configure a Salesforce Digital Experience Site specifically for hosting a React web application. Trigger when users mention creating an Experience site for a React app, setting up a React site on Salesforce, configuring Network/CustomSite/DigitalExperience metadata for a web app, or deploying site infrastructure for a React application. Also trigger when users mention site URL path prefixes, app namespaces, appDevName, guest access configuration, DigitalExperienceConfig, DigitalExperienceBundle, or sfdc_cms__site content types in the context of React apps. Always use this skill for any React web application site creation or site infrastructure configuration work, even if the user just says \"create a site for my React app\" or \"set up the site for my web application.\""
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Digital Experience Site for React Web Applications
|
|
7
|
+
Create and configure Digital Experience Sites that host React web applications on Salesforce. This skill generates the minimum necessary site infrastructure — Network, CustomSite, DigitalExperienceConfig, DigitalExperienceBundle, and the `sfdc_cms__site` content type — so a React app can be served from Salesforce.
|
|
8
|
+
|
|
9
|
+
React sites differ from standard LWR sites: they don't need routes, views, theme layouts, or branding sets. The site acts as a thin container (`appContainer: true`) that delegates rendering to the React application referenced by `appSpace`.
|
|
10
|
+
|
|
11
|
+
## Required Properties
|
|
12
|
+
Resolve all five properties before generating any metadata. Each has a fallback chain — work through each option in order until a value is found.
|
|
13
|
+
|
|
14
|
+
| Property | Format | How to Resolve |
|
|
15
|
+
|----------|--------|----------------|
|
|
16
|
+
| **siteName** | `UpperCamelCase` (e.g., `MyCommunity`) | Ask user or derive from context |
|
|
17
|
+
| **siteUrlPathPrefix** | `kebab-case` (e.g., `my-community`) | User-provided, or convert siteName to kebab-case |
|
|
18
|
+
| **appNamespace** | String | `namespace` in `sfdx-project.json` → `sf data query -q "SELECT NamespacePrefix FROM Organization" --target-org ${usernameOrAlias}` → default `c` |
|
|
19
|
+
| **appDevName** | String | `webApplication` metadata in the project → `sf data query -q "SELECT DeveloperName FROM WebApplication" --target-org ${usernameOrAlias}` → default to siteName |
|
|
20
|
+
| **enableGuestAccess** | Boolean | Ask user whether unauthenticated guest users can access site APIs → default `false` |
|
|
21
|
+
|
|
22
|
+
The `appNamespace` and `appDevName` properties connect the site to the correct React application. Getting these wrong means the site deploys but shows a blank page, so take care to resolve them from real project data.
|
|
23
|
+
|
|
24
|
+
## Generation Workflow
|
|
25
|
+
### Step 1: Resolve All Required Properties
|
|
26
|
+
Determine values for all five properties before constructing anything. Use the resolution strategies in the table above, falling through each option until a value is found.
|
|
27
|
+
|
|
28
|
+
### Step 2: Create the Project Structure
|
|
29
|
+
Call the `get_metadata_api_context` MCP tool to retrieve schemas for `Network`, `CustomSite`, `DigitalExperienceConfig`, and `DigitalExperienceBundle` metadata types. These schemas define the valid XML structure for each file.
|
|
30
|
+
|
|
31
|
+
Create any files and directories that don't already exist, using these paths:
|
|
32
|
+
|
|
33
|
+
| Metadata Type | Path |
|
|
34
|
+
|--------------|------|
|
|
35
|
+
| Network | `networks/{siteName}.network-meta.xml` |
|
|
36
|
+
| CustomSite | `sites/{siteName}.site-meta.xml` |
|
|
37
|
+
| DigitalExperienceConfig | `digitalExperienceConfigs/{siteName}1.digitalExperienceConfig-meta.xml` |
|
|
38
|
+
| DigitalExperienceBundle | `digitalExperiences/site/{siteName}1/{siteName}1.digitalExperience-meta.xml` |
|
|
39
|
+
| DigitalExperience (sfdc_cms__site) | `digitalExperiences/site/{siteName}1/sfdc_cms__site/{siteName}1/*` |
|
|
40
|
+
|
|
41
|
+
The DigitalExperience directory contains only `_meta.json` and `content.json`. Do not create any directories other than `sfdc_cms__site` inside the bundle.
|
|
42
|
+
|
|
43
|
+
### Step 3: Populate All Metadata Fields
|
|
44
|
+
Use the default templates in the docs below. Values in `{braces}` are resolved property references — substitute them with the actual values from Step 1.
|
|
45
|
+
|
|
46
|
+
| Metadata Type | Template Reference |
|
|
47
|
+
|--------------|-------------------|
|
|
48
|
+
| Network | [configure-metadata-network.md](docs/configure-metadata-network.md) |
|
|
49
|
+
| CustomSite | [configure-metadata-custom-site.md](docs/configure-metadata-custom-site.md) |
|
|
50
|
+
| DigitalExperienceConfig | [configure-metadata-digital-experience-config.md](docs/configure-metadata-digital-experience-config.md) |
|
|
51
|
+
| DigitalExperienceBundle | [configure-metadata-digital-experience-bundle.md](docs/configure-metadata-digital-experience-bundle.md) |
|
|
52
|
+
| DigitalExperience (sfdc_cms__site) | [configure-metadata-digital-experience.md](docs/configure-metadata-digital-experience.md) |
|
|
53
|
+
|
|
54
|
+
### Step 4: Resolve Additional Configurations
|
|
55
|
+
Address any extra configurations the user requests. Use the schemas returned by `get_metadata_api_context` in Step 2 to understand each field's purpose, and update only the minimum necessary fields.
|
|
56
|
+
|
|
57
|
+
## Verification Checklist
|
|
58
|
+
Before deploying, confirm:
|
|
59
|
+
|
|
60
|
+
- [ ] All five required properties are resolved
|
|
61
|
+
- [ ] All metadata directories and files exist per the project structure
|
|
62
|
+
- [ ] All metadata fields are populated per the templates and user requests
|
|
63
|
+
- [ ] `appSpace` in `content.json` matches an existing `WebApplication` metadata record
|
|
64
|
+
- [ ] Deployment validates successfully:
|
|
65
|
+
```bash
|
|
66
|
+
sf project deploy validate --metadata Network CustomSite DigitalExperienceConfig DigitalExperienceBundle DigitalExperience --target-org ${usernameOrAlias}
|
|
67
|
+
```
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Configure Metadata: CustomSite
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
This configuration file creates a **net-new, default** CustomSite metadata record for a Digital Experience React Site. It is not intended to edit or modify an existing CustomSite record. Use this template only when provisioning a brand-new React site.
|
|
5
|
+
|
|
6
|
+
## File Location
|
|
7
|
+
```
|
|
8
|
+
sites/{siteName}.site-meta.xml
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Default Template
|
|
12
|
+
```xml
|
|
13
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
14
|
+
<CustomSite xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
15
|
+
<active>true</active>
|
|
16
|
+
<allowGuestPaymentsApi>false</allowGuestPaymentsApi>
|
|
17
|
+
<allowHomePage>false</allowHomePage>
|
|
18
|
+
<allowStandardAnswersPages>false</allowStandardAnswersPages>
|
|
19
|
+
<allowStandardIdeasPages>false</allowStandardIdeasPages>
|
|
20
|
+
<allowStandardLookups>false</allowStandardLookups>
|
|
21
|
+
<allowStandardPortalPages>true</allowStandardPortalPages>
|
|
22
|
+
<allowStandardSearch>false</allowStandardSearch>
|
|
23
|
+
<authorizationRequiredPage>CommunitiesLogin</authorizationRequiredPage>
|
|
24
|
+
<bandwidthExceededPage>BandwidthExceeded</bandwidthExceededPage>
|
|
25
|
+
<browserXssProtection>true</browserXssProtection>
|
|
26
|
+
<cachePublicVisualforcePagesInProxyServers>true</cachePublicVisualforcePagesInProxyServers>
|
|
27
|
+
<clickjackProtectionLevel>SameOriginOnly</clickjackProtectionLevel>
|
|
28
|
+
<contentSniffingProtection>true</contentSniffingProtection>
|
|
29
|
+
<enableAuraRequests>true</enableAuraRequests>
|
|
30
|
+
<fileNotFoundPage>FileNotFound</fileNotFoundPage>
|
|
31
|
+
<genericErrorPage>Exception</genericErrorPage>
|
|
32
|
+
<inMaintenancePage>InMaintenance</inMaintenancePage>
|
|
33
|
+
<indexPage>CommunitiesLanding</indexPage>
|
|
34
|
+
<masterLabel>{siteName}</masterLabel>
|
|
35
|
+
<redirectToCustomDomain>false</redirectToCustomDomain>
|
|
36
|
+
<referrerPolicyOriginWhenCrossOrigin>true</referrerPolicyOriginWhenCrossOrigin>
|
|
37
|
+
<selfRegPage>CommunitiesSelfReg</selfRegPage>
|
|
38
|
+
<siteType>ChatterNetwork</siteType>
|
|
39
|
+
<urlPathPrefix>{siteUrlPathPrefix}vforcesite</urlPathPrefix>
|
|
40
|
+
</CustomSite>
|
|
41
|
+
```
|