Filter Expressions logo

Filter Expressions

OrganizationPopular
lightdash
filter-expressions

Author filter expressions for run_metric_query and search_field_values, including conditional custom metric filters.

Overview

Publisherlightdash
Repositorylightdash
Skill namefilter-expressions
Stars
6.1K
Forks
778
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by lightdash on GitHub. Read the source before you install it.

Installation

Install the Filter Expressions AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/lightdash/lightdash.git /tmp/lightdash
mkdir -p .claude/skills
cp -r /tmp/lightdash/packages/backend/src/ee/services/ai/skills/builtInSkills/filter-expressions .claude/skills/filter-expressions
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Filter Expressions in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Filter Expressions on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Filter Expressions is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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 in metrics.
  • A field used only to restrict rows stays in its filter expression. Do not add it to queryConfig.dimensions unless 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.filters for 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:

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

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

  • 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> [1 unit]
  • notInTheCurrent=<unit> [1 unit]
  • inBetween=<first value>,<second value> [2 values]
  • Units: days, weeks, months, quarters, years; completed=false includes partial, true completed only.

boolean

Grammar:

  • isNull [0 values]
  • notNull [0 values]
  • equals=<value> [1 value]
  • notEquals=<value> [1 value]

Frequently asked questions

What does the Filter Expressions AI skill do?

Author filter expressions for run_metric_query and search_field_values, including conditional custom metric filters.

Why use Filter Expressions on TypingMind?

Because you install it once and use it with any model. Filter Expressions is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Filter Expressions in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/lightdash/lightdash/tree/main/packages/backend/src/ee/services/ai/skills/builtInSkills/filter-expressions. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Filter Expressions?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Filter Expressions?

As many as you like. As long as a model supports skills, you can use Filter Expressions with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Filter Expressions AI skill free?

It is published on GitHub by lightdash. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