
generating-custom-lightning-type
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, Custom Lightning Types (CLTs) with widget/mosaic/fragment rendition/renderer, JSON schemas for agents, type definitions, lightningobjectType, or editor/renderer configurations. When widget renditions are requested, you MUST first read the widget-rendition.md reference file in this skill's references/ directory and follow its complete workflow. This is complex - always use this skill for CLT work.
- Installs
- 3.9K
- Last 24h
- —
- Trending rank
- —
- Security
- Pass
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/forcedotcom/sf-skills --skill generating-custom-lightning-type- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads generating-custom-lightning-type automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
Security audits
Independent scans of the skill's instructions and bundled files.
SKILL.md
The instructions your agent reads when the skill is triggered.
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
- Create CLTs with widget/mosaic/fragment rendition
- 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’slightning:typevalue / FQN / registered identifier — not the JSON Schematitle. - Choose standard Lightning types when the structure is simple and can be expressed with properties and supported primitive
lightning:typeidentifiers. - 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)
- CRITICAL: NEVER include the
"$schema"field in schema.json- Salesforce CLT validator WILL REJECT schemas with this field, even if it's a valid JSON Schema
$schemadeclaration.
- Salesforce CLT validator WILL REJECT schemas with this field, even if it's a valid JSON Schema
- Root object schemas MUST include:
"type": "object""title""lightning:type": "lightning__objectType""unevaluatedProperties": false
"unevaluatedProperties"is enforced asfalseby the CLT metaschema. Do not set it totrue.- Root object schemas MUST NOT include
"examples"when"unevaluatedProperties": falseis set. - Nested objects (inside
properties) MUST NOT set"lightning:type": "lightning__objectType".- Nested objects can be: references to other CLTs using
c__<CLTName>syntax.
- Nested objects can be: references to other CLTs using
- List/array properties are highly restricted by the CLT metaschema:
- CRITICAL LIMITATION: the CLT metaschema may reject the
itemskeyword entirely. Treatitemsas 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"
- MUST include
- 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"
- MUST include
- CRITICAL LIMITATION: the CLT metaschema may reject the
- When
"unevaluatedProperties": falseis set, any unknown keyword will fail validation. Prefer removing keywords over relaxing strictness. - Apex class CLTs are minimal:
- Include only
title,description(optional), andlightning:typeset to@apexClassType/.... - Do not add
type,properties,required, orunevaluatedProperties.
- Include only
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_cmswhere not permitted). - Object type validation: the CLT root is validated to ensure
lightning:typeis exactlylightning__objectType.
Primitive Types & Constraints
When you need the full list of supported primitive lightning:type identifiers, their constraints, and the allowed property-level keywords, read assets/primitive-types-and-constraints.md in this skill's directory.
Generation Workflow
- Confirm the CLT approach
- If referencing Apex: capture the exact class reference (
@apexClassType/namespace__ClassName$InnerClass). - If using standard primitives: list the fields, their Lightning primitive types, and which fields are required.
- If referencing Apex: capture the exact class reference (
- Draft
schema.json- DO NOT include
"$schema"at the top - Start with the root object structure (required root fields).
- Add
propertiesusing valid primitivelightning:typeidentifiers. - For nested-object properties, use CLT Reference pattern:
"lightning:type": "c__<CLTName>"to reference another CLT- The referenced CLT must be deployed to the org before the parent CLT.
- For Apex-based nested objects: Use
@apexClassType/...when structure exists server-side. - If the prompt explicitly requires true nested object output, prefer an Apex-based CLT (
@apexClassType/...) for deploy-safe nested structures. - For arrays: follow the strict list rules (avoid
items; avoidlightning:typeon nested arrays). - Before deployment, verify exact
lightning:typespellings (for example, uselightning__richTextType, not misspelled variants).
- DO NOT include
- (Optional) Draft
editor.json(only if custom UI is required)- Supported shape: Top-level
editorobject witheditor.componentOverridesandeditor.layout.- Top-level
editorobject. - Use
editor.componentOverridesfor component overrides. - Use
editor.layoutfor layout. - DEPRECATED: Do NOT use
propertyRenderersorview— these are legacy keys. Always usecomponentOverridesandlayoutinstead.
- Top-level
- Root override pattern (most common for fully custom editing UI):
editor.componentOverrides["$"] = { "definition": "c/<yourEditorComponent>", "attributes": { ... } }- 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. - CRITICAL: The
<name>in{!$attrs.<name>}must be a property defined in your type schema. For example, if your schema has a property calledtemperature, use{!$attrs.temperature}, not{!$attrs.value}unlessvalueis an actual property.
- Property-level override pattern (for individual fields):
editor.componentOverrides["<propertyName>"] = { "definition": "es_property_editors/<...>" }- 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 usees_property_editors/inputList.
- Collection editor (for root-level
lightning__listTypeproperties): Use a collection-level override so the list is edited by a custom component:collection.editor.componentOverrides["$"] = { "definition": "c/<yourCollectionEditorComponent>" }. Alternatively, useeditor.layoutwithlightning/propertyLayoutandattributes.property = "<listPropertyName>"for default list editing. - Layout pattern:
editor.layout.definition = "lightning/verticalLayout"editor.layout.children[*].definition = "lightning/propertyLayout"withattributes.property = "<propertyName>"- CRITICAL:
lightning/propertyLayoutonly accepts thepropertyattribute. Do NOT addlabel,title, or any other attributes — these will fail validation withadditionalProperties: falseerrors.
- Avoid known-invalid patterns:
- Do not use
es_property_editors/inputList. - Do not use
itemSchemaattributes.
- Do not use
- Supported shape: Top-level
- (Optional) Draft
renderer.json(only if custom UI or mosaic rendition is required)- Supported shape: Top-level
rendererobject withrenderer.componentOverridesandrenderer.layout.- Top-level
rendererobject. - Use
renderer.componentOverridesfor component overrides. - Use
renderer.layoutfor layout. - DEPRECATED: Do NOT use
propertyRenderersorview— these are legacy keys. Always usecomponentOverridesandlayoutinstead.
- Top-level
- Root override pattern (most common for fully custom rendering UI):
renderer.componentOverrides["$"] = { "definition": "c/<yourRendererComponent>", "attributes": { ... } }- Use
{!$attrs.<name>}in attribute mappings when binding schema data to custom renderer component attributes. - CRITICAL: Attribute mappings like
{!$attrs.propertyName}must reference properties that actually exist in your type schema. Referencing non-existent properties will fail validation. - 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.
- Widget renderer pattern (for widget rendition):
- When to use: Use this when users request "mosaic", "widget", "fragment", or "cross-platform rendering" for their CLT.
- Structure:
renderer.componentOverrides["$"] = { "type": "mosaic", "definition": "tile/mosaic", "children": [ /* UEM tree of blocks and regions */ ] } - REQUIRED workflow:
- STOP: Do NOT attempt to create the widget renderer yourself.
- MANDATORY FIRST STEP: You MUST fetch the reference file
references/widget-rendition.mdlocated in this skill's directory before proceeding. - Follow the complete workflow documented in
widget-rendition.mdusing the generated CLT schema as the grounding schema. - The
widget-rendition.mdreference contains the full widget generation workflow: discovering UEM blocks via discoverUiComponents, calling getUiComponentSchemas, building the UEM tree, and writing renderer.json. - Do not attempt to generate widget rendition without first fetching the
widget-rendition.mdreference file.
- Property-level override pattern:
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.
- Layout pattern for renderer:
renderer.layout.definition = "lightning/verticalLayout"renderer.layout.children[*].definition = "lightning/propertyLayout"withattributes.property = "<propertyName>"- CRITICAL: Same as editor layouts,
lightning/propertyLayoutonly accepts thepropertyattribute. Do NOT addlabel,title, or any other attributes.
- Collection renderer (for root-level
lightning__listTypeproperties): Usecollection.renderer.componentOverrides["$"] = { "definition": "c/<yourListRendererComponent>" }ores_property_editors/genericListTypeRendererto render the list.
- Supported shape: Top-level
- Place files in the correct bundle structure
lightningTypes/<TypeName>/schema.json- (Optional)
lightningTypes/<TypeName>/lightningDesktopGenAi/editor.json - (Optional)
lightningTypes/<TypeName>/lightningDesktopGenAi/renderer.json - 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/.
- Configure custom LWC components (if using custom components)
- CRITICAL: Custom LWC components referenced in editor/renderer configs MUST have the correct target configuration in their
-meta.xmlfiles:- For editor components (
c/<componentName>used ineditor.json): The LWC's-meta.xmlfile must include<target>lightning__AgentforceInput</target> - For renderer components (
c/<componentName>used inrenderer.json): The LWC's-meta.xmlfile must include<target>lightning__AgentforceOutput</target>
- For editor components (
- 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'. - Example
-meta.xmlfor a renderer component:<?xml version="1.0" encoding="UTF-8"?> <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> <apiVersion>60.0</apiVersion> <isExposed>true</isExposed> <targets> <target>lightning__AgentforceOutput</target> </targets> </LightningComponentBundle>
- CRITICAL: Custom LWC components referenced in editor/renderer configs MUST have the correct target configuration in their
Common Deployment Errors
| Error / Symptom | Likely Cause | Fix |
|---|---|---|
| Schema validation fails due to unknown keyword | unevaluatedProperties: false + disallowed keyword (commonly examples, items) | Remove the offending keyword; keep schema minimal |
| Nested object validation failure | Org/channel validation rejects nested object typing in LightningTypeBundle | Use CLT reference (c__<CLTName>) or Apex class types |
| 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 |
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 |
| 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 |
| Apex-based CLT rejected | Extra fields added (e.g., type, properties) | Use only title, optional description, and lightning:type |
| 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 |
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 |
| 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 |
| 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 |
additionalProperties error with deprecated keys | Using propertyRenderers or view in editor/renderer config | Replace deprecated propertyRenderers with componentOverrides and view with layout |
| 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 |
Verification Checklist
- Root schema has
type: "object",title,lightning:type: "lightning__objectType", andunevaluatedProperties: false - Root schema does not include
exampleswhen strict validation is enabled - No nested object includes
lightning:type: "lightning__objectType" - Arrays are defined minimally (especially nested arrays)
- Only supported primitive
lightning:typeidentifiers are used for leaf properties - Apex class CLTs contain only
title/descriptionandlightning:type: "@apexClassType/..." - Bundle structure and filenames match Lightning Types requirements
- Editor config uses only allowed patterns (no
es_property_editors/inputList, noitemSchema); use valid components (e.g.es_property_editors/inputText,es_property_editors/inputNumber) or customc/components - Renderer config uses output-style components (e.g.
es_property_editors/outputText,es_property_editors/outputNumber) where applicable, not input editors - Layout configurations use
lightning/propertyLayoutwith ONLY thepropertyattribute (nolabel,title, or other attributes) - All attribute mappings (
{!$attrs.propertyName}) reference properties that exist in the type schema - Custom LWC components have correct targets in
-meta.xml:lightning__AgentforceInputfor editors,lightning__AgentforceOutputfor renderers - Root schema does NOT include
"$schema"field
FAQ
What does the generating-custom-lightning-type skill do?
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, Custom Lightning Types (CLTs) with widget/mosaic/fragment rendition/renderer, JSON schemas for agents, type definitions, lightningobjectType, or editor/renderer configurations. When widget renditions are requested, you MUST first read the widget-rendition.md reference file in this skill's references/ directory and follow its complete workflow. This is complex - always use this skill for CLT work.
How do I install generating-custom-lightning-type?
Run npx skills add https://github.com/forcedotcom/sf-skills --skill generating-custom-lightning-type in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/generating-custom-lightning-type/ (personal) or .claude/skills/generating-custom-lightning-type/ (project).
Which AI agents can use generating-custom-lightning-type?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is generating-custom-lightning-type safe to install?
Security partners have reviewed it: Gen Agent Trust Hub passed; Socket passed; Snyk passed. As with any skill, read the SKILL.md and bundled scripts before installing.
Who maintains generating-custom-lightning-type?
It is published by forcedotcom in forcedotcom/sf-skills. It has 3,923 recorded installs.
More from forcedotcom/sf-skills
platform-apex-generate
forcedotcom/sf-skills
Primary Apex authoring skill for class generation, refactoring, and review. ALWAYS ACTIVATE when the user mentions Apex, .cls, triggers, or asks to create/refactor a class (service, selector, domain, batch, queueable, schedulable, invocable, DTO, utility, interface, abstract, exception, REST resource). Use this skill for requests involving SObject CRUD, mapping collections, fetching related records, scheduled jobs, batch jobs, trigger design, @AuraEnabled controllers, @RestResource endpoints, custom REST APIs, or code review of existing Apex.
platform-apex-test-generate
forcedotcom/sf-skills
Use to generate and validate Apex test classes with TestDataFactory patterns, bulk testing (251+ records), mocking, assertions, and disciplined test-fix loops. Use when creating Apex test classes (for triggers, services, controllers, batch jobs, queueables, and callouts), improving coverage, debugging or fixing failing Apex tests, or running test/coverage analysis. Triggers on Test.cls files, sf apex run test, coverage reports. Do NOT trigger for production Apex (use platform-apex-generate) or Jest/LWC tests.
platform-apex-test-run
forcedotcom/sf-skills
Apex test execution, coverage analysis, and test-fix loops with 120-point scoring. Use when the user runs Apex tests, checks code coverage, fixes failing tests, or touches Test.cls / Test.cls files. DO NOT TRIGGER when writing Apex production code (use platform-apex-generate), Agentforce agent testing (use agentforce-test), or Jest/LWC tests (use experience-lwc-generate).
platform-apex-logs-debug
forcedotcom/sf-skills
Salesforce debug log analysis and troubleshooting with 100-point scoring. TRIGGER when: user analyzes debug logs, hits governor limits, reads stack traces, or touches .log files from Salesforce orgs. DO NOT TRIGGER when: running Apex tests (use platform-apex-test-run), generating or fixing Apex code (use platform-apex-generate), or Agentforce session tracing (use agentforce-observe).
platform-soql-query
forcedotcom/sf-skills
Use when the user needs SOQL/SOSL authoring or optimization: natural-language-to-query generation, relationship queries, aggregates, query-plan/selectivity analysis, and performance or safety improvements. TRIGGER when the user writes, optimizes, or debugs SOQL/SOSL, touches .soql files, or asks about relationship queries, aggregates, or query performance. DO NOT TRIGGER for bulk data operations (use platform-data-manage), Apex DML logic (use platform-apex-generate), or report/dashboard queries.
platform-metadata-deploy
forcedotcom/sf-skills
Salesforce DevOps automation using sf CLI v2. TRIGGER when: user deploys metadata, validates a deploy or does a dry-run, deploys to a Production org, quick-deploys a validated job ID, ships/promotes to prod, creates/manages scratch orgs or sandboxes, sets up CI/CD pipelines, or troubleshoots deployment errors with sf project deploy. DO NOT TRIGGER when: writing Apex code, building LWC components (use experience-lwc-generate), creating metadata definitions (use platform-custom-object-generate), deleting metadata from an org (use platform-destructive-deploy), or querying org data (use platform-data-manage).
Popular productivity & automation skills
agent-browser
vercel-labs/agent-browser
Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.
lark-doc
open.feishu.cn
飞书云文档(Docx / Wiki)内容操作:读取、创建、编辑文档,插入或下载图片附件,以及操作思维笔记。用户提供文档 URL/token(包括 doubao.com 的 /docx/、/wiki/)时使用;按 URL 路径/token 而非域名路由;/page/ 是妙搭应用,非飞书云文档。文档内嵌资源按读取参考中的统一规则分流。独立评论操作走 lark-drive;随正文读取评论使用 docs +fetch。表格或 Base 内部数据操作不在本 skill。
lark-base
open.feishu.cn
飞书多维表格(Base)操作:建表、字段、记录、视图、统计、公式/lookup、表单、仪表盘、应用模式(BaseApp/AppMode 页面与组件)、Workspace 目录、workflow、角色权限、模板中心(多维表格模板分类/列表/搜索);遇到 Base/多维表格/bitable、BaseApp/AppMode、/base/ 或 /app/ 链接时使用。BaseApp 不走 lark-apps;文件导入/导出转 lark-drive,认证/授权转 lark-shared。
lark-drive
open.feishu.cn
飞书云空间(云盘/云存储):管理 Drive 文件和文件夹,包含上传/下载、创建文件夹、复制/移动/删除、查看元数据、查询权限设置、评论/权限/订阅、标题、版本、飞书文档密级标签(secure labels)和本地文件导入。用户需要整理云盘目录、处理云空间资源 URL/token、判断链接类型/真实 token/标题,或导入 Word/Markdown/Excel/CSV/PPTX/.base 为 docx/sheet/bitable/slides 时使用;doubao.com 云空间 URL/token 也按资源路径和 token 路由,不回退 WebFetch。不负责:文档内容编辑(走 lark-doc)、表格/Base 表内数据操作(走 lark-sheets/lark-base)、知识空间节点/成员管理(走 lark-wiki)、原生 Markdown 文件读写/patch/diff(走 lark-markdown)。
lark-shared
open.feishu.cn
Use for lark-cli setup/auth tasks: auth login/status/logout, user vs bot identity, business-domain permissions (--domain, including all/docs/drive), missing scopes, revoking authorization, or handling notice JSON.
lark-im
open.feishu.cn
飞书即时通讯:收发消息和管理群聊。发送和回复消息、搜索聊天记录、管理群聊成员、上传下载图片和文件、管理表情回复、发送应用内/短信/电话加急、发送和处理交互卡片(Interactive Card)、监听卡片按钮回调(card.action.trigger)。当用户需要发消息、查看或搜索聊天记录、下载聊天中的文件、查看群成员、搜索群、创建群聊或话题群、管理标记数据、管理 Feed 置顶(添加/移除/查询置顶会话)、管理标签数据、处理卡片回调时使用。