
Generating Flexipage
Generate and validate Salesforce Lightning FlexiPage XML (Record, App, Home pages) with CLI-backed templates instead of hand-writing metadata that fails deployment.
Overview
Generating-flexipage is an agent skill for the Build phase that creates, edits, and validates Salesforce Lightning FlexiPage metadata using CLI-first templates and structured XML guidance.
Install
npx skills add https://github.com/forcedotcom/afv-library --skill generating-flexipageWhat is this skill?
- Covers RecordPage, AppPage, and HomePage FlexiPage types with component and region configuration guidance
- Mandatory workflow: bootstrap new pages with the Salesforce CLI template command—never draft FlexiPage XML from scratch
- Supports add-component-to-existing-page edits and troubleshooting deployment errors on *.flexipage-meta.xml
- Triggers on Lightning page, page layout, and FlexiPage customization language in Salesforce context
- Specification-driven generation aligned with AFV library FlexiPage patterns
- Three FlexiPage types explicitly covered: RecordPage, AppPage, HomePage
- Hard rule: new FlexiPages must ALWAYS start with the CLI template command
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 a Lightning page or a component on a record page but hand-written FlexiPage XML keeps failing deploy or breaks regions and component config.
Who is it for?
Developers customizing Salesforce Lightning experiences who already use Salesforce CLI and metadata deployments.
Skip if: Teams building only non-Salesforce web apps, or anyone trying to skip CLI bootstrap and invent FlexiPage XML from scratch.
When should I use this skill?
User needs to create, generate, modify, or validate Salesforce Lightning FlexiPages; mentions RecordPage, AppPage, HomePage, FlexiPage XML, or page customization in Salesforce context.
What do I get? / Deliverables
You get deployable FlexiPage metadata bootstrapped from CLI templates with clear steps for components, regions, and error resolution.
- Valid FlexiPage metadata XML from CLI template
- Updated flexipage-meta.xml with components and regions configured
Recommended Skills
Journey fit
FlexiPages are Salesforce UI and metadata artifacts created during product build on the platform, before release to orgs. The skill centers on Salesforce platform integration—components, regions, flexipage-meta.xml, and deployment—not generic web frontend alone.
How it compares
Use this procedural Salesforce skill instead of generic XML editing or one-off chat snippets that omit CLI-valid structure.
Common Questions / FAQ
Who is generating-flexipage for?
Salesforce developers and admins shipping Lightning Record, App, or Home pages who want agents to follow CLI-first FlexiPage rules.
When should I use generating-flexipage?
During Build when creating or editing FlexiPages, adding Lightning components to pages, troubleshooting flexipage-meta.xml deploy errors, or when users mention Lightning page customization in a Salesforce org.
Is generating-flexipage safe to install?
It teaches metadata and CLI workflows; review the Security Audits panel on this page before granting shell, filesystem, and deployment access in your agent environment.
SKILL.md
READMESKILL.md - Generating Flexipage
## When to Use This Skill Use this skill when you need to: - Create Lightning pages (RecordPage, AppPage, HomePage) - Generate FlexiPage metadata XML - Add components to existing FlexiPages - Troubleshoot FlexiPage deployment errors - Understand FlexiPage structure and component configuration - Work with page layouts or Lightning page customization - Edit or update ANY *.flexipage-meta.xml file ## Specification # FlexiPage Generation Guide ## Overview **CRITICAL: When creating NEW FlexiPages, you MUST ALWAYS start with the CLI template command.** Never create FlexiPage XML from scratch - the CLI provides valid structure, proper regions, and correct component configuration that prevents deployment errors. Generate Lightning pages (RecordPage, AppPage, HomePage) using CLI bootstrapping for component discovery and configuration. --- ## Quick Start Workflow ### Step 1: Bootstrap with CLI **MANDATORY FOR NEW PAGES: This step is NOT optional.** Always use the CLI template command when creating a new FlexiPage. The CLI generates valid XML structure, proper regions, and correct metadata that prevents common deployment errors. Only skip this step if you're editing an existing FlexiPage file. ```bash sf template generate flexipage \ --name <PageName> \ --template <RecordPage|AppPage|HomePage> \ --sobject <SObject> \ --primary-field <Field1> \ --secondary-fields <Field2,Field3> \ --detail-fields <Field4,Field5,Field6,Field7> \ --output-dir force-app/main/default/flexipages ``` **CRITICAL:** If the `sf template generate flexipage` command fails, **STOP**. 1. Install the templates plugin: ```bash sf plugins install templates ``` 2. Retry the `sf template generate flexipage` command 3. Verify the FlexiPage XML file was created Do NOT continue to Step 2 until the template command succeeds. The generated XML is required for the entire workflow. #### **Template-specific requirements** **RecordPage:** - Requires `--sobject` (e.g., Account, Custom_Object__c) - Requires field parameters: - `--primary-field`: Most important identifying field (e.g., Name) - `--secondary-fields`: Record summary (recommended 4-6, max 12) - `--detail-fields`: Full record details, including required fields (e.g., Name) **AppPage:** - No additional requirements **HomePage:** - No additional requirements #### **Field Selection Rules** - **Validate fields exist**: Use MCP tools or describe commands to discover available fields for the object before specifying them in the command - **Prefer compound fields**: Use `Name` (not `FirstName`/`LastName`), `BillingAddress` (not `BillingStreet`/`BillingCity`/`BillingState`), `MailingAddress`, etc. when available - **Include required fields in detail-fields**: Always include object required fields (like `Name`) in the `--detail-fields` parameter, even if they're also used in `--primary-field` or `--secondary-fields` #### **What you get** - Valid FlexiPage XML with correct structure - Pre-configured regions and basic components - Proper field references and facet structure - Ready to deploy as-is or enhance further ### Step 2: Deploy Base Page Run a **dry-run** deployment of the entire project to validate the page and dependencies: ```bash sf project deploy start --dry-run -d "force-app/main/