filter-expressions
できること
Lightdashのクエリツール用のフィルター式の書き方を説明します。行の絞り込みや、条件付きの指標フィルターを必要とするアナリストや開発者向けです。
使う場面
- ✓Lightdashのクエリを、特定の行に絞り込みたいとき。
- ✓カスタム指標が、条件に一致する行だけを数えるようにしたいとき。
- ✓Lightdashでフィルターを使って、フィールドの値を検索したいとき。
スキルのリンク
https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/filter-expressions/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Lightdashで総売上のクエリを実行し、北地域で完了したステータスの注文だけを含めてください。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、各フィルター式を、ディメンション、指標、テーブル計算などの正しい分類に入れる方法を説明します。また、行を絞り込むためだけのフィールドをグループ化に加えないよう警告します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Read this before writing filters for expression-enabled tools. It does not apply to tools whose schemas use structured filter objects. Follow each tool's input schema; this skill does not enable unavailable tools or filter modes.
Filter Expressions
For run_metric_query, set queryConfig.filters to null when no query filters are needed. Otherwise, dimensions, metrics, and tableCalculations are independent string expressions or null.
- A non-null category contains one raw string expression.
- Choose the category from discovered field metadata (its dimension/metric kind), never from a field name or whether a numeric field sounds metric-like. A raw numeric dimension belongs in
dimensions; only metrics and custom metrics belong inmetrics. - A field used only to restrict rows stays in its filter expression. Do not add it to
queryConfig.dimensionsunless the user asked to group by or display it: extra selected dimensions change aggregation and table-calculation grain. - Table calculations belong only in
tableCalculations. - Each category is flat and uses AND or OR, never both.
- The three categories combine implicitly with AND.
- Aggregation custom metric filters are flat AND expressions.
- Omit
search_field_values.filtersfor an unscoped search. When present, it is one flat dimension expression string and is AND-only. - The tool schema is authoritative for where each string is placed.
Raw placement examples:
dimensions: orders_status equals=completed,shipped AND orders_order_date inThePast=2{unit:weeks,completed:true}
dimensions (alternatives): orders_promo_code startsWith=VIP OR orders_promo_code endsWith=25
metrics: orders_total_order_amount greaterThan=100
tableCalculations: rank lessThanOrEqual=10
Join flat rules with AND or OR. Do not mix both connectors in one expression.
Bare scalars work. Double-quote reserved and whitespace/punctuation strings (apostrophes/parentheses); quote when unsure. Quoted commas/braces literal; backslash escapes. E.g.
orders_product_name equals="Coffee Filters (100pk)".Limits: 256 rules; 256 values including settings/rule; 256 characters/literal; 16384 characters/expression.
string
Grammar: <field> <operator form>
isNull [0 values]notNull [0 values]equals=<value>[,<value>...] [1+ values]notEquals=<value>[,<value>...] [1+ values]startsWith=<value>[,<value>...] [1+ values]endsWith=<value>[,<value>...] [1+ values]include=<value>[,<value>...] [1+ values]doesNotInclude=<value>[,<value>...] [1+ values]
number
Grammar: <field> <operator form>
isNull [0 values]notNull [0 values]equals=<value>[,<value>...] [1+ values]notEquals=<value>[,<value>...] [1+ values]lessThan=<value> [1 value]lessThanOrEqual=<value> [1 value]greaterThan=<value> [1 value]greaterThanOrEqual=<value> [1 value]inBetween=<first value>,<second value> [2 values]notInBetween=<first value>,<second value> [2 values]
date
Grammar: <field> <operator form>
isNull [0 values]notNull [0 values]equals=<value>[,<value>...] [1+ values]notEquals=<value>[,<value>...] [1+ values]lessThan=<value> [1 value]lessThanOrEqual=<value> [1 value]greaterThan=<value> [1 value]greaterThanOrEqual=<value> [1 value]inThePast=<count>{unit:<unit>,completed:<bool>} [1 count; settings required]notInThePast=<count>{unit:<unit>,completed:<bool>} [1 count; settings required]inTheNext=<count>{unit:<unit>,completed:<bool>} [1 count; settings required]inTheCurrent=<unit>[{toDate:true[,excludeToday:true]}] [1 unit; settings optional]notInTheCurrent=<unit>[{toDate:true[,excludeToday:true]}] [1 unit; settings optional]inBetween=<first value>,<second value> [2 values]- Units: days, weeks, months, quarters, years; completed=false includes partial, true completed only.
- Current-period bounds: {toDate:true} ends the current week/month/quarter/year at today ("month to date"); {toDate:true,excludeToday:true} ends it at yesterday (today's partial data excluded). Not valid for days.
boolean
Grammar: <field> <operator form>
isNull [0 values]notNull [0 values]equals=<value> [1 value]notEquals=<value> [1 value]
よくある質問
フィルターはどこに置きますか?
各フィルターは、フィールドに対応する分類に入れます。たとえばディメンションや指標です。
フィルターがグループ化を変えますか?
フィールドをグループ化に加えた場合のみ変わります。そのため、フィルターだけのフィールドはグループ化に加えないよう説明されています。
すべてのフィルターモードが使えますか?
スキルは各ツールの入力スキーマに従うため、そのツールが対応しているモードだけが適用されます。
詳細
作者による元の説明
Author filter expressions for run_metric_query and search_field_values, including conditional custom metric filters.
repo: lightdash/lightdash
人気
- GitHubのスター
- 6.2k
- ランキング
- #14397
- ライセンス
- —
- 更新日
- 2026/11/2
コメント
- …
このリポジトリの他のスキル
breakup-pr
6.2k大きなプルリクエストを、一つずつレビューしてマージできる、小さく積み重ねたスライスに分割するのを支援します。
lightdash-agent-slack-messaging
6.2k証拠に基づいて、Lightdashの管理者向けに、わかりやすく親しみのある保守とアクティビティの報告を書くのを支援します。
developing-in-lightdash
6.2kLightdashのダッシュボードとグラフを、JSONとして読み、作成し、編集するのを支援します。各グラフの種類の設定を含みます。
mcp-artifact-integration
6.2kLightdashのクエリ結果をHTMLやReactのアーティファクトに表示し、読み込み中、エラー、データなしの状態を扱うのを支援します。
似ているスキル
gitcrawl
394k保存されたGitHubのイシューとプルリクエストのアーカイブを検索し、重複をまとめ、GitHub上の現在の状態を確認するようエージェントを支援します。
slacrawl
394kローカルのSlackアーカイブ内のメッセージを検索して件数を数え、アーカイブの新しさを確認し、必要に応じて更新するようエージェントを支援します。
goplaces
394kGoogle Placesを使って、場所を検索し、詳細や口コミを取得し、場所の名前を解決するようエージェントを支援します。スクリプト用にJSON出力もできます。