
Generating Custom Lightning Type
Author Custom Lightning Types (CLTs)—JSON Schema types with editor/renderer configs—for Einstein Agent actions and structured agent I/O on Salesforce.
Overview
generating-custom-lightning-type is an agent skill for the Build phase that creates Salesforce Custom Lightning Types for Einstein Agent actions with JSON Schema, references, and editor/renderer setup.
Install
npx skills add https://github.com/forcedotcom/afv-library --skill generating-custom-lightning-typeWhat is this skill?
- CustomLightningType metadata spec for JSON Schema-based structured inputs and outputs
- Einstein Agent action integration patterns with lightning__objectType and registered FQN references
- Referenced CLT pattern for nested reusable types via lightning:type c__<CLTName>
- Editor and renderer configuration guidance for custom Lightning UI around types
- Explicit always-use gate—skill labels CLT work as complex
- Metadata skill version 1.0
Adoption & trust: 1.4k installs on skills.sh; 512 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need structured agent action I/O on Salesforce but CLT metadata, nested type references, and lightning:type identifiers are complex and error-prone without the spec.
Who is it for?
Salesforce developers implementing Einstein Agent actions that require typed, validated structured inputs and outputs.
Skip if: Simple Apex-only integrations with no agent surface, or teams not on Salesforce Lightning Platform agent features.
When should I use this skill?
Users mention CLT, Custom Lightning Types, JSON schemas for agents, type definitions, lightning__objectType, or editor/renderer configurations—always for CLT work.
What do I get? / Deliverables
You get deployable CLT definitions with correct JSON Schema, referenced nested types, and editor/renderer configuration suitable for Einstein Agent actions.
- CustomLightningType metadata
- JSON Schema definitions for agent I/O
- Editor/renderer configuration guidance for custom UI
Recommended Skills
Journey fit
CLTs are build-time platform artifacts that define how Einstein Agent actions accept and return structured data. Agent-tooling is the right shelf because CLTs directly shape agent action schemas and Lightning editor/renderer experiences.
How it compares
Platform-specific CLT generator—not a portable OpenAPI-only schema skill or generic LLM tool wrapper.
Common Questions / FAQ
Who is generating-custom-lightning-type for?
Solo and small-team Salesforce builders using coding agents to ship Einstein Agent actions with custom structured types and UI editors.
When should I use generating-custom-lightning-type?
Use it during Build agent-tooling when you create CLTs, JSON Schema agent I/O, nested type references, or editor/renderer configs—or when debugging CLT deployment errors.
Is generating-custom-lightning-type safe to install?
It is metadata authoring guidance; review the Security Audits panel on this Prism page and validate generated schemas in a sandbox before production deploy.
SKILL.md
READMESKILL.md - Generating Custom Lightning Type
## When to Use This Skill Use this skill when you need to: - Create Custom Lightning Types (CLTs) for structured inputs/outputs - Generate JSON Schema-based type definitions for Lightning Platform - Configure CLTs for Einstein Agent actions - Set up editor and renderer configurations for custom UI - Troubleshoot deployment errors related to Custom Lightning Types ## Specification # CustomLightningType Metadata Specification ## Overview & Purpose 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. ## Configuration - **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`. - **Choose standard Lightning types** when the structure is simple and can be expressed with properties and supported primitive `lightning:type` identifiers. - **Choose Apex class types** (`@apexClassType/...`) when the structure already exists server-side and you want the Apex class to define the shape. - **Include editor/renderer config** only when you need custom UI behavior (custom LWC input/output components). Otherwise, omit. ## Critical Rules (Read First) - **Root object schemas MUST include**: - `"type": "object"` - `"title"` - `"lightning:type": "lightning__objectType"` - `"unevaluatedProperties": false` - `"unevaluatedProperties"` is enforced as `false` by the CLT metaschema. Do not set it to `true`. - **Root object schemas MUST NOT include** `"examples"` when `"unevaluatedProperties": false` is set. - **Nested objects (inside `properties`) MUST NOT set** `"lightning:type": "lightning__objectType"`. - Nested objects can be: references to other CLTs using `c__<CLTName>` syntax. - **List/array properties are highly restricted by the CLT metaschema**: - **CRITICAL LIMITATION**: the CLT metaschema may reject the `items` keyword entirely. Treat `items` as **disallowed by default**. - **Root-level arrays** (direct children of the root `properties`): - **MUST include** `"lightning:type": "lightning__listType"` - **MUST NOT include** `"items"` - **OPTIONAL** `"type": "array"` - **Nested arrays** (arrays inside nested objects) are the most common failure: - **MUST include** `"type": "array"` - **MUST NOT include** `"lightning:type": "lightning__listType"` - **MUST NOT include** `"items"` - **When `"unevaluatedProperties": false` is set, any unknown keyword will fail validation**. Prefer removing keywords over relaxing strictness. - **Apex class CLTs are minimal**: - Include **only** `title`, `description` (optional), and `lightning:type` set to `@apexClassType/...`. - Do **not** add `type`, `properties`, `required`, or `unevaluatedProperties`. ## Additional CLT Metaschema Validations - **Org namespace validation**: titles/descriptions and other string fields may be validated to ensure you are not using an org namespace in places that are disallowed. - **Lightning type validation**: CLTs are validated to prevent referencing internal namespaces (for example, disallowing types from internal namespaces like `sfdc_cms` where not permitted). - **Object type validation**: the CLT root is validated to ensure `lightning:type` is exactly `lightning__objectType`