Skip to main content
skill CX Codex

platform-report-generate — Claude Code skill: Salesforce report

This skill writes and validates Salesforce Lightning report metadata: columns, groupings, filters, charts. Useful when a .report-meta.xml deploy keeps failing.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add forcedotcom/sf-skills --skill platform-report-generate -a claude-code
Open on GitHub

What platform-report-generate does

The skill handles .report-meta.xml files — tabular, summary, matrix and joined reports. It covers columns, row and column groupings, filters, charts, cross-filters, buckets, formulas and time-frame filters. Format decides what is required: tabular takes no groupings, summary needs at least one down grouping, matrix needs both directions, and joined reports hold two to five blocks.

Before generating anything, the skill walks through the usual deploy killers. Fields in <groupingsDown> or <groupingsAcross> must never repeat in <columns>. Column names are report-type-specific, so it tells the agent to confirm them through the MCP tools get_metadata_type_sections or get_metadata_type_context — that means the salesforce-api-context MCP server at version 1.0.0 or higher. Filter <column> values use flat names (INDUSTRY), never dot notation. Multi-value picklists go into one <criteriaItems> with comma-separated values.

Each report lives in a folder with a matching <FolderName>-meta.xml that requires a <folderShares> block. The source root comes from sfdx-project.json → packageDirectories[].path. Minimum API version is 60.0. The skill explicitly stays out of Custom Report Type metadata, dashboards, list views and SOQL — report types belong to the sibling platform-custom-report-type-generate.

What it helps with

  • build a .report-meta.xml for a summary or matrix report
  • fix a deploy error caused by a field sitting in both columns and groupings
  • match platform column names to a specific report type
  • filter a picklist on several values in one criteria block
  • set a time-frame filter with a valid date interval

Example prompts for the agent

  • Create a summary report on Opportunity grouped by stage with a sum aggregate
  • Build a matrix .report-meta.xml with row and column groupings plus a chart
  • Check my report — the .report-meta.xml deploy is failing

How to install platform-report-generate

1Skills CLI (Vercel)

npx skills add forcedotcom/sf-skills --skill platform-report-generate -a claude-code

2Manually: put the files in place

~/.claude/skills/platform-report-generate/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/platform-report-generate/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about platform-report-generate

How do I install platform-report-generate in Claude?

Run npx skills add forcedotcom/sf-skills --skill platform-report-generate -a claude-code. The skill lands at ~/.claude/skills/platform-report-generate/SKILL.md.

What does platform-report-generate do?

It helps create and validate Salesforce Lightning report metadata: columns, groupings, filters, charts, cross-filters and buckets. It also checks the common causes of deploy errors.

How is it different from platform-custom-report-type-generate?

This one works on .report-meta.xml; the other handles Custom Report Type metadata. Dashboards, list views and SOQL are out of scope here.

Source text

SKILL.md · Apache-2.0
---
name: platform-report-generate
description: "Use when users create, generate, or validate Salesforce Lightning Report metadata (.report-meta.xml) — tabular, summary, matrix, or joined reports with columns, groupings, filters, charts, cross-filters, buckets, formulas, or time-frame filters. Triggers on \"create a report\", \"build a report\", \"add a chart\", or .report-meta.xml deploy errors. Do NOT trigger for Custom Report Type metadata (use platform-custom-report-type-generate), dashboards, list views, running reports in the UI, or SOQL."
metadata:
  version: "1.0"
  domains: ["Platform"]
  minApiVersion: "60.0"
  relatedSkills:
    - "platform-custom-report-type-generate"
  mcpTools:
    salesforce-api-context:
      tools: ["get_metadata_type_context", "get_metadata_type_sections", "get_metadata_type_shape"]
      semver: ">=1.0.0"
---

## Overview

Lightning Reports define how Salesforce data is queried, grouped, filtered, and displayed. Each report is a single `.report-meta.xml` file placed under `reports/<FolderName>/` within the project's source directory (check `sfdx-project.json` → `packageDirectories[].path` for the source root).

## Critical Rules (Read First)

