/ai-analyst-plus:data-mapfrom ai-analyst-plus
Produces a cross-table data health map for the active dataset: row counts, date alignment, join rates, relationships, and an opening analytical hypothesis. Fires on broad dataset overview requests.
Ships in ai-analyst-plus. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Answer the broadest possible question — "tell me about this data" — with the broadest substantive answer: cross-table health, relationships, date alignment, and an opening analytical thread. This is first-contact dataset exploration, not a schema dump and not a steering question.
Fires on dataset-wide open questions:
Does NOT fire when:
data-quality-check/explore or is mid-exploration within an already-mapped dataset → use explore/data or /data {table} → use data-inspect (schema-only)/run-pipeline or a specific analysis → run the pipelineFires regardless of:
.knowledge/, this skill produces a live report).knowledge/active.yaml to get active_dataset. If missing, halt and tell the user to run /connect-data (knowledge-bootstrap can create the rest of the tree)..knowledge/datasets/{active}/manifest.yaml for connection type and local paths..knowledge/datasets/{active}/schema.md for table list and column types..knowledge/datasets/{active}/quirks.md to surface known gotchas inline.For every table in schema.md, run:
SELECT
COUNT(*) AS row_count,
COUNT(DISTINCT {pk_col}) AS distinct_pk,
COUNT(*) - COUNT(DISTINCT {pk_col}) AS pk_dupes,
SUM(CASE WHEN {pk_col} IS NULL THEN 1 ELSE 0 END) AS pk_nulls
FROM {schema}.{table};
PK inference order: (1) {table_singular}_id (e.g., order_id for orders), (2) column literally named id, (3) if neither, note "no single PK detected — composite candidate" and check the most plausible composite. For order_items specifically, use order_item_id if present, else (order_id, product_id).
For each table, identify the primary timestamp column (prefer *_timestamp, then *_date, then created_at/started_at/session_start/event_timestamp). Run:
SELECT MIN({ts}) AS min_ts, MAX({ts}) AS max_ts, COUNT(DISTINCT DATE({ts})) AS distinct_days
FROM {schema}.{table};
Tables with no timestamp (e.g., products, calendar, promotions if static): note as "static/reference."
For every column in every non-reference table, compute null %. Use a single query per table:
SELECT
SUM(CASE WHEN {col_1} IS NULL THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS {col_1}_null_pct,
SUM(CASE WHEN {col_2} IS NULL THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS {col_2}_null_pct,
...
FROM {schema}.{table};
Flag any column with null% > 5%. For DOUBLE foreign-key columns (e.g., orders.promo_id), high nulls may be expected (not every order used a promo) — note but don't alarm.
Infer FKs from naming: a column named {entity}_id in table T likely references the {entity}s (or {entity}) table's PK. For each inferred FK, run:
SELECT
COUNT(*) AS child_rows,
COUNT(DISTINCT c.{fk_col}) AS distinct_fks,
SUM(CASE WHEN p.{pk_col} IS NULL THEN 1 ELSE 0 END) * 100.0 / COUNT(*) AS orphan_pct
FROM {schema}.{child_table} c
LEFT JOIN {schema}.{parent_table} p
ON c.{fk_col} = p.{pk_col};
Expected FKs in a typical e-commerce schema (illustrative example):
orders.user_id → users.user_idorder_items.order_id → orders.order_idorder_items.product_id → products.product_idevents.user_id → users.user_idevents.session_id → sessions.session_idevents.product_id → products.product_id (nullable — only product-related events)sessions.user_id → users.user_idmemberships.user_id → users.user_idnps_responses.user_id → users.user_idsupport_tickets.user_id → users.user_idsupport_tickets.order_id → orders.order_id (nullable)experiment_assignments.user_id → users.user_idexperiment_assignments.experiment_id → experiments.experiment_idorders.promo_id → promotions.promo_id (nullable)Generalize by scanning column names for *_id patterns — the FK list above is one example shape, not a required schema.
Build a table: each row is a table, columns are (min_ts, max_ts, distinct_days). Identify:
calendar table exists, confirm its range covers the fact tables.Render an ASCII DAG. Use this layout pattern:
users ──┬── sessions ── events
├── orders ── order_items ── products
├── memberships
├── nps_responses
├── support_tickets ──(nullable)── orders
└── experiment_assignments ── experiments
promotions ──(nullable)── orders
calendar (reference / date spine)
Only include tables that actually exist in the active schema.
From quirks.md, inline any noted gotchas in the relevant section of the output. If quirks.md is empty or placeholder-only, note: "No quirks documented yet — run /data-profiling for deep column-level analysis."
Close with one concrete analytical thread. Prefer a thread that:
Pick a thread grounded in the data's strongest signal — a visible spike, a clear cohort split, or a conspicuous gap. For example: if a support_tickets table shows a sharp weekly-volume spike, a strong opener is "ticket volume jumped in week N — want to pull the thread on what drove it?"
After running, append each query to .knowledge/query-log.md in the working folder: a dated line with the purpose, the SQL, and the row count.
# Data Map: {display_name}
**Source:** {connection_type} @ {path} • **Active:** {min_date} → {max_date} • **Tables:** {n}
## Cross-Table Health
| Table | Rows | PK Unique | Primary Timestamp | Date Range | Days | Completeness |
|-------|-----:|:---------:|:------------------|:-----------|-----:|:-------------|
| users | 50,000 | ✅ | signup_timestamp | 2024-01-01 → 2024-12-31 | 366 | A |
| orders | 47,199 | ✅ | order_timestamp | 2024-01-02 → 2024-12-31 | 364 | A |
| ... | | | | | | |
**Legend:** ✅ PK unique, no nulls • ⚠ PK dupes or nulls • Completeness A (<1% null) / B (1-5%) / C (5-20%) / D (>20%)
## Relationship Map
[ASCII DAG]
## Join-Rate Matrix
| Child → Parent | Child Rows | Distinct FKs | Orphans |
|----------------|-----------:|-------------:|--------:|
| orders.user_id → users | 47,199 | 28,403 | 0.0% |
| ... | | | |
**Orphans > 1%** are flagged. Nullable FKs (e.g., `orders.promo_id`) are noted but not flagged.
## Date Alignment
- **Pivot range:** YYYY-MM-DD → YYYY-MM-DD ({N} days, all core facts present)
- **Misalignments:** [list any table with range <80% of pivot, or note "All core tables aligned."]
- **Calendar coverage:** [confirm calendar spans the pivot, or flag]
## Completeness Flags
[Any column with >5% nulls, excluding expected-nullable FKs. If none, write "No columns exceed 5% null threshold (excluding nullable FKs)."]
## Quirks
[From quirks.md, or "No quirks documented — run `/data-profiling` for deep profiling."]
## Thread to Pull
[One concrete analytical opener, 1-2 sentences, grounded in the data.]
---
_Generated by `data-map` skill. For a deeper statistical profile, run `/data-profiling`. For one-table DQ, ask about the table directly. For guided exploration, use `/explore`._
calendar, products, promotions, experiments are static. Skip date range and note as "reference."data-quality-check: this skill is DQ at the dataset level; table-scoped DQ still fires on table-specific questions.data-inspect: if the user's question is open-ended ("tell me about") rather than /data-commanded, run data-map, not data-inspect.data-profiling: that skill is a deep, per-column statistical profile meant to run once after connection. data-map is the conversational first-contact answer./explore: /explore is for iterative, user-steered exploration within an already-mapped dataset.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub ai-analyst-lab/ai-analyst-plugin --plugin ai-analyst-plus47 skills in this plugin
/always-compareNever present a metric or number in isolation; anchor every number to a comparison (prior period, benchmark, or another segment) or state that none is available. Use every time you show a number: rates, counts, revenue, averages, query results, chart labels, summary stats. Trigger on output containing "the rate is", "we saw", "total", "average", "conversion", "revenue", "users", "sessions", "churn", "AOV", "NPS", or any figure pulled from data./analysis-designTurn a vague hunch or stakeholder request into a rigorous analysis plan via a staged pipeline (hypothesis sharpening, confound scan, V1, feedback, V2 redesign). Trigger on "I think X caused Y", "design an analysis for", "what's driving", "V2 after feedback", "stakeholder comments", "redesign the analysis". Vs question-framing (the lightweight framing gate before every analysis): use THIS only for a real hunch, confound scan, or V1 to V2 redesign./analyst-coreOperating rules for every data analysis. Apply for ANY data-analysis intent: "analyze", "investigate", "why did X change", "compare", "report on", "dashboard", "metrics", "funnel", "retention", "revenue", "conversion", "trend", "segment", "forecast", "how are we doing", "dig into", "break down", or any question about data, a metric, a CSV, or a table. Sets the method and routes to the other skills; load before any analytical question./archaeologyRetrieve proven SQL patterns, table cheatsheets, and join patterns from .knowledge/query-archaeology/ so past work gets reused. Fire as a pre-flight step before writing ANY SQL. Also trigger on "do we have a known query for X", "how do we usually join these tables", "have we computed this metric before". If the store is empty or missing, exit silently. Also owns the writer convention: after a validated analysis, curate the final SQL here./businessBrowse and search the organization's business context in .knowledge/organizations/: glossary terms, product catalog, metric definitions, OKRs, team structure. Trigger on "/business", "show me our glossary", "what metrics are defined?", "what products do we have?", "show me our OKRs", "who's on which team?", "look up [business term]", "what's the meaning of [term]?". Use this instead of reading the files directly./causalCausal inference toolkit for when experiments are not possible: estimate treatment effects from observational data with assumption checks and mandatory caveats. Invoke as /causal. Trigger on "causal", "caused", "impact of", "effect of", "attribution", "counterfactual", "difference-in-differences", "DiD", "propensity matching", "pre-post". If randomization IS possible, route to /experiment design instead.Other plugins' skills for the same job