filter-expressions
Skill này làm gì
Skill này giải thích cách viết biểu thức lọc cho các công cụ truy vấn của Lightdash. Skill dành cho nhà phân tích và lập trình viên xây dựng truy vấn cần lọc dòng hoặc lọc chỉ số theo điều kiện.
Khi nào nên dùng
- ✓Khi bạn cần lọc một truy vấn Lightdash chỉ lấy một số dòng nhất định.
- ✓Khi bạn muốn một chỉ số tùy chỉnh chỉ đếm các dòng thỏa một điều kiện.
- ✓Khi bạn tìm kiếm giá trị trường bằng bộ lọc trong Lightdash.
Liên kết skill
https://github.com/lightdash/lightdash/blob/main/packages/backend/src/ee/services/ai/skills/builtInSkills/filter-expressions/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Chạy một truy vấn Lightdash về tổng doanh thu, nhưng chỉ lấy đơn hàng ở khu vực miền Bắc có trạng thái đã hoàn thành.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích cách đặt mỗi biểu thức lọc vào đúng nhóm, như chiều dữ liệu, chỉ số hoặc tính toán trên bảng. Skill cũng cảnh báo không thêm các trường chỉ dùng để lọc vào nhóm dữ liệu.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
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]
Câu hỏi thường gặp
Bộ lọc được đặt ở đâu?
Mỗi bộ lọc nằm trong nhóm khớp với trường của nó, như chiều dữ liệu hoặc chỉ số.
Bộ lọc có làm thay đổi cách nhóm dữ liệu không?
Chỉ khi bạn thêm trường đó vào phần nhóm, nên skill khuyên không thêm các trường chỉ dùng để lọc.
Mọi chế độ lọc đều có sẵn không?
Skill tuân theo schema đầu vào của từng công cụ, nên chỉ những chế độ mà công cụ đó hỗ trợ mới được áp dụng.
Chi tiết
Mô tả gốc của tác giả
Author filter expressions for run_metric_query and search_field_values, including conditional custom metric filters.
repo: lightdash/lightdash
Độ phổ biến
- Sao GitHub
- 6.2k
- Vị trí xếp hạng
- #14397
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
breakup-pr
6.2kGiúp agent của bạn tách một pull request lớn thành các phần nhỏ, xếp chồng lên nhau, để có thể xem xét và gộp từng phần một.
lightdash-agent-slack-messaging
6.2kGiúp agent của bạn viết báo cáo bảo trì và hoạt động cho quản trị viên Lightdash rõ ràng, thân thiện, chỉ dựa trên bằng chứng có sẵn.
developing-in-lightdash
6.2kGiúp agent của bạn đọc, tạo và chỉnh sửa dashboard và biểu đồ Lightdash dưới dạng JSON, kèm cài đặt của từng loại biểu đồ.
mcp-artifact-integration
6.2kGiúp agent của bạn hiển thị kết quả truy vấn Lightdash bên trong một artifact HTML hoặc React, có xử lý trạng thái tải, lỗi và rỗng.
Skill tương tự
gitcrawl
394kCho phép agent của bạn tìm trong kho lưu trữ issue và pull request GitHub, gom các mục trùng lặp và kiểm tra trạng thái hiện tại trên GitHub.
slacrawl
394kCho phép agent của bạn tìm và đếm tin nhắn trong kho lưu trữ Slack cục bộ, kiểm tra kho đó mới đến mức nào và làm mới khi cần.
goplaces
394kGiúp agent của bạn tìm địa điểm, lấy chi tiết và đánh giá, và xác định tên địa điểm bằng Google Places, với đầu ra JSON cho script.