All skills
anthropics avatar

/data-context-extractor

@7c35640

Generate or improve a company-specific data analysis skill by extracting tribal knowledge from analysts. BOOTSTRAP MODE - Triggers: "Create a data context skill", "Set up data analysis for our warehouse", "Help me create a skill for our database", "Generate a data skill for [company]" → Discovers schemas, asks key questions, generates initial skill with reference files ITERATION MODE - Triggers: "Add context about [domain]", "The skill needs more info about [topic]", "Update the data skill with [metrics/tables/terminology]", "Improve the [domain] reference" → Loads existing skill, asks targeted questions, appends/updates reference files Use when data analysts want Claude to understand their company's specific data warehouse, terminology, metrics definitions, and common query patterns.

Use this Skill: https://skilld.dev/gh/anthropics/knowledge-work-plugins/data-context-extractor

This session only. Nothing lands on disk.

referencessql-dialects.md

≈1.1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

SQL Dialect Reference

Include the appropriate section in generated skills based on the user's data warehouse.


BigQuery

## SQL Dialect: BigQuery

- **Table references**: Use backticks: \`project.dataset.table\`
- **Safe division**: `SAFE_DIVIDE(a, b)` returns NULL instead of error
- **Date functions**:
  - `DATE_TRUNC(date_col, MONTH)`
  - `DATE_SUB(date_col, INTERVAL 1 DAY)`
  - `DATE_DIFF(end_date, start_date, DAY)`
- **Column exclusion**: `SELECT * EXCEPT(column_to_exclude)`
- **Arrays**: `UNNEST(array_column)` to flatten
- **Structs**: Access with dot notation `struct_col.field_name`
- **Timestamps**: `TIMESTAMP_TRUNC()`, times in UTC by default
- **String matching**: `LIKE`, `REGEXP_CONTAINS(col, r'pattern')`
- **NULLs in aggregations**: Most functions ignore NULLs; use `IFNULL()` or `COALESCE()`

Snowflake

## SQL Dialect: Snowflake

- **Table references**: `DATABASE.SCHEMA.TABLE` or with quotes for case-sensitive: `"Column_Name"`
- **Safe division**: `DIV0(a, b)` returns 0, `DIV0NULL(a, b)` returns NULL
- **Date functions**:
  - `DATE_TRUNC('MONTH', date_col)`
  - `DATEADD(DAY, -1, date_col)`
  - `DATEDIFF(DAY, start_date, end_date)`
- **Column exclusion**: `SELECT * EXCLUDE (column_to_exclude)`
- **Arrays**: `FLATTEN(array_column)` to flatten, access with `value`
- **Variants/JSON**: Access with colon notation `variant_col:field_name`
- **Timestamps**: `TIMESTAMP_NTZ` (no timezone), `TIMESTAMP_TZ` (with timezone)
- **String matching**: `LIKE`, `REGEXP_LIKE(col, 'pattern')`
- **Case sensitivity**: Identifiers are uppercase by default unless quoted

PostgreSQL / Redshift

## SQL Dialect: PostgreSQL/Redshift

- **Table references**: `schema.table` (lowercase convention)
- **Safe division**: `NULLIF(b, 0)` pattern: `a / NULLIF(b, 0)`
- **Date functions**:
  - `DATE_TRUNC('month', date_col)`
  - `date_col - INTERVAL '1 day'`
  - `DATE_PART('day', end_date - start_date)`
- **Column selection**: No EXCEPT; must list columns explicitly
- **Arrays**: `UNNEST(array_column)` (PostgreSQL), limited in Redshift
- **JSON**: `json_col->>'field_name'` for text, `json_col->'field_name'` for JSON
- **Timestamps**: `AT TIME ZONE 'UTC'` for timezone conversion
- **String matching**: `LIKE`, `col ~ 'pattern'` for regex
- **Boolean**: Native BOOLEAN type; use `TRUE`/`FALSE`

Databricks / Spark SQL

## SQL Dialect: Databricks/Spark SQL

- **Table references**: `catalog.schema.table` (Unity Catalog) or `schema.table`
- **Safe division**: Use `NULLIF`: `a / NULLIF(b, 0)` or `TRY_DIVIDE(a, b)`
- **Date functions**:
  - `DATE_TRUNC('MONTH', date_col)`
  - `DATE_SUB(date_col, 1)`
  - `DATEDIFF(end_date, start_date)`
- **Column exclusion**: `SELECT * EXCEPT (column_to_exclude)` (Databricks SQL)
- **Arrays**: `EXPLODE(array_column)` to flatten
- **Structs**: Access with dot notation `struct_col.field_name`
- **JSON**: `json_col:field_name` or `GET_JSON_OBJECT()`
- **String matching**: `LIKE`, `RLIKE` for regex
- **Delta features**: `DESCRIBE HISTORY`, time travel with `VERSION AS OF`

MySQL

## SQL Dialect: MySQL

- **Table references**: \`database\`.\`table\` with backticks
- **Safe division**: Manual: `IF(b = 0, NULL, a / b)` or `a / NULLIF(b, 0)`
- **Date functions**:
  - `DATE_FORMAT(date_col, '%Y-%m-01')` for truncation
  - `DATE_SUB(date_col, INTERVAL 1 DAY)`
  - `DATEDIFF(end_date, start_date)`
- **Column selection**: No EXCEPT; must list columns explicitly
- **Arrays**: Limited native support; often stored as JSON
- **JSON**: `JSON_EXTRACT(col, '$.field')` or `col->>'$.field'`
- **Timestamps**: `CONVERT_TZ()` for timezone conversion
- **String matching**: `LIKE`, `REGEXP` for regex
- **Case sensitivity**: Table names case-sensitive on Linux, not on Windows

Common Patterns Across Dialects

Operation BigQuery Snowflake PostgreSQL Databricks
Current date CURRENT_DATE() CURRENT_DATE() CURRENT_DATE CURRENT_DATE()
Current timestamp CURRENT_TIMESTAMP() CURRENT_TIMESTAMP() NOW() CURRENT_TIMESTAMP()
String concat CONCAT() or || CONCAT() or || CONCAT() or || CONCAT() or ||
Coalesce COALESCE() COALESCE() COALESCE() COALESCE()
Case when CASE WHEN CASE WHEN CASE WHEN CASE WHEN
Count distinct COUNT(DISTINCT x) COUNT(DISTINCT x) COUNT(DISTINCT x) COUNT(DISTINCT x)

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    This skill acts as a developer tool to help analysts document data warehouse knowledge and generate specialized data analysis skills. It includes a Python script for packaging generated files. The primary security consideration is the processing of external data sources like database schemas to generate instructions, which presents a potential risk of indirect prompt injection.

  • Socket17d

    No alerts

  • Snyk17d

    Risk: LOW · No issues

  • Runlayer7mo

    6/6 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 7c35640. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 8 months ago
  • Documentation
  • data-warehouse
  • knowledge-extraction
  • bigquery
  • snowflake
  • postgres
  • schema-discovery
  • metrics
  • sql

README badge

README badge for anthropics/knowledge-work-plugins/data-context-extractor

Extracts company-specific data warehouse schemas, terminology, and metric definitions from analysts, then generates a tailored data analysis skill with reference documentation. Used in bootstrap mode to create new skills from scratch or iteration mode to add domain-specific context to existing skills.

Generated from the current SKILL.md.

Does this skill connect directly to my data warehouse?
Yes, it uses `~~data warehouse` tools to query and explore your schema. It supports BigQuery, Snowflake, PostgreSQL/Redshift, and Databricks.
Can I use this to update an existing data skill?
Yes. Iteration Mode lets you load an existing skill and add new domains, metrics, or reference files without starting from scratch.
What format does the generated skill use?
It creates a directory with SKILL.md and a `references/` folder containing markdown files for entities, metrics, tables, and optionally a dashboards catalog.
Does this require Claude to know SQL?
No. The skill asks conversational questions to analysts and generates SQL queries itself during schema discovery.
What if my warehouse uses a non-standard SQL dialect?
The skill includes SQL dialect section documentation. Bootstrap Mode identifies your warehouse type and generates queries in the correct dialect.

Generated from the current SKILL.md. These answers refresh after source changes.