Data Context Extractor
AnthropicOfficialPublished by Anthropic
- Skill
- Content generator
- Agent tooling
- Apache-2.0
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
Data Context Extractor is a meta-skill designed to bridge the gap between raw data warehouses and actionable analysis. It operates in two modes: Bootstrap Mode, which guides analysts through discovering schemas and defining key business entities, metrics, and filters to build a new skill from scratch; and Iteration Mode, which allows users to incrementally add domain-specific context, such as new tables or metric definitions, to an existing skill. By standardizing how tribal knowledge is documented, it ensures that AI agents can perform more accurate and context-aware data analysis.
What it does
- Guides users through connecting to and exploring data warehouse schemas.
- Facilitates the definition of business entities, primary identifiers, and key metrics.
- Captures standard data hygiene rules and common query pitfalls.
- Generates a structured, reusable skill package with standardized reference files.
- Supports iterative updates to existing skills as business needs or data models evolve.
- Provides templates for documenting tables, metrics, and domain-specific knowledge.
When to use it
- When you need to create a custom data analysis skill for a specific company warehouse.
- When your existing data analysis skill lacks context on new business domains or metrics.
- When you want to standardize how analysts document tribal knowledge for AI consumption.
- When you need to ensure consistent filtering and metric calculations across your team.
Advantages
- Reduces ambiguity by forcing clear definitions of business terms and entities.
- Improves query accuracy by embedding standard filters and exclusion rules.
- Promotes consistency across data analysis tasks through structured documentation.
- Simplifies the onboarding of new analysts by centralizing tribal knowledge.
- Ensures AI agents use the correct SQL dialect and table relationships.
Usage examples
- “Create a data context skill”
- The agent initiates Bootstrap Mode, asking for the data warehouse type and guiding the user through schema discovery and entity definition.
- “Update the data skill with marketing metrics”
- The agent enters Iteration Mode, identifying the marketing domain as the gap and prompting the user for relevant tables, metrics, and common query patterns.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/anthropics/data-context-extractor/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip data-context-extractor.zip -d .agents/skills
Documentation by Anthropic
Data Context Extractor
A meta-skill that extracts company-specific data knowledge from analysts and generates tailored data analysis skills.
How It Works
This skill has two modes:
Bootstrap Mode: Create a new data analysis skill from scratch
Iteration Mode: Improve an existing skill by adding domain-specific reference files
Bootstrap Mode
Use when: User wants to create a new data context skill for their warehouse.
Phase 1: Database Connection & Discovery
Step 1: Identify the database type
Ask: "What data warehouse are you using?"
Common options:
BigQuery
Snowflake
PostgreSQL/Redshift
Databricks
Use ~~data warehouse tools (query and schema) to connect. If unclear, check available MCP tools in the current session.
Step 2: Explore the schema
Use ~~data warehouse schema tools to:
List available datasets/schemas
Identify the most important tables (ask user: "Which 3-5 tables do analysts query most often?")
Pull schema details for those key tables
Sample exploration queries by dialect:
-- BigQuery: List datasets
SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA
-- BigQuery: List tables in a dataset
SELECT table_name FROM `project.dataset.INFORMATION_SCHEMA.TABLES`
-- Snowflake: List schemas
SHOW SCHEMAS IN DATABASE my_database
-- Snowflake: List tables
SHOW TABLES IN SCHEMA my_schemaPhase 2: Core Questions (Ask These)
After schema discovery, ask these questions conversationally (not all at once):
Entity Disambiguation (Critical)
"When people here say 'user' or 'customer', what exactly do they mean? Are there different types?"
Listen for:
Multiple entity types (user vs account vs organization)
Relationships between them (1:1, 1:many, many:many)
Which ID fields link them together
Primary Identifiers
"What's the main identifier for a [customer/user/account]? Are there multiple IDs for the same entity?"
Listen for:
Primary keys vs business keys
UUID vs integer IDs
Legacy ID systems
Key Metrics
"What are the 2-3 metrics people ask about most? How is each one calculated?"
Listen for:
Exact formulas (ARR = monthly_revenue × 12)
Which tables/columns feed each metric
Time period conventions (trailing 7 days, calendar month, etc.)
Data Hygiene
"What should ALWAYS be filtered out of queries? (test data, fraud, internal users, etc.)"
Listen for:
Standard WHERE clauses to always include
Flag columns that indicate exclusions (is_test, is_internal, is_fraud)
Specific values to exclude (status = 'deleted')
Common Gotchas
"What mistakes do new analysts typically make with this data?"
Listen for:
Confusing column names
Timezone issues
NULL handling quirks
Historical vs current state tables
Phase 3: Generate the Skill
Create a skill with this structure:
[company]-data-analyst/
├── SKILL.md
└── references/
├── entities.md # Entity definitions and relationships
├── metrics.md # KPI calculations
├── tables/ # One file per domain
│ ├── [domain1].md
│ └── [domain2].md
└── dashboards.json # Optional: existing dashboards catalogSKILL.md Template: See references/skill-template.md
SQL Dialect Section: See references/sql-dialects.md and include the appropriate dialect notes.
Reference File Template: See references/domain-template.md
Phase 4: Package and Deliver
Create all files in the skill directory
Package as a zip file
Present to user with summary of what was captured
Iteration Mode
Use when: User has an existing skill but needs to add more context.
Step 1: Load Existing Skill
Ask user to upload their existing skill (zip or folder), or locate it if already in the session.
Read the current SKILL.md and reference files to understand what's already documented.
Step 2: Identify the Gap
Ask: "What domain or topic needs more context? What queries are failing or producing wrong results?"
Common gaps:
A new data domain (marketing, finance, product, etc.)
Missing metric definitions
Undocumented table relationships
New terminology
Step 3: Targeted Discovery
For the identified domain:
Explore relevant tables: Use
~~data warehouseschema tools to find tables in that domainAsk domain-specific questions:
"What tables are used for [domain] analysis?"
"What are the key metrics for [domain]?"
"Any special filters or gotchas for [domain] data?"
Generate new reference file: Create
references/[domain].mdusing the domain template
Step 4: Update and Repackage
Add the new reference file
Update SKILL.md's "Knowledge Base Navigation" section to include the new domain
Repackage the skill
Present the updated skill to user
Reference File Standards
Each reference file should include:
For Table Documentation
Location: Full table path
Description: What this table contains, when to use it
Primary Key: How to uniquely identify rows
Update Frequency: How often data refreshes
Key Columns: Table with column name, type, description, notes
Relationships: How this table joins to others
Sample Queries: 2-3 common query patterns
For Metrics Documentation
Metric Name: Human-readable name
Definition: Plain English explanation
Formula: Exact calculation with column references
Source Table(s): Where the data comes from
Caveats: Edge cases, exclusions, gotchas
For Entity Documentation
Entity Name: What it's called
Definition: What it represents in the business
Primary Table: Where to find this entity
ID Field(s): How to identify it
Relationships: How it relates to other entities
Common Filters: Standard exclusions (internal, test, etc.)
Quality Checklist
Before delivering a generated skill, verify:
[ ] SKILL.md has complete frontmatter (name, description)
[ ] Entity disambiguation section is clear
[ ] Key terminology is defined
[ ] Standard filters/exclusions are documented
[ ] At least 2-3 sample queries per domain
[ ] SQL uses correct dialect syntax
[ ] Reference files are linked from SKILL.md navigation section
Files
- ATTRIBUTION.mdAdded by AutoGineer924 B
- LICENSELicence file added by AutoGineer11.1 KiB
- SKILL.md7.1 KiB
- references/domain-template.md3.4 KiB
- references/example-output.md6.1 KiB
- references/skill-template.md3.7 KiB
- references/sql-dialects.md4.5 KiB
- scripts/package_data_skill.pyScript3.7 KiB
references/example-output.md
Example: Generated Skill
This is an example of what a generated skill looks like after the bootstrap process. This example is for a fictional e-commerce company called "ShopCo" using Snowflake.
Example SKILL.md
---
name: shopco-data-analyst
description: "ShopCo data analysis skill for Snowflake. Provides context for querying e-commerce data including customer, order, and product analytics. Use when analyzing ShopCo data for: (1) Revenue and order metrics, (2) Customer behavior and retention, (3) Product performance, or any data questions requiring ShopCo-specific context."
---
# ShopCo Data Analysis
## SQL Dialect: Snowflake
- **Table references**: `SHOPCO_DW.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)`
---
## Entity Disambiguation
**"Customer" can mean:**
- **User**: A login account that can browse and save items (CORE.DIM_USERS: user_id)
- **Customer**: A user who has made at least one purchase (CORE.DIM_CUSTOMERS: customer_id)
- **Account**: A billing entity, can have multiple users in B2B (CORE.DIM_ACCOUNTS: account_id)
**Relationships:**
- User → Customer: 1:1 (customer_id = user_id for purchasers)
- Account → User: 1:many (join on account_id)
---
## Business Terminology
| Term | Definition | Notes |
|------|------------|-------|
| GMV | Gross Merchandise Value - total order value before returns/discounts | Use for top-line reporting |
| NMV | Net Merchandise Value - GMV minus returns and discounts | Use for actual revenue |
| AOV | Average Order Value - NMV / order count | Exclude $0 orders |
| LTV | Lifetime Value - total NMV per customer since first order | Rolling calc, updates daily |
| CAC | Customer Acquisition Cost - marketing spend / new customers | By cohort month |
---
## Standard Filters
Always apply these filters unless explicitly told otherwise:
```sql
-- Exclude test and internal orders
WHERE order_status != 'TEST'
AND customer_type != 'INTERNAL'
AND is_employee_order = FALSE
-- Exclude cancelled orders for revenue metrics
AND order_status NOT IN ('CANCELLED', 'FRAUDULENT')Key Metrics
Gross Merchandise Value (GMV)
Definition: Total value of all orders placed
Formula:
SUM(order_total_gross)Source:
CORE.FCT_ORDERS.order_total_grossTime grain: Daily, aggregated to weekly/monthly
Caveats: Includes orders that may later be cancelled or returned
Net Revenue
Definition: Actual revenue after returns and discounts
Formula:
SUM(order_total_gross - return_amount - discount_amount)Source:
CORE.FCT_ORDERSCaveats: Returns can occur up to 90 days post-order; use settled_revenue for finalized numbers
Knowledge Base Navigation
| Domain | Reference File | Use For |
|---|---|---|
| Orders | references/orders.md | Order tables, GMV/NMV calculations |
| Customers | references/customers.md | User/customer entities, LTV, cohorts |
| Products | references/products.md | Catalog, inventory, categories |
Common Query Patterns
Daily GMV by Channel
SELECT
DATE_TRUNC('DAY', order_timestamp) AS order_date,
channel,
SUM(order_total_gross) AS gmv,
COUNT(DISTINCT order_id) AS order_count
FROM SHOPCO_DW.CORE.FCT_ORDERS
WHERE order_status NOT IN ('TEST', 'CANCELLED', 'FRAUDULENT')
AND order_timestamp >= DATEADD(DAY, -30, CURRENT_DATE())
GROUP BY 1, 2
ORDER BY 1 DESC, 3 DESCCustomer Cohort Retention
WITH cohorts AS (
SELECT
customer_id,
DATE_TRUNC('MONTH', first_order_date) AS cohort_month
FROM SHOPCO_DW.CORE.DIM_CUSTOMERS
)
SELECT
c.cohort_month,
DATEDIFF(MONTH, c.cohort_month, DATE_TRUNC('MONTH', o.order_timestamp)) AS months_since_first,
COUNT(DISTINCT c.customer_id) AS active_customers
FROM cohorts c
JOIN SHOPCO_DW.CORE.FCT_ORDERS o ON c.customer_id = o.customer_id
WHERE o.order_status NOT IN ('TEST', 'CANCELLED')
GROUP BY 1, 2
ORDER BY 1, 2
---
## Example references/orders.md
```markdown
# Orders Tables
Order and transaction data for ShopCo.
---
## Key Tables
### FCT_ORDERS
**Location**: `SHOPCO_DW.CORE.FCT_ORDERS`
**Description**: Fact table of all orders. One row per order.
**Primary Key**: `order_id`
**Update Frequency**: Hourly (15 min lag)
**Partitioned By**: `order_date`
| Column | Type | Description | Notes |
|--------|------|-------------|-------|
| **order_id** | VARCHAR | Unique order identifier | |
| **customer_id** | VARCHAR | FK to DIM_CUSTOMERS | NULL for guest checkout |
| **order_timestamp** | TIMESTAMP_NTZ | When order was placed | UTC |
| **order_date** | DATE | Date portion of order_timestamp | Partition column |
| **order_status** | VARCHAR | Current status | PENDING, SHIPPED, DELIVERED, CANCELLED, RETURNED |
| **channel** | VARCHAR | Acquisition channel | WEB, APP, MARKETPLACE |
| **order_total_gross** | DECIMAL(12,2) | Pre-discount total | |
| **discount_amount** | DECIMAL(12,2) | Total discounts applied | |
| **return_amount** | DECIMAL(12,2) | Value of returned items | Updates async |
**Relationships**:
- Joins to `DIM_CUSTOMERS` on `customer_id`
- Parent of `FCT_ORDER_ITEMS` via `order_id`
---
## Sample Queries
### Orders with Returns Rate
```sql
SELECT
DATE_TRUNC('WEEK', order_date) AS week,
COUNT(*) AS total_orders,
SUM(CASE WHEN return_amount > 0 THEN 1 ELSE 0 END) AS orders_with_returns,
DIV0(SUM(CASE WHEN return_amount > 0 THEN 1 ELSE 0 END), COUNT(*)) AS return_rate
FROM SHOPCO_DW.CORE.FCT_ORDERS
WHERE order_status NOT IN ('TEST', 'CANCELLED')
AND order_date >= DATEADD(MONTH, -3, CURRENT_DATE())
GROUP BY 1
ORDER BY 1
---
This example demonstrates:
- Complete frontmatter with triggering description
- Dialect-specific SQL notes
- Clear entity disambiguation
- Terminology glossary
- Standard filters as copy-paste SQL
- Metric definitions with formulas
- Navigation to reference files
- Real, runnable query examplesRequirements and compatibility
Written for: Claude Code, Claude apps
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Python
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Anthropic
- Publisher
- Anthropic (Official)
- Source
- anthropics/knowledge-work-plugins · data/skills/data-context-extractor · commit e050c2e
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from data/LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Anthropic or Anthropic.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download data-context-extractor.zip