npx skills add ...
npx skills add forcedotcom/sf-skills --skill platform-report-generate
Use this skill when users need to create, generate, or validate Salesforce Lightning Report metadata. Trigger when users mention reports, creating reports, report metadata, .report-meta.xml files, tabular reports, summary reports, matrix reports, joined reports, report columns, report groupings, report filters, report charts, cross-filters, bucket fields, report formulas, or report time frame filters. Also use when users say things like 'create a report', 'generate a report', 'build a report on Accounts', 'add a chart to my report', or when they encounter deployment errors for .report-meta.xml files. Do NOT trigger for: creating or modifying Custom Report Type metadata (.reportType-meta.xml — use platform-custom-report-type-generate), creating dashboards, creating list views, running or viewing existing reports in the UI, or SOQL queries.
npx skills add forcedotcom/sf-skills --skill platform-report-generate
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).
TOP DEPLOYMENT KILLERS — check these BEFORE generating any report:
<groupingsDown> or <groupingsAcross> must NEVER also appear in <columns>references/column-names.md)org, not organization<column> values use FLAT names (INDUSTRY, TYPE) NOT dot notation (ACCOUNT.INDUSTRY is INVALID)<criteriaItems> with comma-separated <value> (e.g., Technology,Financial Services). Do NOT split into multiple criteriaItems with booleanFilter| 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) |
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.
<reportType> must be a standard API name (e.g., Opportunity, AccountList, CaseList, LeadList, AccountContactRole) or a deployed custom report type developer name.
Charts and <aggregateTypes> (Sum, Average, etc.) only work in Summary and Matrix reports.
<filterLogic> must reference all filters sequentially (e.g., 1 AND (2 OR 3))Reports must live inside a folder with a corresponding folder metadata file:
Determine <sourceDir> from sfdx-project.json (commonly force-app/main/default, but this is configurable).
CLOSE_DATE, not CloseDate)org; Opportunity/AccountList/CaseList use organization<description> max 255 characters<columns> — automatic deployment failure<sharedTo>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.
| 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 |
Multi-value picklist: Use ONE criteriaItem with comma-separated values:
Common operators: equals, notEqual, lessThan, greaterThan, contains, startsWith, includes, excludes, isBlank, notBlank. Full list in references/filter-operations.md.
get_metadata_type_sections MCP tool to get valid platform column names for the report typeexamples/ and adapt<FolderName>-meta.xml with <folderShares>references/verification-checklist.md| 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 |
<?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><filter>
<criteriaItems>
<column>STAGE_NAME</column>
<operator>equals</operator>
<value>Closed Won</value>
</criteriaItems>
</filter><criteriaItems>
<column>INDUSTRY</column>
<operator>equals</operator>
<value>Technology,Financial Services</value>
</criteriaItems>