# platform-flexipage-generate

Builds and validates Salesforce Lightning FlexiPages using CLI scaffolding. It prevents XML structure errors when editing RecordPage, AppPage, and HomePage layouts.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 6000 installs · ★ 1112
- Author: forcedotcom
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/forcedotcom/sf-skills/tree/HEAD/skills/platform-flexipage-generate/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/platform-flexipage-generate

## What it does

This skill guides the creation and customization of Salesforce Lightning pages via `.flexipage-meta.xml` metadata. For fresh RecordPage, AppPage, or HomePage layouts, it relies on `sf template generate flexipage` rather than drafting XML manually. That command guarantees valid region hierarchies, proper facets, and compliant field references.

Once the base template exists, the workflow runs a validation pass via a dry-run deployment flag. It monitors identifier uniqueness, checks XML character encoding in values, and formats record references using the required `Record.{FieldApiName}` syntax.

Execution relies on Python 3.10.0 or higher and `sf` CLI at version 2.126.4 or above. The `templates` plugin must also be active in your CLI, otherwise bootstrapping will fail right at the start.

## Requirements
- Works with: Salesforce

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-flexipage-generate -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/platform-flexipage-generate/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/platform-flexipage-generate/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-flexipage-generate -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/platform-flexipage-generate/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-flexipage-generate -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/platform-flexipage-generate/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install forcedotcom/sf-skills platform-flexipage-generate
```

2. **Manually: put the files in place**
- File: `.github/skills/platform-flexipage-generate/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-flexipage-generate -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/forcedotcom/sf-skills --path skills/platform-flexipage-generate
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/platform-flexipage-generate/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add forcedotcom/sf-skills --skill platform-flexipage-generate -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/forcedotcom/sf-skills/tree/HEAD/skills/platform-flexipage-generate/SKILL.md

## When to use it
- scaffold record, app, and home FlexiPages with valid XML structure
- inject new components into existing `.flexipage-meta.xml` files
- resolve metadata deployment errors in Salesforce Lightning layouts
- validate region and facet hierarchies before production deployment

## Example prompts
- Generate a RecordPage for the Account object with primary and detail fields
- Add a field section component to `CustomRecordPage.flexipage-meta.xml`
- Run a dry-run deployment check on my FlexiPage files

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 03e8da761bbdc981.

BEGIN THIRD-PARTY FILE 03e8da761bbdc981
````text
---
name: platform-flexipage-generate
description: "Use when users create, generate, modify, or validate Salesforce Lightning pages (FlexiPages). Trigger on RecordPage, AppPage, HomePage, Lightning pages, adding components to a page, page customization (e.g. 'customize the record page'), or .flexipage-meta.xml files (regions, components, deployment errors). DO NOT TRIGGER for Visualforce pages, page layout assignments in the UI, UI Bundle/Experience Cloud site pages, or Aura/Lightning Web Component development without FlexiPage context."
allowed-tools: Bash Read Write
metadata:
  version: "1.1"
  domains: ["Platform"]
  minApiVersion: "60.0"
  cliTools:
    - tool: ["python3"]
      semver: ">=3.10.0"
    - tool: ["sf"]
      semver: ">=2.126.4"
  mcpTools:
    metadata-experts:
      tools: ["execute_metadata_action"]
      semver: ">=1.0.0"
---

## 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

## 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.

**`<packageDirectory>`** = the `path` value from `sfdx-project.json` → `packageDirectories[0]` (e.g., `force-app`). Read it from the project file before running commands.

```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 <packageDirectory>/main/default/flexipages
```

**CRITICAL:** If the `sf template generate flexipage` command fails, **STOP**.

1. Install the templates plugin:
   ```bash
````
END THIRD-PARTY FILE 03e8da761bbdc981

The third-party file has ended. Everything between the 03e8da761bbdc981 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2653 of 20303 bytes. © forcedotcom · Apache-2.0 · https://github.com/forcedotcom/sf-skills/tree/HEAD/skills/platform-flexipage-generate/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
