• Projects
  • Service
  • About
  • branding.bz
  • Podcast
  • Tips
  • FAQ
  • Recruit
  • Download
  • Contact
  • branding.bz(ブランド構築SaaS)
  • DESIGN NOW(デザインメディア)
  • X
  • LinkedIn
  • Spotify
  • Facebook

213-0011 神奈川県川崎市高津区久本3-6-7-303

© 2026 ID INC. All rights reserved

claude-skills/スキル
SKILLOfficialdevelopment

platform-report-generate

プラグイン
salesforce-development
ソース
GitHub で見る ↗
説明

次のような場合に使用:ユーザーが Salesforce Lightning レポートのメタデータ(データ構造や設定情報)を作成、生成、または検証する必要がある場合。 レポート、レポート作成、レポートメタデータ、.report-meta.xml ファイル、表形式レポート、集計レポート、マトリックス形式レポート、結合レポート、レポート列、レポートグループ化、レポートフィルター、レポートチャート、クロスフィルター、バケットフィールド(カスタムカテゴリ)、レポート数式、またはレポート期間フィルターなどの言葉がユーザーから出た場合に起動します。 また、「レポートを作成して」「レポートを生成して」「アカウント情報のレポートを作成して」「レポートにチャートを追加して」といった表現や、.report-meta.xml ファイルのデプロイ(配置)エラーが発生した場合にも使用します。 **使用しない場合:** - カスタムレポートタイプのメタデータ作成・編集(.reportType-meta.xml — そちらは platform-custom-report-type-generate を使用) - ダッシュボード作成 - リストビュー作成 - UI 上での既存レポート実行・表示 - SOQL クエリ(データベース検索言語)

原文を表示

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.

ユースケース
  • Salesforceレポートのメタデータを作成・生成する
  • レポートメタデータを検証する
  • レポートに列やチャートを追加する
  • .report-meta.xmlファイルのデプロイエラーを対処する
本文(日本語訳)

概要

Lightning Reports(レポート)は、Salesforce データの検索、グループ化、フィルター、表示方法を定義します。各レポートは、プロジェクトのソース ディレクトリ内の reports/<フォルダ名>/ に配置された単一の .report-meta.xml ファイルです(ソース ディレクトリの場所は、sfdx-project.json の packageDirectories[].path で確認できます)。

重要なルール(まず最初に読んでください)

デプロイ失敗の主な原因 — レポート作成前に必ず確認:

  1. グループ化フィールドをカラムに含める — <groupingsDown> または <groupingsAcross> に指定したフィールドは、<columns> に絶対に記載してはいけません
  2. 間違ったカラム名 — カラム名はレポート タイプごとに異なります。必ず MCP ツールで確認してください(references/column-names.md を参照)
  3. スコープの間違い — LeadList(潜在顧客リスト)は org を使い、organization ではありません
  4. フィルター カラムのドット記法 — フィルターの <column> 値は、単純な名前(INDUSTRY、TYPE)を使用します。ドット記法(ACCOUNT.INDUSTRY など)は使えません
  5. 複数選択肢ピックリスト フィルター — 1 つの <criteriaItems> にカンマ区切り値を入れます(例:Technology,Financial Services)。複数の criteriaItems に分割しないでください

ルール 1: フォーマットが必須要素を決定

フォーマット <groupingsDown> <groupingsAcross> <block>
Tabular(表形式) 不可 不可 なし
Summary(集計) 1 個以上(最大 3 個) 不可 なし
Matrix(マトリックス) 1 個以上(最大 3 個) 1 個以上(最大 3 個) なし
Joined(結合) トップレベル不可 トップレベル不可 2~5 個必須

ルール 2: プラットフォーム カラム名を使用

レポート メタデータは、生の API フィールド名ではなく、プラットフォーム レポート カラム名を使用します。get_metadata_type_sections または get_metadata_type_context MCP ツールを呼び出して、有効なカラム名を確認してください。references/column-names.md には、レポート タイプごとの一般的なマッピングが記載されています。

ルール 3: 有効なレポート タイプが必須

<reportType> には、標準の API 名(例:Opportunity、AccountList、CaseList、LeadList、AccountContactRole)または、デプロイ済みのカスタム レポート タイプの開発者名を指定します。

ルール 4~5: グラフと集計は集計形式またはマトリックス形式で必須

グラフと <aggregateTypes>(合計、平均など)は、集計形式またはマトリックス形式のレポートでのみ機能します。

ルール 6~8: 上限

  • レポートごとに最大 3 つのクロス フィルター(各フィルターは最大 5 個の条件項目)
  • <filterLogic> は、すべてのフィルターを順序立てて参照する必要があります(例:1 AND (2 OR 3))
  • 結合形式のレポート:2~5 個のブロック(各ブロックは集計形式またはマトリックス形式。表形式は不可)

ルール 9: フォルダ構造

レポートは、対応するフォルダ メタデータ ファイルを持つフォルダの中に配置する必要があります:

<ソースディレクトリ>/reports/<フォルダ名>/<レポート名>.report-meta.xml
<ソースディレクトリ>/reports/<フォルダ名>-meta.xml

<ソースディレクトリ> は sfdx-project.json から判定します(通常は force-app/main/default、ただし設定可能です)。

ルール 10~11: 日付カラムとスコープ

  • 日付カラムはプラットフォーム名を使用します(CloseDate ではなく CLOSE_DATE)
  • LeadList のスコープは org。Opportunity・AccountList・CaseList は organization です

ルール 12~13: 説明とグループ化

  • <description> は最大 255 文字
  • グループ化フィールドは <columns> に記載してはいけません — デプロイ時に自動的に失敗します

ルール 14: フォルダ メタデータには <sharedTo> が必須

<?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>レポート フォルダ名</name>
</ReportFolder>

ルール 15: 有効な日付間隔のみ

INTERVAL_CURRENT(今四半期)、INTERVAL_CURY(今年度)、INTERVAL_LAST30(過去 30 日)を使用します。INTERVAL_CURQ は有効ではありません。完全なリストは references/date-intervals.md を参照してください。

トップレベル要素

要素 必須 説明
<name> はい レポート名(最大 40 文字)
<reportType> はい レポート タイプ API 名
<format> はい Tabular、Summary、Matrix、Joined
<scope> 推奨 organization(LeadList の場合は org)
<columns> はい フィールド カラム — 各カラムに <field> と、任意で <aggregateTypes> を含める
<filter> いいえ <criteriaItems>(<column>、<operator>、<value> を含む)を保持
<groupingsDown> 条件付き 行グループ化:<field>、<dateGranularity>、<sortOrder>
<groupingsAcross> 条件付き 列グループ化(マトリックス形式のみ)
<timeFrameFilter> 推奨 <dateColumn>、<interval>、任意で <startDate>/<endDate>
<chart> いいえ references/chart-types.md を参照
<buckets> いいえ バケット フィールド定義
<crossFilters> いいえ クロス オブジェクト フィルター(with/without)
<showDetails> 推奨 true/false
<showGrandTotal> 推奨 true/false
<showSubTotals> 推奨 true/false
<description> 推奨 ビジネス上の目的(最大 255 文字)
<block> 条件付き 結合形式のブロック

フィルター構文

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

複数選択肢ピックリスト: 1 つの criteriaItem にカンマ区切り値を使用します:

<criteriaItems>
    <column>INDUSTRY</column>
    <operator>equals</operator>
    <value>Technology,Financial Services</value>
</criteriaItems>

一般的な演算子:equals(等しい)、notEqual(等しくない)、lessThan(より小さい)、greaterThan(より大きい)、contains(を含む)、startsWith(で始まる)、includes(を含む)、excludes(を除外)、isBlank(空白)、notBlank(空白でない)。完全なリストは references/filter-operations.md を参照してください。

作成ワークフロー

  1. 要件を確認 — オブジェクト、フィールド、グループ化、フィルター、グラフのニーズを確認
  2. フォーマットを決定 — グループ化なし → 表形式、行グループ化のみ → 集計形式、行 + 列グループ化 → マトリックス形式、複数オブジェクト → 結合形式
  3. カラム名を確認 — get_metadata_type_sections MCP ツールを呼び出して、レポート タイプの有効なプラットフォーム カラム名を取得
  4. メタデータを作成 — examples/ の最も近い例から始めて調整
  5. フォルダを作成 — フォルダ ディレクトリと <folderShares> を含む <フォルダ名>-meta.xml を生成
  6. 検証 — references/verification-checklist.md を参照して実行

リファレンス ファイル インデックス

ファイル 参照する場面
references/column-names.md ステップ 3 — レポート タイプごとのカラム名マッピング
references/date-intervals.md timeFrameFilter の間隔を設定する場合
references/chart-types.md グラフを追加する場合 — 全 17 種類と凡例位置ルール
references/filter-operations.md フィルターを作成する場合 — 完全な演算子リファレンス
references/verification-checklist.md ステップ 6 — デプロイ前の検証
references/errors-and-troubleshooting.md フィールドが不足している場合またはデプロイ失敗時
examples/TabularOpportunitiesReport.report-meta.xml 表形式レポート テンプレート
examples/OpportunitiesByStageReport.report-meta.xml グラフ付き集計形式レポート
examples/OpportunitiesByStageAndQuarter.report-meta.xml マトリックス形式レポート テンプレート
examples/AccountsCreatedThisYear.report-meta.xml フィルター付き期間指定レポート
原文(English)を表示

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:

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

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

<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

原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。