**TOP DEPLOYMENT KILLERS — check these BEFORE generating any report:**
1. **Grouping fields in columns** — Fields in `<groupingsDown>` or `<groupingsAcross>` must NEVER also appear in `<columns>`
2. **Wrong column names** — Column names are report-type-specific. ALWAYS call MCP tools to verify (see `references/column-names.md`)
3. **Wrong scope** — LeadList uses `org`, not `organization`
4. **Filter column dot notation** — Filter `<column>` values use FLAT names (`INDUSTRY`, `TYPE`) NOT dot notation (`ACCOUNT.INDUSTRY` is INVALID)
5. **Multi-value picklist filters** — Use ONE `<criteriaItems>` with comma-separated `<value>` (e.g., `Technology,Financial Services`). Do NOT split into multiple criteriaItems with booleanFilter

### Rule 1: Format Determines Required Elements

| Format | `<groupingsDown>` | `<groupingsAcross>` | `<block>` |
|--------|-------------------|---------------------|-----------|
| `Tabular` | Not allowed | Not allowed | No |
| `Summary` | At least 1 (max 3) | Not allowed | No |
| `Matrix` | At least 1 (max 3) | At least 1 (max 3) | No |
| `Joined` | Not at top level | Not at top level | At least 2 (max 5) |

### Rule 2: Use Platform Column Names

Report metadata uses **platform report column names**, NOT raw API field names. **ALWAYS call `get_metadata_type_sections` or `get_metadata_type_context` to confirm valid column names.** See `references/column-names.md` for common mappings per report type.

### Rule 3: Valid Report Type Required

`<reportType>` must be a standard API name (e.g., `Opportunity`, `AccountList`, `CaseList`, `LeadList`, `AccountContactRole`) or a deployed custom report type developer name.

### Rule 4–5: Chart & Aggregates Require Summary/Matrix

Charts and `<aggregateTypes>` (Sum, Average, etc.) only work in Summary and Matrix reports.

### Rule 6–8: Limits

- Max **3 cross-filters** per report, each with up to **5 criteria items**
- `<filterLogic>` must reference all filters sequentially (e.g., `1 AND (2 OR 3)`)
- Joined reports: 2–5 blocks, each block format must be Summary or Matrix (not Tabular)

### Rule 9: Folder Structure

Reports must live inside a folder with a corresponding folder metadata file:
```xml
<sourceDir>/reports/<FolderName>/<ReportName>.report-meta.xml
<sourceDir>/reports/<FolderName>-meta.xml
```
Determine `<sourceDir>` from `sfdx-project.json` (commonly `force-app/main/default`, but this is configurable).

### Rule 10–11: Date Columns & Scope

- Date columns use platform names (`CLOSE_DATE`, not `CloseDate`)
- LeadList scope is `org`; Opportunity/AccountList/CaseList use `organization`

### Rule 12–13: Description & Groupings

- `<description>` max **255 characters**
- Grouping fields must NOT appear in `<columns>` — automatic deployment failure

### Rule 14: Folder Metadata Requires `<sharedTo>`

```xml
<?xml version="1.0" encoding="UTF-8"?>
<ReportFolder xmlns="http://soap.sforce.com/2006/04/metadata">
    <folderShares>
        <accessLevel>Manage</accessLevel>
        <sharedTo>AllInternalUsers</sharedTo>
        <sharedToType>Group</sharedToType>
    </folderShares>
    <name>My Report Folder</name>
</ReportFolder>
```

### Rule 15: Valid Date Intervals Only

Use `INTERVAL_CURRENT` for "this quarter", `INTERVAL_CURY` for "this year", `INTERVAL_LAST30` for last 30 days. Do NOT use `INTERVAL_CURQ` — it is not valid. See `references/date-intervals.md` for the full list.

## Top-Level Elements

| Element | Required | Notes |
|---------|----------|-------|
| `<name>` | Yes | Report name (max 40 chars) |
| `<reportType>` | Yes | Report type API name |
| `<format>` | Yes | `Tabular`, `Summary`, `Matrix`, or `Joined` |
| `<scope>` | Recommended | `organization` (or `org` for LeadList) |
| `<columns>` | Yes | Field columns — each has `<field>` and optional `<aggregateTypes>` |
| `<filter>` | No | Contains `<criteriaItems>` with `<column>`, `<operator>`, `<value>` |
| `<groupingsDown>` | Conditional | Row groupings: `<field>`, `<dateGranularity>`, `<sortOrder>` |
| `<groupingsAcross>` | Conditional | Column groupings (Matrix only) |
| `<timeFrameFilter>` | Recommended | `<dateColumn>`, `<interval>`, optional `<startDate>`/`<endDate>` |
| `<chart>` | No | See `references/chart-types.md` |
| `<buckets>` | No | Bucket field definitions |
| `<crossFilters>` | No | Cross-object filters (`with`/`without`) |
| `<showDetails>` | Recommended | `true`/`false` |
| `<showGrandTotal>` | Recommended | `true`/`false` |
| `<showSubTotals>` | Recommended | `true`/`false` |
| `<description>` | Recommended | Business purpose (max 255 chars) |
| `<block>` | Conditional | Joined format blocks |

