@salesforce/afv-skills 1.7.1 → 1.7.3
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
CHANGED
|
@@ -20,6 +20,7 @@ Use this skill when you need to:
|
|
|
20
20
|
Custom Lightning Types (CLTs) are JSON Schema-based type definitions used by the Lightning Platform (including Einstein Agent actions) to describe structured inputs/outputs and drive editor/renderer experiences.
|
|
21
21
|
|
|
22
22
|
## Configuration
|
|
23
|
+
- **Choose referenced CLT pattern for nested objects** - When you need a **reusable** or **separately deployed** nested type, create a CLT for that shape and reference it with `"lightning:type": "c__<CLTName>"`. That string is the referenced type’s **`lightning:type` value / FQN / registered identifier** — not the JSON Schema `title`.
|
|
23
24
|
- **Choose standard Lightning types** when the structure is simple and can be expressed with properties and supported primitive `lightning:type` identifiers.
|
|
24
25
|
- **Choose Apex class types** (`@apexClassType/...`) when the structure already exists server-side and you want the Apex class to define the shape.
|
|
25
26
|
- **Include editor/renderer config** only when you need custom UI behavior (custom LWC input/output components). Otherwise, omit.
|
|
@@ -33,7 +34,7 @@ Custom Lightning Types (CLTs) are JSON Schema-based type definitions used by the
|
|
|
33
34
|
- `"unevaluatedProperties"` is enforced as `false` by the CLT metaschema. Do not set it to `true`.
|
|
34
35
|
- **Root object schemas MUST NOT include** `"examples"` when `"unevaluatedProperties": false` is set.
|
|
35
36
|
- **Nested objects (inside `properties`) MUST NOT set** `"lightning:type": "lightning__objectType"`.
|
|
36
|
-
|
|
37
|
+
- Nested objects can be: references to other CLTs using `c__<CLTName>` syntax.
|
|
37
38
|
- **List/array properties are highly restricted by the CLT metaschema**:
|
|
38
39
|
- **CRITICAL LIMITATION**: the CLT metaschema may reject the `items` keyword entirely. Treat `items` as **disallowed by default**.
|
|
39
40
|
- **Root-level arrays** (direct children of the root `properties`):
|
|
@@ -96,8 +97,13 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
96
97
|
2. **Draft `schema.json`**
|
|
97
98
|
- Start with the root object structure (required root fields).
|
|
98
99
|
- Add `properties` using valid primitive `lightning:type` identifiers.
|
|
99
|
-
- For nested
|
|
100
|
+
- For nested-object properties, use **CLT Reference pattern**:
|
|
101
|
+
- `"lightning:type": "c__<CLTName>"` to reference another CLT
|
|
102
|
+
- The referenced CLT must be deployed to the org before the parent CLT.
|
|
103
|
+
- For Apex-based nested objects: Use `@apexClassType/...` when structure exists server-side.
|
|
104
|
+
- If the prompt explicitly requires true nested object output, prefer an **Apex-based CLT** (`@apexClassType/...`) for deploy-safe nested structures.
|
|
100
105
|
- For arrays: follow the strict list rules (avoid `items`; avoid `lightning:type` on nested arrays).
|
|
106
|
+
- Before deployment, verify exact `lightning:type` spellings (for example, use `lightning__richTextType`, not misspelled variants).
|
|
101
107
|
3. **(Optional) Draft `editor.json`** (only if custom UI is required)
|
|
102
108
|
- **Supported shape:** Top-level `editor` object with `editor.componentOverrides` and `editor.layout`.
|
|
103
109
|
- Top-level `editor` object.
|
|
@@ -159,6 +165,7 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
159
165
|
</LightningComponentBundle>
|
|
160
166
|
```
|
|
161
167
|
7. **Deploy and validate**
|
|
168
|
+
- Run a final schema sanity check before deploy: valid `lightning:type` names, required fields present, and no disallowed keywords.
|
|
162
169
|
- 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.
|
|
163
170
|
- Validate incrementally: if deployment fails, remove disallowed keywords first (especially `examples`, `items`, nested `lightning:type`).
|
|
164
171
|
|
|
@@ -166,7 +173,9 @@ When strict validation is enabled (`unevaluatedProperties: false`), keep each pr
|
|
|
166
173
|
| Error / Symptom | Likely Cause | Fix |
|
|
167
174
|
|---|---|---|
|
|
168
175
|
| Schema validation fails due to unknown keyword | `unevaluatedProperties: false` + disallowed keyword (commonly `examples`, `items`) | Remove the offending keyword; keep schema minimal |
|
|
169
|
-
| Nested object validation failure |
|
|
176
|
+
| Nested object validation failure | Org/channel validation rejects nested object typing in `LightningTypeBundle` | Use CLT reference (`c__<CLTName>`) or Apex class types |
|
|
177
|
+
| Invalid CLT reference | Referenced CLT doesn't exist in org or incorrect syntax | Deploy the referenced CLT first; `c__<CLTName>` must match the referenced type’s **`lightning:type` value / FQN / registered identifier**, not `title` |
|
|
178
|
+
| Invalid or misspelled `lightning:type` (for example, `lightning__richtextType` instead of `lightning__richTextType`) | Incorrect generated type name | Cross-check all `lightning:type` values against supported type names and correct them before deployment |
|
|
170
179
|
| 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 |
|
|
171
180
|
| Apex-based CLT rejected | Extra fields added (e.g., `type`, `properties`) | Use only `title`, optional `description`, and `lightning:type` |
|
|
172
181
|
| 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 |
|
|
@@ -33,11 +33,12 @@ Universal routing skill for searching and retrieving existing images and media.
|
|
|
33
33
|
|
|
34
34
|
When a user requests to find an image:
|
|
35
35
|
|
|
36
|
-
**Your first
|
|
36
|
+
**Your first action MUST use the ask_followup_question tool to present search sources.**
|
|
37
|
+
|
|
38
|
+
1. **Use ask_followup_question** to present available search sources as options
|
|
39
|
+
2. **Receive the user's selection** from the tool response
|
|
40
|
+
3. **Then** call the appropriate search tool based on their choice
|
|
37
41
|
|
|
38
|
-
1. **First response MUST be text only:** A numbered list of search sources for the user. No tool calls of any kind.
|
|
39
|
-
2. **Wait for user to reply** with their selected option number
|
|
40
|
-
3. **Only then** call the appropriate search tool (this is the FIRST tool call in the entire interaction)
|
|
41
42
|
|
|
42
43
|
**Example of what NOT to do:**
|
|
43
44
|
- ❌ Calling ANY tool before the user picks a source (MCP tools, file reads, descriptor checks, etc.)
|
|
@@ -279,7 +280,11 @@ Ask the user to provide:
|
|
|
279
280
|
|
|
280
281
|
## Presenting Search Results
|
|
281
282
|
|
|
282
|
-
|
|
283
|
+
**Your action MUST use the `ask_followup_question` tool to present search results as options.**
|
|
284
|
+
1. **Parse the tool response** — Extract all image results (title and source)
|
|
285
|
+
2. **Use `ask_followup_question`** to present ALL results as selectable options. Show the image title only — do not display the URL.
|
|
286
|
+
3. **Receive the user's selection** from the tool response
|
|
287
|
+
4. **Then** apply the selected image
|
|
283
288
|
|
|
284
289
|
```
|
|
285
290
|
I found 4 images. Which one would you like to use?
|
|
@@ -301,6 +306,7 @@ I found 4 images. Which one would you like to use?
|
|
|
301
306
|
|
|
302
307
|
## Applying the Selected Image
|
|
303
308
|
|
|
309
|
+
|
|
304
310
|
After the user chooses:
|
|
305
311
|
|
|
306
312
|
1. Confirm the selection with image name and URL
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: generating-fragment
|
|
3
|
-
description: "Use this skill when users need to create or edit Salesforce Fragments (reusable UI pieces). Trigger when users mention fragments, UEM blocks, reusable UI templates, structured rendering across Slack/Mobile/LEX, or block-based layouts. Also use when users want to create unified experience components. Always use this skill for any fragment work."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## When to Use This Skill
|
|
7
|
-
|
|
8
|
-
Use this skill when you need to:
|
|
9
|
-
- Create reusable UI fragments for Salesforce experiences
|
|
10
|
-
- Generate Fragment metadata following UEM structure
|
|
11
|
-
- Build fragments for Slack, Mobile, LEX, and other Salesforce experiences
|
|
12
|
-
- Troubleshoot deployment errors related to Fragments
|
|
13
|
-
|
|
14
|
-
## Specification
|
|
15
|
-
|
|
16
|
-
# Fragment Generation Guide
|
|
17
|
-
|
|
18
|
-
## 📋 Overview
|
|
19
|
-
Fragments are reusable pieces of UI similar to templates, with placeholders for actual data values. The purpose of this file is to assist developers in creating and editing fragments.
|
|
20
|
-
|
|
21
|
-
## 🎯 Purpose
|
|
22
|
-
Fragments render data in a structured and unified way across various Salesforce experiences like Slack, Mobile, LEX etc
|
|
23
|
-
|
|
24
|
-
## ⚙️ Composition
|
|
25
|
-
A fragment is a UEM (Unified Experience Model) tree of blocks and regions. The fragment you return must follow the Typescript interfaces below:
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
interface BlockType {
|
|
29
|
-
type: 'block'
|
|
30
|
-
definition: string // {namespace}/{blockName}
|
|
31
|
-
attributes?: Record<string, any>
|
|
32
|
-
children?: (BlockType | RegionType)[]
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface RegionType {
|
|
36
|
-
type: 'region'
|
|
37
|
-
name: string
|
|
38
|
-
children: BlockType[]
|
|
39
|
-
}
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
---
|
|
43
|
-
|
|
44
|
-
## 🔧 Available Metadata Actions
|
|
45
|
-
|
|
46
|
-
### When to Use Each Action
|
|
47
|
-
|
|
48
|
-
#### discoverUiComponents
|
|
49
|
-
|
|
50
|
-
**When:** You want to see what block components are available for fragments.
|
|
51
|
-
|
|
52
|
-
**Purpose:** Discover the palette of available blocks that can be used in fragment composition.
|
|
53
|
-
|
|
54
|
-
**Input Parameters:**
|
|
55
|
-
- `pageType` (required): "FRAGMENT"
|
|
56
|
-
- `pageContext` (optional): JSON object - not required for FRAGMENT type
|
|
57
|
-
- `searchQuery` (optional): String to filter components by name or description
|
|
58
|
-
|
|
59
|
-
**Returns:** List of components with:
|
|
60
|
-
- `definition`: Fully qualified name (e.g., "namespace/definiton")
|
|
61
|
-
- `description`: Component description
|
|
62
|
-
- `label`: Human-readable label
|
|
63
|
-
- `attributes`: Optional attribute metadata
|
|
64
|
-
|
|
65
|
-
**Use for:** Finding available blocks before building your fragment structure.
|
|
66
|
-
|
|
67
|
-
#### getUiComponentSchemas
|
|
68
|
-
|
|
69
|
-
**When:** You know which components you want but need to understand their properties and attributes.
|
|
70
|
-
|
|
71
|
-
**Purpose:** Get detailed JSON schemas for component configuration, including property types, required vs optional fields, and validation rules.
|
|
72
|
-
|
|
73
|
-
**Input Parameters:**
|
|
74
|
-
- `pageType` (required): "FRAGMENT"
|
|
75
|
-
- `pageContext` (optional): JSON object - not required for FRAGMENT type
|
|
76
|
-
- `componentDefinitions` (required): List of fully qualified names (e.g., ["namespace/definition"])
|
|
77
|
-
- `includeKnowledge` (optional): Boolean, defaults to true - includes additional component-specific guidance
|
|
78
|
-
|
|
79
|
-
**Returns:**
|
|
80
|
-
- `componentSchemas`: List of results (supports partial failures)
|
|
81
|
-
- **Success entries**: Contains JSON schema with property definitions, types, constraints
|
|
82
|
-
- **Failure entries**: Contains error message explaining why schema couldn't be retrieved
|
|
83
|
-
- `$defs`: Schema definitions and references (if schema transformation applied)
|
|
84
|
-
|
|
85
|
-
**Use for:** Understanding how to configure component attributes before adding blocks to your fragment.
|
|
86
|
-
|
|
87
|
-
**Key Feature:** Supports partial failures - if some components can't be found, you still get schemas for the successful ones.
|
|
88
|
-
|
|
89
|
-
---
|
|
90
|
-
|
|
91
|
-
## 💡 Typical Workflow
|
|
92
|
-
|
|
93
|
-
1. **Discover Available Blocks**
|
|
94
|
-
- Use `discoverUiComponents` to explore what blocks are available
|
|
95
|
-
- Optional: Use `searchQuery` to filter by keywords (e.g., "text", "button", "image")
|
|
96
|
-
|
|
97
|
-
2. **Select Components**
|
|
98
|
-
- Choose blocks that fit your fragment requirements
|
|
99
|
-
- Note their fully qualified definitions (e.g., "namespace/definition")
|
|
100
|
-
|
|
101
|
-
3. **Get Component Schemas**
|
|
102
|
-
- Use `getUiComponentSchemas` with the selected component definitions
|
|
103
|
-
- Review the JSON schemas to understand required and optional attributes
|
|
104
|
-
|
|
105
|
-
4. **Build Fragment**
|
|
106
|
-
- Construct your fragment using the UEM tree structure
|
|
107
|
-
- Configure block attributes according to the schemas
|
|
108
|
-
- Use the TypeScript interfaces defined above
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
## ⚠️ Important Notes
|
|
113
|
-
|
|
114
|
-
- Block definitions always follow the `{namespace}/{blockName}` convention
|
|
115
|
-
- Use the same definition format returned by `discoverUiComponents` when calling `getUiComponentSchemas`
|
|
116
|
-
- The FRAGMENT page type doesn't require additional `pageContext` parameters
|
|
117
|
-
- Schemas include both required and optional attributes - review carefully to ensure valid configuration
|