generating-lightning-app
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGenerating Lightning App
生成Lightning应用
Overview
概述
Build a complete, deployable Salesforce Lightning Experience application from a natural language description by defining a Lightning Custom Application and orchestrating its dependent metadata types in correct dependency order. Invoke specialized metadata skills when available; generate metadata directly when no skill exists.
通过定义Lightning自定义应用程序,并按正确的依赖顺序编排其关联的元数据类型,根据自然语言描述构建完整的、可部署的Salesforce Lightning Experience应用程序。若存在专用元数据技能则调用;若没有对应技能,则直接生成元数据。
When to Use This Skill
何时使用此技能
Use when:
- User requests a "Lightning app", or "end-to-end solution"
- User says "build an app", "create an application", "build a [type] app" (project management, tracking, etc.)
- The work produces a custom app (CustomApplication) plus supporting metadata, not a lone object, page, or tab in isolation
Examples that should trigger this skill:
- "Build a project management lightning app with Tasks, Resources, and Supplies objects"
- "Create a LEX app to track vehicles with Lightning pages and permission sets"
- "I need a Space Station management system with multiple objects and relationships"
- "Build an employee onboarding lightning app with custom Lightning Record Pages"
Do NOT use when:
- Creating a single metadata component (use specific metadata skill instead)
- Troubleshooting or debugging existing metadata
- Building Salesforce Classic apps (not Lightning Experience)
- User asks for just one object, or just one page, or just one permission set (without others)
- User only needs to create or configure an app container (grouping existing tabs) without other metadata; use instead
generating-custom-application
适用场景:
- 用户请求「Lightning应用」或「端到端解决方案」
- 用户提出「构建一个应用」、「创建应用程序」、「构建[类型]应用」(如项目管理、跟踪类等)
- 工作产出为自定义应用(CustomApplication)及配套元数据,而非孤立的单个对象、页面或标签
应触发此技能的示例:
- 「构建一个包含任务、资源和物资对象的项目管理Lightning应用」
- 「创建一个LEX应用,通过Lightning页面和权限集跟踪车辆」
- 「我需要一个包含多个对象和关系的空间站管理系统」
- 「构建一个带有自定义Lightning记录页面的员工入职Lightning应用」
不适用场景:
- 创建单个元数据组件(应使用特定元数据技能)
- 排查或调试现有元数据
- 构建Salesforce Classic应用(非Lightning Experience)
- 用户仅请求创建单个对象、单个页面或单个权限集(无其他配套组件)
- 用户仅需创建或配置应用容器(分组现有标签)而无需其他元数据;此时应使用技能
generating-custom-application
Metadata Type Registry
元数据类型注册表
This table shows which metadata types are commonly needed for Lightning Experience apps, their skill availability, and API context requirement.
| Metadata Type | Skill Name | API Context | Usage Rule |
|---|---|---|---|
| Custom Object | | | MUST load skill AND call API context |
| Custom Field | | | MUST load skill AND call API context |
| Custom Tab | | | MUST load skill AND call API context |
| FlexiPage | | | MUST load skill AND call API context |
| Custom Application | | | MUST load skill AND call API context |
| List View | | | MUST load skill AND call API context (if requested) |
| Validation Rule | | | MUST load skill AND call API context (if requested) |
| Flow | | | MUST load skill AND run pipeline. Exempt from |
| Permission Set | | | MUST load skill AND call API context |
下表展示了Lightning Experience应用通常需要的元数据类型、对应的可用技能及API上下文要求。
| Metadata Type | Skill Name | API Context | Usage Rule |
|---|---|---|---|
| Custom Object | | | 必须加载技能并调用API上下文 |
| Custom Field | | | 必须加载技能并调用API上下文 |
| Custom Tab | | | 必须加载技能并调用API上下文 |
| FlexiPage | | | 必须加载技能并调用API上下文 |
| Custom Application | | | 必须加载技能并调用API上下文 |
| List View | | | 必须加载技能并调用API上下文(若用户请求) |
| Validation Rule | | | 必须加载技能并调用API上下文(若用户请求) |
| Flow | | | 必须加载技能并运行流水线。豁免于 |
| Permission Set | | | 必须加载技能并调用API上下文 |
Usage Rules
使用规则
SKILL RULE: When a skill exists for a metadata type, you MUST load that skill. Do NOT generate metadata directly without loading the skill first.
API CONTEXT RULE: For every metadata type (except Flow), you MUST call tools before generating. Do NOT generate metadata without calling API context first. The skill provides structure and rules; API context confirms what is valid for the current API version. Both are essential.
salesforce-api-contextFALLBACK RULE: When no skill exists for a metadata type you need, generate the metadata directly using your knowledge of Salesforce Metadata API and best practices. API context is still required.
RATIONALE: Skills contain validated patterns and constraints. API context provides version-specific accuracy. Together they prevent deployment failures.
技能规则:若某元数据类型存在对应技能,则必须加载该技能。不得在未加载技能的情况下直接生成元数据。
API上下文规则:对于所有元数据类型(Flow除外),必须在生成前调用工具。不得在未调用API上下文的情况下生成元数据。技能提供结构和规则;API上下文确认当前API版本下的有效内容。两者缺一不可。
salesforce-api-context** fallback规则**:若所需元数据类型无对应技能,则需基于Salesforce Metadata API知识和最佳实践直接生成元数据。仍需调用API上下文。
理由:技能包含已验证的模式和约束。API上下文提供特定版本的准确性。两者结合可避免部署失败。
Dependency Graph & Build Order
依赖关系图与构建顺序
Phase 1: Data Model (Foundation)
阶段1:数据模型(基础)
Custom Objects (no dependencies)
↓
Custom Fields (depends on: Objects exist)
↓
Relationships (depends on: Both parent and child objects + fields exist)Metadata types in this phase:
- - once, with all objects
generating-custom-object - - once, with all fields (including Master-Detail, Lookup, Roll-up Summary)
generating-custom-field
Custom Objects (no dependencies)
↓
Custom Fields (depends on: Objects exist)
↓
Relationships (depends on: Both parent and child objects + fields exist)此阶段的元数据类型:
- - 一次性处理所有对象
generating-custom-object - - 一次性处理所有字段(包括主明细、查找、汇总字段)
generating-custom-field
Phase 2: Business Logic (Optional - only if requested)
阶段2:业务逻辑(可选 - 仅在用户请求时执行)
Validation Rules (depends on: Fields exist)
↓
Flows (depends on: Objects, Fields exist)Metadata types in this phase (only if user requested):
- - once, if validation requirements mentioned
generating-validation-rule - - once, if automation/workflow requirements mentioned
generating-flow
Validation Rules (depends on: Fields exist)
↓
Flows (depends on: Objects, Fields exist)此阶段的元数据类型(仅在用户请求时执行):
- - 若提及验证需求则一次性处理
generating-validation-rule - - 若提及自动化/工作流需求则一次性处理
generating-flow
Phase 3: User Interface
阶段3:用户界面
List Views (depends on: Objects, Fields exist)
↓
Custom Tabs (depends on: Objects exist)
↓
FlexiPages (depends on: Objects, Tabs exist)Metadata types in this phase:
- - once, for filtered record views (if requested)
generating-list-view - - once, with all object tabs
generating-custom-tab - - once, with all record/home/app pages
generating-flexipage
List Views (depends on: Objects, Fields exist)
↓
Custom Tabs (depends on: Objects exist)
↓
FlexiPages (depends on: Objects, Tabs exist)此阶段的元数据类型:
- - 若请求过滤记录视图则一次性处理
generating-list-view - - 一次性处理所有对象标签
generating-custom-tab - - 一次性处理所有记录/主页/应用页面
generating-flexipage
Phase 4: Application Assembly
阶段4:应用组装
Custom Application (depends on: Tabs exist)Metadata types in this phase:
- - once, to create the Lightning App container
generating-custom-application
Custom Application (depends on: Tabs exist)此阶段的元数据类型:
- - 一次性创建Lightning应用容器
generating-custom-application
Phase 5: Security & Access
阶段5:安全与访问
Permission Sets (depends on: Objects, Fields, Tabs, App exist)Metadata types in this phase:
- - once, with all permission sets and access to:
generating-permission-set- Objects (Read, Create, Edit, Delete)
- Fields (Read, Edit)
- Tabs (Visible)
- Custom Application (Visible)
Permission Sets (depends on: Objects, Fields, Tabs, App exist)此阶段的元数据类型:
- - 一次性处理所有权限集,授予以下访问权限:
generating-permission-set- 对象(读取、创建、编辑、删除)
- 字段(读取、编辑)
- 标签(可见)
- 自定义应用(可见)
Execution Workflow
执行工作流
STEP 1: Requirements Analysis & Planning
步骤1:需求分析与规划
Actions:
- Parse user's natural language request
- Extract business entities (become Custom Objects)
- Extract attributes/properties (become Custom Fields)
- Identify relationships (Master-Detail, Lookup)
- Detect validation requirements (become Validation Rules)
- Detect automation requirements (become Flows)
- Identify user personas (inform Permission Sets)
Output: Build Plan
Generate a structured plan listing:
Lightning App Build Plan: [App Name]
DATA MODEL:
- Custom Objects: [list with object names]
- Custom Fields: [list grouped by object]
- Relationships: [list M-D and Lookup relationships]
BUSINESS LOGIC (if applicable):
- Validation Rules: [list with object and rule name]
- Flows: [list with flow name and type]
USER INTERFACE:
- List Views (if requested): [list with object and view name]
- Custom Tabs: [list with object]
- FlexiPages: [list with page name and type]
- Custom Application: [app name]
SECURITY:
- Permission Sets: [list with purpose]
PER-TYPE EXECUTION (skill + API context for each):
- CustomObject: load generating-custom-object + call salesforce-api-context
- CustomField: load generating-custom-field + call salesforce-api-context
- ValidationRule: load generating-validation-rule + call salesforce-api-context (if requested)
- Flow: load generating-flow + run metadata-experts pipeline (if requested)
- ListView: load generating-list-view + call salesforce-api-context (if requested)
- CustomTab: load generating-custom-tab + call salesforce-api-context
- FlexiPage: load generating-flexipage + call salesforce-api-context
- CustomApplication: load generating-custom-application + call salesforce-api-context
- PermissionSet: load generating-permission-set + call salesforce-api-context
STATUS LINES TO EMIT BEFORE FILE WRITES:
- `type=<Type> skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none>`
- Flow exception: `type=Flow skill=complete pipeline=complete`
DEPENDENCY ORDER:
1. Phase 1: Data Model (Objects -> Fields)
2. Phase 2: Business Logic (Validation Rules -> Flows)
3. Phase 3: User Interface (List Views -> Tabs -> Pages)
4. Phase 4: App Assembly (Application)
5. Phase 5: Security (Permission Sets)操作:
- 解析用户的自然语言请求
- 提取业务实体(将成为Custom Object)
- 提取属性/特性(将成为Custom Field)
- 识别关系(主明细、查找)
- 检测验证需求(将成为Validation Rule)
- 检测自动化需求(将成为Flow)
- 识别用户角色(为Permission Set提供依据)
输出:构建计划
生成结构化计划,包含:
Lightning应用构建计划:[应用名称]
数据模型:
- 自定义对象:[对象名称列表]
- 自定义字段:[按对象分组的列表]
- 关系:[主明细和查找关系列表]
业务逻辑(如适用):
- 验证规则:[按对象和规则名称列出的列表]
- Flow:[按Flow名称和类型列出的列表]
用户界面:
- 列表视图(若请求):[按对象和视图名称列出的列表]
- 自定义标签:[对象列表]
- FlexiPage:[按页面名称和类型列出的列表]
- 自定义应用:[应用名称]
安全设置:
- 权限集:[按用途列出的列表]
按类型执行(每个类型对应技能+API上下文):
- CustomObject:加载generating-custom-object + 调用salesforce-api-context
- CustomField:加载generating-custom-field + 调用salesforce-api-context
- ValidationRule:加载generating-validation-rule + 调用salesforce-api-context(若请求)
- Flow:加载generating-flow + 运行metadata-experts流水线(若请求)
- ListView:加载generating-list-view + 调用salesforce-api-context(若请求)
- CustomTab:加载generating-custom-tab + 调用salesforce-api-context
- FlexiPage:加载generating-flexipage + 调用salesforce-api-context
- CustomApplication:加载generating-custom-application + 调用salesforce-api-context
- PermissionSet:加载generating-permission-set + 调用salesforce-api-context
写入文件前需输出状态行:
- `type=<Type> skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none>`
- Flow例外:`type=Flow skill=complete pipeline=complete`
依赖顺序:
1. 阶段1:数据模型(对象 -> 字段)
2. 阶段2:业务逻辑(验证规则 -> Flow)
3. 阶段3:用户界面(列表视图 -> 标签 -> 页面)
4. 阶段4:应用组装(应用程序)
5. 阶段5:安全设置(权限集)STEP 2: Per-Type Execution
步骤2:按类型执行
Execute these four steps for each metadata type, one type at a time. Complete all four steps for the current type before moving to the next type. Do NOT skip any step.
| Step | What to do | Why |
|---|---|---|
| ① Load skill | Search for and read the per-type SKILL.md | Gives you the XML structure, required elements, naming rules, and validation constraints |
| ② Call API context | Call | Gives you the current valid values — allowed enum values, required vs. optional fields, child types for this API version. The skill provides structure; API context provides version-specific accuracy. |
| ③ Record status | Emit: | Confirms both steps were attempted before any files are written and records which API context tools were used |
| ④ Generate files | Generate all files for this type, then checkpoint | Only after ①②③ are done. Verify, then move to the next type. |
Do NOT combine ① and ② into a single action or skip ② after completing ①. They are separate steps that serve different purposes. After loading the skill you may feel ready to generate — stop and do ② first.
If is unavailable after a real attempt, record and generate using skill knowledge alone. Not attempting ② at all is a bug.
salesforce-api-contextmcp=unavailable1. Custom Objects
- ① Load skill: Read SKILL.md
generating-custom-object - ② API context: Call for CustomObject
salesforce-api-context - ③ Status:
type=CustomObject skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate all Custom Object files, then proceed to #2
2. Custom Fields
- ① Load skill: Read SKILL.md
generating-custom-field - ② API context: Call for CustomField
salesforce-api-context - ③ Status:
type=CustomField skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate all Custom Field files, then proceed to #3
3. Validation Rules (only if requested)
- ① Load skill: Read SKILL.md
generating-validation-rule - ② API context: Call for ValidationRule
salesforce-api-context - ③ Status:
type=ValidationRule skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate all Validation Rule files, then proceed to #4
4. Flows (only if requested)
- ① Load skill: Read SKILL.md
generating-flow - ② Pipeline: Run 3-step pipeline (exempt from
metadata-experts/execute_metadata_action)salesforce-api-context - ③ Status:
type=Flow skill=complete pipeline=complete - ④ Generate + Checkpoint: Generate all Flow files via the pipeline, then proceed to #5
5. List Views (only if requested)
- ① Load skill: Read SKILL.md
generating-list-view - ② API context: Call for ListView
salesforce-api-context - ③ Status:
type=ListView skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate all List View files, then proceed to #6
6. Custom Tabs
- ① Load skill: Read SKILL.md
generating-custom-tab - ② API context: Call for CustomTab
salesforce-api-context - ③ Status:
type=CustomTab skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate all Custom Tab files, then proceed to #7
7. FlexiPages
- ① Load skill: Read SKILL.md
generating-flexipage - ② API context: Call for FlexiPage
salesforce-api-context - ③ Status:
type=FlexiPage skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate all FlexiPage files, then proceed to #8
8. Custom Application
- ① Load skill: Read SKILL.md
generating-custom-application - ② API context: Call for CustomApplication
salesforce-api-context - ③ Status:
type=CustomApplication skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate the Custom Application file, then proceed to #9
9. Permission Sets
- ① Load skill: Read SKILL.md
generating-permission-set - ② API context: Call for PermissionSet
salesforce-api-context - ③ Status:
type=PermissionSet skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ Generate + Checkpoint: Generate all Permission Set files — all types complete
针对每个元数据类型依次执行以下四个步骤。完成当前类型的所有四个步骤后,再处理下一个类型。不得跳过任何步骤。
| 步骤 | 操作 | 原因 |
|---|---|---|
| ① 加载技能 | 搜索并读取对应类型的SKILL.md文件 | 获取XML结构、必填元素、命名规则和验证约束 |
| ② 调用API上下文 | 使用以下一种或多种工具,为此元数据类型调用 | 获取当前有效值——允许的枚举值、必填与可选字段、此API版本支持的子类型。技能提供结构;API上下文提供特定版本的准确性。 |
| ③ 记录状态 | 输出: | 确认在写入任何文件前已尝试完成前两步,并记录使用了哪些API上下文工具 |
| ④ 生成文件 | 生成此类型的所有文件,然后检查点 | 仅在完成①②③后执行。验证后,再处理下一个类型。 |
不得将①和②合并为单个操作,或完成①后跳过②。 它们是服务于不同目的的独立步骤。加载技能后可能觉得已准备好生成——请先停止并执行②。
若尝试后不可用,记录并仅使用技能知识生成。完全不尝试②属于错误。
salesforce-api-contextmcp=unavailable1. Custom Objects
- ① 加载技能:读取的SKILL.md
generating-custom-object - ② API上下文:为CustomObject调用
salesforce-api-context - ③ 状态:
type=CustomObject skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成所有Custom Object文件,然后进行步骤#2
2. Custom Fields
- ① 加载技能:读取的SKILL.md
generating-custom-field - ② API上下文:为CustomField调用
salesforce-api-context - ③ 状态:
type=CustomField skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成所有Custom Field文件,然后进行步骤#3
3. Validation Rules(仅在用户请求时执行)
- ① 加载技能:读取的SKILL.md
generating-validation-rule - ② API上下文:为ValidationRule调用
salesforce-api-context - ③ 状态:
type=ValidationRule skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成所有Validation Rule文件,然后进行步骤#4
4. Flows(仅在用户请求时执行)
- ① 加载技能:读取的SKILL.md
generating-flow - ② 流水线:运行三步流水线(豁免于
metadata-experts/execute_metadata_action要求)salesforce-api-context - ③ 状态:
type=Flow skill=complete pipeline=complete - ④ 生成+检查点:通过流水线生成所有Flow文件,然后进行步骤#5
5. List Views(仅在用户请求时执行)
- ① 加载技能:读取的SKILL.md
generating-list-view - ② API上下文:为ListView调用
salesforce-api-context - ③ 状态:
type=ListView skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成所有List View文件,然后进行步骤#6
6. Custom Tabs
- ① 加载技能:读取的SKILL.md
generating-custom-tab - ② API上下文:为CustomTab调用
salesforce-api-context - ③ 状态:
type=CustomTab skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成所有Custom Tab文件,然后进行步骤#7
7. FlexiPages
- ① 加载技能:读取的SKILL.md
generating-flexipage - ② API上下文:为FlexiPage调用
salesforce-api-context - ③ 状态:
type=FlexiPage skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成所有FlexiPage文件,然后进行步骤#8
8. Custom Application
- ① 加载技能:读取的SKILL.md
generating-custom-application - ② API上下文:为CustomApplication调用
salesforce-api-context - ③ 状态:
type=CustomApplication skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成Custom Application文件,然后进行步骤#9
9. Permission Sets
- ① 加载技能:读取的SKILL.md
generating-permission-set - ② API上下文:为PermissionSet调用
salesforce-api-context - ③ 状态:
type=PermissionSet skill=complete mcp=complete|unavailable mcp_tools=<tool-list|none> - ④ 生成+检查点:生成所有Permission Set文件——所有类型处理完成
STEP 3: Final Artifact Assembly
步骤3:最终产物组装
After all phases complete, consolidate outputs into deployment-ready structure.
所有阶段完成后,将输出内容整合为可部署的结构。
Output
输出
The completed build produces:
-
Salesforce DX Project Directory containing all generated metadata
- Organized by standard SFDX structure:
force-app/main/default/
- Organized by standard SFDX structure:
-
Metadata Files - One file per component, organized by type:
force-app/main/default/ ├── objects/ # Custom Objects (.object-meta.xml) ├── fields/ # Custom Fields (.field-meta.xml) ├── tabs/ # Custom Tabs (.tab-meta.xml) ├── flexipages/ # Lightning Pages (.flexipage-meta.xml) ├── applications/ # Custom Applications (.app-meta.xml) ├── permissionsets/ # Permission Sets (.permissionset-meta.xml) ├── flows/ # Flows (.flow-meta.xml) - if applicable └── objects/.../validationRules/ # Validation Rules (.validationRule-meta.xml) - if applicable -
Deployment Manifest ()
package.xml- Lists all components with proper API version
- Organized by metadata type in dependency order
- Ready for Salesforce CLI deployment or Metadata API deployment
-
Build Summary Report - A markdown file listing:
- Every component created
- Component type and API name
- File path location
- Dependency relationships
- Any warnings or recommendations
Example Summary Structure:
Lightning App Build Complete: Project Management App
METADATA GENERATED:
1 Custom Objects
- Project__c -> force-app/main/default/objects/Project__c/Project__c.object-meta.xml
- Task__c -> force-app/main/default/objects/Task__c/Task__c.object-meta.xml
- Resource__c -> force-app/main/default/objects/Resource__c/Resource__c.object-meta.xml
2 Custom Fields
- Project__c.Name -> force-app/main/default/objects/Project__c/fields/Name.field-meta.xml
- Project__c.Status__c -> force-app/main/default/objects/Project__c/fields/Status__c.field-meta.xml
[... etc ...]
3 Custom Tabs
- Project__c -> force-app/main/default/tabs/Project__c.tab-meta.xml
[... etc ...]
4 Lightning Record Pages
- Project_Record_Page -> force-app/main/default/flexipages/Project_Record_Page.flexipage-meta.xml
[... etc ...]
5 Custom Application
- Project_Management -> force-app/main/default/applications/Project_Management.app-meta.xml
6 Permission Sets
- Project_Manager -> force-app/main/default/permissionsets/Project_Manager.permissionset-meta.xml
- Project_User -> force-app/main/default/permissionsets/Project_User.permissionset-meta.xml
WARNINGS: None完成构建后将生成:
-
Salesforce DX项目目录,包含所有生成的元数据
- 按标准SFDX结构组织:
force-app/main/default/
- 按标准SFDX结构组织:
-
元数据文件 - 每个组件对应一个文件,按类型组织:
force-app/main/default/ ├── objects/ # Custom Objects (.object-meta.xml) ├── fields/ # Custom Fields (.field-meta.xml) ├── tabs/ # Custom Tabs (.tab-meta.xml) ├── flexipages/ # Lightning Pages (.flexipage-meta.xml) ├── applications/ # Custom Applications (.app-meta.xml) ├── permissionsets/ # Permission Sets (.permissionset-meta.xml) ├── flows/ # Flows (.flow-meta.xml) - 如适用 └── objects/.../validationRules/ # Validation Rules (.validationRule-meta.xml) - 如适用 -
部署清单()
package.xml- 列出所有组件及正确的API版本
- 按元数据类型的依赖顺序组织
- 可直接用于Salesforce CLI部署或Metadata API部署
-
构建总结报告 - 一个markdown文件,包含:
- 创建的每个组件
- 组件类型和API名称
- 文件路径
- 依赖关系
- 任何警告或建议
总结报告示例结构:
Lightning应用构建完成:项目管理应用
生成的元数据:
1. 自定义对象
- Project__c -> force-app/main/default/objects/Project__c/Project__c.object-meta.xml
- Task__c -> force-app/main/default/objects/Task__c/Task__c.object-meta.xml
- Resource__c -> force-app/main/default/objects/Resource__c/Resource__c.object-meta.xml
2. 自定义字段
- Project__c.Name -> force-app/main/default/objects/Project__c/fields/Name.field-meta.xml
- Project__c.Status__c -> force-app/main/default/objects/Project__c/fields/Status__c.field-meta.xml
[... 其他字段 ...]
3. 自定义标签
- Project__c -> force-app/main/default/tabs/Project__c.tab-meta.xml
[... 其他标签 ...]
4. Lightning记录页面
- Project_Record_Page -> force-app/main/default/flexipages/Project_Record_Page.flexipage-meta.xml
[... 其他页面 ...]
5. 自定义应用
- Project_Management -> force-app/main/default/applications/Project_Management.app-meta.xml
6. 权限集
- Project_Manager -> force-app/main/default/permissionsets/Project_Manager.permissionset-meta.xml
- Project_User -> force-app/main/default/permissionsets/Project_User.permissionset-meta.xml
警告:无Validation
验证
Before presenting the completed build to the user, verify cross-component integrity:
- Object-Tab Coverage: Every Custom Object has at least one Custom Tab
- Relationship Integrity: Every Custom Object referenced in a relationship (parent or child) exists in the build
- Field References in Pages: Every field referenced in a FlexiPage exists on the corresponding object
- Tab References in App: Every tab referenced in the Custom Application was successfully created
- Permission Set Completeness: Permission Sets grant access to all generated objects, fields, tabs, and the application
- No Orphaned Components: No tabs without objects, no pages without corresponding tabs, no app without tabs
- Deployment Manifest Completeness: includes all generated components in proper dependency order
package.xml
Validation Failure Handling (Category 2):
- If validation fails, include failed checks in the Build Summary Report under a section
VALIDATION WARNINGS - These are post-generation issues — do NOT block delivery of the build, but clearly communicate what needs manual review or correction
- Provide specific remediation steps for each failed validation check
Note: Individual component validations (reserved words, name lengths, field types, etc.) are handled by specialized metadata skills and do not need to be re-validated here.
向用户交付完成的构建产物前,需验证跨组件的完整性:
- 对象-标签覆盖:每个Custom Object至少有一个Custom Tab
- 关系完整性:关系中引用的每个Custom Object(父或子)都存在于构建产物中
- 页面中的字段引用:FlexiPage中引用的每个字段都存在于对应对象上
- 应用中的标签引用:Custom Application中引用的每个标签都已成功创建
- 权限集完整性:权限集授予对所有生成的对象、字段、标签和应用的访问权限
- 无孤立组件:不存在无对应对象的标签、无对应标签的页面、无对应标签的应用
- 部署清单完整性:按正确的依赖顺序包含所有生成的组件
package.xml
验证失败处理(类别2):
- 若验证失败,在构建总结报告的「验证警告」部分列出未通过的检查项
- 这些是生成后的问题——不得阻止交付构建产物,但需明确告知需要手动检查或修正的内容
- 为每个未通过的验证检查提供具体的修复步骤
注意:单个组件的验证(如保留字、名称长度、字段类型等)由专用元数据技能处理,无需在此重复验证。
Error Handling
错误处理
Category 1: Stop and Ask User
类别1:停止并询问用户
Stop execution and ask for clarification if:
- User request is too vague to extract any objects or fields
- Conflicting requirements detected (e.g., "make it private" + "everyone should see it")
- Invalid Salesforce naming detected (reserved words like ,
Order)Group
出现以下情况时,停止执行并请求用户澄清:
- 用户请求过于模糊,无法提取任何对象或字段
- 检测到冲突需求(如「设为私有」+「所有人都应可见」)
- 检测到无效的Salesforce命名(如、
Order等保留字)Group
Category 2: Post-Generation Warnings (Log Warning, Continue)
类别2:生成后警告(记录警告,继续执行)
Log warning and continue if:
- Cross-component validation check fails (e.g., field referenced in FlexiPage doesn't exist on object)
- Optional component generation fails (e.g., List View generation has minor issues)
- Validation Rule or Flow has minor output issues
Warning Pattern:
Warning: [Component Type] generation encountered issue
Component: [Name]
Issue: [Description]
Impact: [What won't work]
Recommendation: [How to fix manually]
Continuing with remaining components...出现以下情况时,记录警告并继续执行:
- 跨组件验证检查失败(如FlexiPage中引用的字段不存在于对象上)
- 可选组件生成失败(如列表视图生成存在小问题)
- Validation Rule或Flow存在轻微输出问题
警告格式:
警告:[组件类型]生成遇到问题
组件:[名称]
问题:[描述]
影响:[哪些功能无法正常工作]
建议:[手动修复方法]
继续处理剩余组件...Best Practices
最佳实践
1. Always Follow Dependency Order
1. 始终遵循依赖顺序
Never invoke skills out of sequence. Fields need objects, pages need tabs, apps need tabs.
切勿打乱技能调用顺序。字段依赖对象,页面依赖标签,应用依赖标签。
2. Use Skills When Available
2. 优先使用现有技能
Don't reinvent the wheel. Specialized skills have field-specific validation that prevents deployment errors.
不要重复造轮子。专用技能包含特定字段的验证,可避免部署错误。
3. Generate Thoughtful Defaults
3. 生成合理的默认值
When user doesn't specify details:
- Use Text name fields for human entities
- Use AutoNumber for transactions
- Enable Search and Reports for user-facing objects
- Set sharingModel based on relationships
当用户未指定细节时:
- 为人类实体使用文本类型名称字段
- 为交易使用自动编号类型
- 为面向用户的对象启用搜索和报表功能
- 根据关系设置sharingModel
4. Validate Before Building
4. 构建前验证
Check for:
- Reserved words in API names
- Relationship limits (max 2 M-D per object)
- Name length limits
- Duplicate names
检查以下内容:
- API名称中的保留字
- 关系限制(每个对象最多2个主明细关系)
- 名称长度限制
- 重复名称