## Filter Syntax

```xml
<filter>
    <criteriaItems>
        <column>STAGE_NAME</column>
        <operator>equals</operator>
        <value>Closed Won</value>
    </criteriaItems>
</filter>
```

**Multi-value picklist:** Use ONE criteriaItem with comma-separated values:
```xml
<criteriaItems>
    <column>INDUSTRY</column>
    <operator>equals</operator>
    <value>Technology,Financial Services</value>
</criteriaItems>
```

Common operators: `equals`, `notEqual`, `lessThan`, `greaterThan`, `contains`, `startsWith`, `includes`, `excludes`, `isBlank`, `notBlank`. Full list in `references/filter-operations.md`.

## Generation Workflow

1. **Gather Requirements** — object, fields, groupings, filters, chart needs
2. **Determine Format** — no groupings → Tabular; row groupings → Summary; row + column → Matrix; multiple objects → Joined
3. **Identify Column Names** — call `get_metadata_type_sections` MCP tool to get valid platform column names for the report type
4. **Author Metadata** — start from closest example in `examples/` and adapt
5. **Create Folder** — generate folder directory + `<FolderName>-meta.xml` with `<folderShares>`
6. **Validate** — run through `references/verification-checklist.md`

## Reference File Index

| File | When to read |
|------|--------------|
| `references/column-names.md` | Step 3 — column name mappings per report type |
| `references/date-intervals.md` | When setting timeFrameFilter intervals |
| `references/chart-types.md` | When adding a chart — all 17 types + legendPosition rules |
| `references/filter-operations.md` | When building filters — complete operator reference |
| `references/verification-checklist.md` | Step 6 — pre-deploy validation |
| `references/errors-and-troubleshooting.md` | When fields are missing or deployment fails |
| `examples/TabularOpportunitiesReport.report-meta.xml` | Tabular report template |
| `examples/OpportunitiesByStageReport.report-meta.xml` | Summary report with chart |
| `examples/OpportunitiesByStageAndQuarter.report-meta.xml` | Matrix report template |
| `examples/AccountsCreatedThisYear.report-meta.xml` | Filtered report with time frame |

© forcedotcom · Apache-2.0 · forcedotcom/sf-skills

Similar skills

All skills for Agent setup: memory, context, orchestration →

From the same set181

platform-deploy-validate Runs a server-side validation of Salesforce metadata before deploying. Errors show up, the org stays untouched, and production returns a job ID for a quick deploy. CX Codex +1 3,000installs dx-devops-work-item-manage Runs the DevOps Center work item lifecycle from the terminal: list, create, commit to the branch, move status, open a pull request. CX Codex +1 3,000installs platform-architecture-analyze Audits a Salesforce DX project against the Salesforce Well-Architected framework. It checks code and metadata, scores pillars, and leaves repo files untouched. CX Codex +1 2,900installs sales-agentforce-pipeline-management-configure Configures and repairs Agentforce Pipeline Management and the Sales Management agent in a Salesforce org. Use it to set up Opportunity field suggestions and connected data sources. CX Codex +1 2,900installs platform-capability-search This skill tells you where you are in the Connect → Project → Build → Test → Deploy → Observe journey and finds a plugin for a task no installed skill covers. CX Codex +1 2,800installs experience-lwr-site-generate Builds and edits Salesforce Experience Cloud LWR sites through DigitalExperience metadata: pages, routes, themes, guest access. CX Codex +1 2,700installs dx-apexguru-scan Runs an ApexGuru SFAP Scan API performance audit on Salesforce Apex code to detect governor limit antipatterns and query bottlenecks. CX Codex +1 2,700installs platform-environment-validate The skill scans your local Salesforce environment, reports each tool's status and offers to install or update what is missing. CX Codex +1 2,700installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor