/ai-analyst-plus:data-profilingfrom ai-analyst-plus
Deep-profiles datasets to reveal distributions, temporal patterns, correlations, completeness gaps, and anomalies. Use after connecting a new dataset to assess data quality and plan analysis.
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.
Read when SKILL.md points to them; scripts run unread.
Deep-profile the active dataset to understand schema structure, value distributions, temporal patterns, correlations, completeness gaps, and anomalies. Produces a comprehensive profile report that serves as the foundation for analysis planning and data quality assessment.
Bundled profiling library: the profiling functions used below ship inside this skill at scripts/ (data_helpers.py, schema_profiler.py, deep_profiler.py; pandas/numpy, plus duckdb for DuckDB sources). Add this skill's scripts/ directory to sys.path before the imports in the steps below:
import sys
import pandas as pd
sys.path.insert(0, "<path to this skill>/scripts") # the scripts/ dir next to this SKILL.md
If the skill install path cannot be resolved (some sandboxed environments): read the script file(s) from this skill, write a copy into a scripts/ folder inside the working folder, and run from there. The scripts are self-contained.
Run Python from the working folder root so .knowledge/ paths resolve.
last_profiled in manifest.yaml)DISAMBIGUATION: this is the DEEP statistical profile (distributions, correlations, anomalies). For cross-table relationships/health and the first-contact "tell me about this data" overview, use data-map; for a single column's distribution, use distribution-profiler; for a plain schema listing, use /data (data-inspect).
from data_helpers import get_connection_for_profiling
from schema_profiler import profile_source
# Get connection (auto-detects DuckDB vs CSV from active dataset)
conn_info = get_connection_for_profiling()
# Run full schema profile — introspects all tables: column names, types,
# nullability, row counts, sample values, basic statistics, date detection
schema = profile_source(conn_info)
Record the output. schema contains the full table inventory with column-level metadata. Use this to identify:
For each table in the schema, load the data and run the deep profiling functions. Prioritize tables with the most rows and the most date/numeric columns.
from data_helpers import read_table
from deep_profiler import (
profile_distributions,
profile_temporal_patterns,
profile_completeness,
)
for table_info in schema["tables"]:
table_name = table_info["name"]
df = read_table(table_name)
# Distribution analysis on all numeric columns
distributions = profile_distributions(df)
# Completeness assessment — null rates, zeros, empty strings, constant cols
completeness = profile_completeness(df)
# Temporal pattern analysis (only if the table has date columns)
temporal = None
if table_info.get("date_columns"):
primary_date = table_info["date_columns"][0]
temporal = profile_temporal_patterns(df, primary_date, freq="D")
Important: For large tables (>50K rows), profile_source() already samples. But read_table() loads the full CSV. If a table has >100K rows, sample before running deep profiling:
if len(df) > 100_000:
df = df.sample(n=100_000, random_state=42)
Run correlation and anomaly detection on tables that contain key business metrics (revenue, counts, rates). Identify these tables by looking for columns with names like revenue, amount, total, count, rate, price, quantity.
from deep_profiler import profile_correlations, profile_anomalies
# Correlations — find relationships between numeric columns
correlations = profile_correlations(df, threshold=0.5)
# Anomaly detection — requires a date column and pre-aggregated data.
# Aggregate to daily granularity first if the table has event-level rows.
if table_info.get("date_columns"):
primary_date = table_info["date_columns"][0]
# Only run on tables with a clear date + metric pattern
metric_cols = [c for c in df.select_dtypes(include="number").columns
if c not in ("id", table_name.rstrip("s") + "_id")]
if metric_cols:
# Daily mean of each metric. Use .sum() for daily totals, or a
# separate .size() aggregation when you want daily row volume.
daily = (
df.groupby(pd.to_datetime(df[primary_date]).dt.date)[metric_cols]
.mean()
.reset_index() # the date returns as a column named {primary_date}
)
anomalies = profile_anomalies(daily, date_col=primary_date,
metric_cols=metric_cols, window=14)
# Fail loudly on an empty scan — a profile with a silently empty
# Anomalies section is worse than an error.
if anomalies["metrics_scanned"] == 0:
raise RuntimeError(
f"Anomaly scan for {table_name} scanned zero metrics: "
f"{anomalies['summary']} Fix the aggregation before writing the report."
)
Write the full profile report to .knowledge/datasets/{active}/last_profile.md. Use schema_to_markdown() for the schema portion, then append the deep profiling results.
from data_helpers import schema_to_markdown, detect_active_source
source = detect_active_source()
active_dataset = source["source"]
# Build the schema markdown section
schema_md = schema_to_markdown(schema)
Assemble the full report and write it to:
.knowledge/datasets/{active_dataset}/last_profile.md
Then update the manifest: set last_profiled in
.knowledge/datasets/{active_dataset}/manifest.yaml to today's date. This skill owns that
field; it is what the staleness check in "When to Use" reads.
# Data Profile: {dataset_name}
**Profiled at:** {ISO timestamp}
**Source:** {connection type} ({path or schema prefix})
**Tables:** {count} | **Total rows:** {sum}
---
## Summary of Findings
| Severity | Count | Details |
|----------|-------|---------|
| BLOCKER | X | {brief list} |
| WARNING | X | {brief list} |
| INFO | X | {brief list} |
---
## Schema Overview
{output of schema_to_markdown()}
---
## Distribution Analysis
### {table_name}
| Column | Shape | Skewness | Outliers (IQR) | Recommended Transform |
|--------|-------|----------|----------------|----------------------|
| {col} | {shape} | {skew} | {n_outliers} | {transform or "none"} |
---
## Temporal Patterns
### {table_name} ({date_column})
- **Date range:** {min} to {max}
- **Coverage:** {actual}/{expected} periods ({pct}%)
- **Gaps:** {count} gaps found {list if any}
- **Trend:** {trend direction}
- **Seasonality:** {detected or not}
- **Day-of-week pattern:** {summary}
---
## Completeness
### {table_name}
| Column | Status | Null % | Zeros | Empty Strings | Constant? |
|--------|--------|--------|-------|---------------|-----------|
| {col} | {status} | {pct} | {count} | {count} | {yes/no} |
---
## Correlations
### {table_name}
| Column A | Column B | Correlation | Strength | Direction |
|----------|----------|-------------|----------|-----------|
| {col_a} | {col_b} | {r} | {strength} | {direction} |
---
## Anomalies
### {table_name}
{anomaly summary}
| Metric | Spikes | Drops | Details |
|--------|--------|-------|---------|
| {metric} | {count} | {count} | {top anomalies with dates} |
---
## Recommendations
- **BLOCKER items:** {must fix before analysis}
- **WARNING items:** {note as caveats}
- **Suggested analysis focus:** {tables/columns with most signal}
Apply these rules consistently across all sections:
| Severity | Condition |
|---|---|
| BLOCKER | >50% nulls in a key metric column; entire date ranges missing (coverage <50%); constant columns that should have variance; very strong correlations (r>0.95) suggesting duplicate columns |
| WARNING | 5-50% nulls; heavy-tailed or bimodal distributions in metric columns; date coverage 50-90%; moderate anomalies detected; skewness >3 suggesting data quality issues |
| INFO | <5% nulls; normal or mild skew distributions; full date coverage; no anomalies; expected correlations (e.g., quantity and revenue) |
read_table(). The schema profiler handles this internally, but deep profiling should also use the CSV path.profile_source() first (Step 1) so you know which columns are dates, which are numeric, and what the cardinality looks like before deep profiling.last_profile.md so future sessions can reference it without re-profiling.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