query-metric
Query business metrics through the semantic layer with automatic joins, time grain resolution, and alias resolution
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Query business metrics through the semantic layer with automatic joins, time grain resolution, and alias resolution
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
On-demand time-series forecasting. CAPTURE params from project context, call run_forecast, present deterministic engine results.
Use when helping initialize, configure, or prepare a Seeknal project like a coding agent
Translate business questions into metrics, SQL evidence, and actionable recommendations
Run multi-step SQL plus Python/statistics/ML analysis while keeping tools thin and evidence grounded
Answer business questions from read-only connected databases using deterministic schema discovery and SQL evidence
Run Python code in an isolated subprocess for statistical/ML/visualization work beyond what SQL can express
| name | query-metric |
| description | Query business metrics through the semantic layer with automatic joins, time grain resolution, and alias resolution |
| tags | ["semantic-layer","metrics","query"] |
| version | 1.0.0 |
Use this workflow when the user asks a question that can be answered by a
metric defined in the semantic layer (seeknal/semantic_models/*.yml or
seeknal/metrics/*.yml). Prefer this over execute_sql because the compiler
handles aggregation, joins, and time grains automatically — no manual SQL.
query_metric — compiles + executes a semantic layer queryUse query_metric INSTEAD of execute_sql when:
Fall back to execute_sql when the question requires one-off analytical SQL
with no corresponding metric definition.
Before calling query_metric, confirm what's defined. The semantic layer is
discovered by scanning:
seeknal/semantic_models/*.yml — entities, dimensions, measuresseeknal/metrics/*.yml — named metric definitions (simple or ratio)Use search_project_files or read_project_file to inspect them. If nothing
exists yet, point the user at the bootstrap-semantic-model skill.
Required args:
metrics: comma-separated metric names (e.g. "total_revenue,order_count").
Aliases are resolved case-insensitively, so "Total Revenue" works too.dimensions (optional): comma-separated group-by columns. Time dimensions
use the __grain suffix — ordered_at__month, created_at__day,
signup_date__quarter. Valid grains: day, week, month, quarter,
year.filters (optional): comma-separated SQL filter expressions. Each filter
is a standalone predicate — "region = 'US'", "order_date >= '2025-01-01'".
Multiple filters are AND-ed.order_by (optional): comma-separated order columns. Prefix - for DESC
— "-total_revenue".limit (optional, default 100): maximum rows.The tool returns:
The compiled SQL is useful for:
execute_sql for one-off variationsNo semantic models found → point user at bootstrap-semantic-model skillUnknown metric → the tool lists available metrics + aliases; suggest
the closest matchCompilation error → the MetricCompiler rejected the query structure;
usually a dimension/filter that references a column not in the modelQuery execution error → DuckDB couldn't run the compiled SQL; usually
means the underlying view isn't registered (user needs to run a pipeline
first to materialize the intermediate parquets)Your final answer MUST: