$npx -y skills add anthropics/knowledge-work-plugins --skill data-context-extractorGenerate 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 [comp
| 1 | # Data Context Extractor |
| 2 | |
| 3 | A meta-skill that extracts company-specific data knowledge from analysts and generates tailored data analysis skills. |
| 4 | |
| 5 | ## How It Works |
| 6 | |
| 7 | This skill has two modes: |
| 8 | |
| 9 | 1. **Bootstrap Mode**: Create a new data analysis skill from scratch |
| 10 | 2. **Iteration Mode**: Improve an existing skill by adding domain-specific reference files |
| 11 | |
| 12 | --- |
| 13 | |
| 14 | ## Bootstrap Mode |
| 15 | |
| 16 | Use when: User wants to create a new data context skill for their warehouse. |
| 17 | |
| 18 | ### Phase 1: Database Connection & Discovery |
| 19 | |
| 20 | **Step 1: Identify the database type** |
| 21 | |
| 22 | Ask: "What data warehouse are you using?" |
| 23 | |
| 24 | Common options: |
| 25 | - **BigQuery** |
| 26 | - **Snowflake** |
| 27 | - **PostgreSQL/Redshift** |
| 28 | - **Databricks** |
| 29 | |
| 30 | Use `~~data warehouse` tools (query and schema) to connect. If unclear, check available MCP tools in the current session. |
| 31 | |
| 32 | **Step 2: Explore the schema** |
| 33 | |
| 34 | Use `~~data warehouse` schema tools to: |
| 35 | 1. List available datasets/schemas |
| 36 | 2. Identify the most important tables (ask user: "Which 3-5 tables do analysts query most often?") |
| 37 | 3. Pull schema details for those key tables |
| 38 | |
| 39 | Sample exploration queries by dialect: |
| 40 | ```sql |
| 41 | -- BigQuery: List datasets |
| 42 | SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA |
| 43 | |
| 44 | -- BigQuery: List tables in a dataset |
| 45 | SELECT table_name FROM `project.dataset.INFORMATION_SCHEMA.TABLES` |
| 46 | |
| 47 | -- Snowflake: List schemas |
| 48 | SHOW SCHEMAS IN DATABASE my_database |
| 49 | |
| 50 | -- Snowflake: List tables |
| 51 | SHOW TABLES IN SCHEMA my_schema |
| 52 | ``` |
| 53 | |
| 54 | ### Phase 2: Core Questions (Ask These) |
| 55 | |
| 56 | After schema discovery, ask these questions conversationally (not all at once): |
| 57 | |
| 58 | **Entity Disambiguation (Critical)** |
| 59 | > "When people here say 'user' or 'customer', what exactly do they mean? Are there different types?" |
| 60 | |
| 61 | Listen for: |
| 62 | - Multiple entity types (user vs account vs organization) |
| 63 | - Relationships between them (1:1, 1:many, many:many) |
| 64 | - Which ID fields link them together |
| 65 | |
| 66 | **Primary Identifiers** |
| 67 | > "What's the main identifier for a [customer/user/account]? Are there multiple IDs for the same entity?" |
| 68 | |
| 69 | Listen for: |
| 70 | - Primary keys vs business keys |
| 71 | - UUID vs integer IDs |
| 72 | - Legacy ID systems |
| 73 | |
| 74 | **Key Metrics** |
| 75 | > "What are the 2-3 metrics people ask about most? How is each one calculated?" |
| 76 | |
| 77 | Listen for: |
| 78 | - Exact formulas (ARR = monthly_revenue × 12) |
| 79 | - Which tables/columns feed each metric |
| 80 | - Time period conventions (trailing 7 days, calendar month, etc.) |
| 81 | |
| 82 | **Data Hygiene** |
| 83 | > "What should ALWAYS be filtered out of queries? (test data, fraud, internal users, etc.)" |
| 84 | |
| 85 | Listen for: |
| 86 | - Standard WHERE clauses to always include |
| 87 | - Flag columns that indicate exclusions (is_test, is_internal, is_fraud) |
| 88 | - Specific values to exclude (status = 'deleted') |
| 89 | |
| 90 | **Common Gotchas** |
| 91 | > "What mistakes do new analysts typically make with this data?" |
| 92 | |
| 93 | Listen for: |
| 94 | - Confusing column names |
| 95 | - Timezone issues |
| 96 | - NULL handling quirks |
| 97 | - Historical vs current state tables |
| 98 | |
| 99 | ### Phase 3: Generate the Skill |
| 100 | |
| 101 | Create a skill with this structure: |
| 102 | |
| 103 | ``` |
| 104 | [company]-data-analyst/ |
| 105 | ├── SKILL.md |
| 106 | └── references/ |
| 107 | ├── entities.md # Entity definitions and relationships |
| 108 | ├── metrics.md # KPI calculations |
| 109 | ├── tables/ # One file per domain |
| 110 | │ ├── [domain1].md |
| 111 | │ └── [domain2].md |
| 112 | └── dashboards.json # Optional: existing dashboards catalog |
| 113 | ``` |
| 114 | |
| 115 | **SKILL.md Template**: See `references/skill-template.md` |
| 116 | |
| 117 | **SQL Dialect Section**: See `references/sql-dialects.md` and include the appropriate dialect notes. |
| 118 | |
| 119 | **Reference File Template**: See `references/domain-template.md` |
| 120 | |
| 121 | ### Phase 4: Package and Deliver |
| 122 | |
| 123 | 1. Create all files in the skill directory |
| 124 | 2. Package as a zip file |
| 125 | 3. Present to user with summary of what was captured |
| 126 | |
| 127 | --- |
| 128 | |
| 129 | ## Iteration Mode |
| 130 | |
| 131 | Use when: User has an existing skill but needs to add more context. |
| 132 | |
| 133 | ### Step 1: Load Existing Skill |
| 134 | |
| 135 | Ask user to upload their existing skill (zip or folder), or locate it if already in the session. |
| 136 | |
| 137 | Read the current SKILL.md and reference files to understand what's already documented. |
| 138 | |
| 139 | ### Step 2: Identify the Gap |
| 140 | |
| 141 | Ask: "What domain or topic needs more context? What queries are failing or producing wrong results?" |
| 142 | |
| 143 | Common gaps: |
| 144 | - A new data domain (marketing, finance, product, etc.) |
| 145 | - Missing metric |