Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

mdg-create-and-edit

БесплатноБез исполняемых скриптовНе проверен

Create, edit, and manage rules -- data governance rules, compliance rules, monitoring rules, alerts, MDG rules. Use when user asks to create a rule, set up…

teklinerот tekliner★ 17 звёзд на GitHub

Об этом скилле

Marketing Data Governance (MDG)

MCP Tools

  • clickhouseTool -- query ClickHouse (table discovery, data freshness, SQL testing)
  • createMdgViewTool -- create or replace an MDG rule view
  • getMdgRuleLibraryExampleTool -- fetch example rules from the MDG library
  • testMdgNotificationTool -- test notification delivery for a rule

How to Create an MDG Rule

If user asks "I want to create a new MDG rule, show me recommended templates" or "How to create an MDG rule?" without specifying requirements, reply that they can create a rule via the [MDG Rules Library](origin + "experimental/agent/data-governance/library") or by describing the rule in plain language. Stop here.

If user provides actual requirements, follow the workflow below.

STEP 1 -- Table Selection and Data Freshness Check

1A -- Select table:

  • Use clickhouseTool to find the most suitable table with data for the rule
  • Research columns and values to confirm the table fits

1B -- Data freshness check (MANDATORY):

  1. Find the date column (type Date or DateTime, name contains "date")
  2. Check latest date:
    SELECT max({date_column}) as latest_date FROM {table_name}
    
  3. If data is stale (older than yesterday):
    • Get report title:
      SELECT report_type_title FROM src_improvado_datatables
      WHERE datatable_sql_name = '{table_name}' LIMIT 1
      
    • STOP and inform user: table lacks recent data, they need to extract the report first via [Data Explorer](origin + "/data_explorer_v2/")
    • DO NOT proceed to Step 2
  4. If data is fresh (yesterday or today): proceed to Step 2

STEP 2 -- Generate and Test SQL

  • Translate the user's business logic into SQL following the pseudocode structure below
  • Execute the SQL via clickhouseTool to show preview results
  • Show actual data to the user

STEP 3 -- Get User Approval and Collect Parameters

  • Ask: "Are you satisfied with these results?"
  • If not, modify SQL and re-test
  • Once confirmed, collect:
    • Run frequency: Daily, Weekly, Monthly, Quarterly (default: Daily at 9 AM PST / 17:00 UTC)
    • Enable immediately? Yes/No
    • Notification email address

STEP 4 -- Create the Rule

  • Call createMdgViewTool with the tested SQL and collected parameters
  • View name pattern: rule_<datasource>_<rule_name>_ai
  • Use CREATE OR REPLACE VIEW when updating existing rules
  • The SQL must be IDENTICAL to what was tested in Step 2
  • After success, if enabled: "Your rule will appear on the [Data Governance Dashboard](origin + "experimental/agent/data-governance/dashboard") within 5 minutes."
  • If disabled: "Your rule has been created but is disabled. Ask me to enable it later."
  • To enable a previously disabled rule: update the view SQL with status = 'Enabled'

createMdgViewTool Parameters

viewName: string (max 150 chars, pattern: rule_*_ai)
sqlQuery: string (SELECT or WITH...SELECT, no semicolon)
ruleName: string (human-readable, 5-200 chars)
ruleDescription: string (10-500 chars)
complianceCategory: one of Metric Compliance | Taxonomy Compliance | Guidelines Compliance | Performance Compliance | Budget Pacing | Data Integrity
businessCategory: string (e.g. "Efficiency", "Quality", "Brand Safety")
severity: High | Medium | Low
runFrequency: Hourly | Daily | Weekly | Monthly | Quarterly
ruleOwners: string (comma-separated emails)
status: Enabled | Disabled

SQL Requirements (ClickHouse)

  • Complete SELECT or WITH...SELECT, no trailing semicolon
  • No CREATE VIEW -- only the query body
  • Use valid ClickHouse functions only
  • Prefer explicit column lists over SELECT *
  • snake_case aliases with as
  • Case-insensitive contains: use ILIKE
  • Regex: match(col, 'pattern') for boolean, extract(str, 'pattern') for capture
  • All non-aggregated columns must appear in GROUP BY; use HAVING for aggregate filters
  • Include in GROUP BY all entity_name and entity_id columns broader than the user-requested entity (e.g. for adsets, include campaign and account names/ids)
  • Explicit JOIN...ON, qualify join keys
  • Dates: toDate, toDateTime, parseDateTimeBestEffort, toStartOfWeek/Month/Quarter
  • Always add a date filter in apply_filter based on user request
  • Division: guard with if(b = 0, 0, a/b)
  • Strip symbols like $ or % from numeric thresholds
  • Filters only in apply_filter CTE. No other CTEs have WHERE.
  • Allowed aggregates: any, sum, sumIf, count, countIf, min, max, avg, groupArray, groupUniqArray (with If combinators)

SQL Pseudocode Structure

with
  base_table as (
    select * from <current_db>.<table_name>
  ),
  apply_filter as (
    select * from base_table
    where <filters or 1=1>
  ),
  group_by_cte as (
    select
      <Group By columns>,
      <aggregations>
    from apply_filter as t
    group by <Group By columns>
  ),
  add_ids_and_meta as (
    select
      '<datasource>' as datasource,
      '<rule_name>' as rule_name,
      '<description>' as rule_description,
      -- expose key metrics as strings
Полный SKILL.md на GitHub

Установить mdg-create-and-edit в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл mdg-create-and-edit?

Create, edit, and manage rules -- data governance rules, compliance rules, monitoring rules, alerts, MDG rules. Use when user asks to create a rule, set up alerts, or monitor metrics.

Как установить скилл mdg-create-and-edit?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл mdg-create-and-edit запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить mdg-create-and-edit с