gen-metrics

Convert natural language metric descriptions and SQL queries into validated MetricFlow definitions.

1.5k|222|Updated Jul 4, 2025
One-click install
npx skills add https://github.com/Datus-ai/Datus-agent --skill gen-metrics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: gen-metrics
Source: https://github.com/Datus-ai/Datus-agent/tree/main/datus/resources/skills/gen-metrics
Command: npx skills add https://github.com/Datus-ai/Datus-agent --skill gen-metrics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Manually defining MetricFlow metrics requires deep knowledge of MetricFlow syntax, semantic model structure, and business logic mapping, which is time-consuming and error-prone for data teams. This Skill eliminates that manual work by converting plain language business descriptions or existing SQL queries into valid, production-ready MetricFlow definitions.

Core Features & Use Cases

  • Duplicate Detection & Reuse: Scans existing metrics to avoid redundant work and reuse existing measures from semantic models.
  • Flexible Input Handling: Supports both single metric generation from natural language and batch processing of multiple SQL queries or CSV files with query data.
  • End-to-End Validation & Sync: Automatically creates or updates semantic models, validates all generated metrics, runs dry-run SQL checks, and syncs final definitions to the knowledge base.
  • Use Case: A data analyst can paste existing revenue SQL queries and ask the Skill to generate corresponding MetricFlow metrics, which will be validated and synced without manual YAML editing.

Quick Start

Provide a natural language description of your desired business metric, such as "count of unique paying users per month", and the Skill will generate, validate, and sync the corresponding MetricFlow metric definition.

Frequently Asked Questions about gen-metrics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert SQL queries into MetricFlow metrics?

You can convert SQL queries into MetricFlow metrics by submitting existing SQL statements to the Skill, which parses the logic and generates validated metric definitions without manual YAML authoring.

Can I generate MetricFlow semantic models from natural language business KPIs?

Yes, you can generate MetricFlow semantic models by providing natural language business KPI descriptions, which the Skill translates into valid, production-ready metric definitions.

How do I avoid creating duplicate business metrics in MetricFlow?

To avoid duplicate business metrics, the Skill scans existing catalog entries and reuses available measures from semantic models before generating and syncing new metric definitions.

Does MetricFlow support batch processing of multiple SQL queries for metric generation?

MetricFlow metric generation supports batch processing by accepting multiple SQL queries or CSV files containing query data to generate and validate multiple metrics simultaneously.

How are generated MetricFlow metrics validated before syncing to the knowledge base?

Generated MetricFlow metrics are validated through semantic checks and dry-run SQL execution to ensure correct multi-table joins, ratios, and cumulative metrics before syncing to the knowledge base.

What types of MetricFlow metrics can I create from natural language descriptions?

You can create filtered metrics, ratio metrics, and cumulative metrics from natural language descriptions, with the Skill correctly handling multi-table joins and semantic validation.