/data-analytics-skills:data-analystfrom data-analytics-skills
Profiles CSV/JSON exports for data-quality issues, checks SQL for correctness traps and slow patterns, and produces a paste-ready summary report. Useful for cohort, funnel, and dashboard analysis.
Ships in data-analytics-skills. 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.
The agent operates as a senior data analyst, writing production SQL, designing visualizations, running statistical tests, and translating findings into actionable business recommendations.
Before the analysis, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
data_profiler.py on every new export. Exit 1 means something changes the numbers (duplicate keys, unparseable dates or amounts, placeholder nulls, label variants): fix it or state it as a caveat before any figure leaves your hands.query_optimizer.py on any query you write or are handed. The high-severity rules are correctness bugs (= NULL, NOT IN over a nullable subquery, comma joins without a condition, unbounded DELETE), not style.report_generator.py gives the key figures, rates, breakdown and monthly trend in markdown.statistical-analyst skill (run_test.py) and report the effect with its interval.Monthly aggregation with growth:
WITH monthly AS (
SELECT
date_trunc('month', created_at) AS month,
COUNT(*) AS total_orders,
COUNT(DISTINCT customer_id) AS unique_customers,
SUM(amount) AS revenue
FROM orders
WHERE created_at >= '2024-01-01'
GROUP BY 1
),
growth AS (
SELECT month, revenue,
LAG(revenue) OVER (ORDER BY month) AS prev_revenue
FROM monthly
)
SELECT month, revenue,
ROUND((revenue - prev_revenue) / prev_revenue * 100, 1) AS growth_pct
FROM growth
ORDER BY month;
Cohort retention:
WITH first_orders AS (
SELECT customer_id,
date_trunc('month', MIN(created_at)) AS cohort_month
FROM orders GROUP BY 1
),
cohort_data AS (
SELECT f.cohort_month,
date_trunc('month', o.created_at) AS order_month,
COUNT(DISTINCT o.customer_id) AS customers
FROM orders o
JOIN first_orders f ON o.customer_id = f.customer_id
GROUP BY 1, 2
)
SELECT cohort_month, order_month,
EXTRACT(MONTH FROM AGE(order_month, cohort_month)) AS months_since,
customers
FROM cohort_data ORDER BY 1, 2;
Window functions (running total + previous order):
SELECT customer_id, order_date, amount,
SUM(amount) OVER (PARTITION BY customer_id ORDER BY order_date) AS running_total,
LAG(amount) OVER (PARTITION BY customer_id ORDER BY order_date) AS prev_amount
FROM orders;
| Data question | Best chart | Alternative |
|---|---|---|
| Trend over time | Line | Area |
| Part of whole | Donut | Stacked bar |
| Comparison | Bar | Column |
| Distribution | Histogram | Box plot |
| Correlation | Scatter | Heatmap |
| Geographic | Choropleth | Bubble map |
Design rules: Start Y-axis at zero for bar charts. Use <= 7 colors. Label axes. Include benchmarks or targets for context. Avoid 3D charts and pie charts with > 5 slices.
+------------------------------------------------------------+
| KPI CARDS: Revenue | Customers | Conversion | NPS |
+------------------------------------------------------------+
| TREND (line chart) | BREAKDOWN (bar chart) |
+-------------------------------+-----------------------------+
| COMPARISON vs target/LY | DETAIL TABLE (top N) |
+-------------------------------+-----------------------------+
| Category | Metric | Formula |
|---|---|---|
| Acquisition | CAC | Total S&M spend / New customers |
| Acquisition | Conversion rate | Conversions / Visitors |
| Engagement | DAU/MAU ratio | Daily active / Monthly active |
| Retention | Churn rate | Lost customers / Total at period start |
| Revenue | MRR | SUM(active subscription amounts) |
| Revenue | LTV | ARPU x Gross margin x Avg lifetime |
## [Headline: action-oriented finding]
**What:** One-sentence description of the observation.
**So What:** Why this matters to the business (revenue, retention, cost).
**Now What:** Recommended action with expected impact.
**Evidence:** [Chart or table supporting the finding]
**Confidence:** High / Medium / Low
# Analysis: [Topic]
## Business Question -- What are we trying to answer?
## Hypothesis -- What do we expect to find?
## Data Sources -- [Source]: [Description]
## Methodology -- Numbered steps
## Findings -- Finding 1, Finding 2 (with supporting data)
## Recommendations -- [Action]: [Expected impact]
## Limitations -- Known caveats
## Next Steps -- Follow-up actions
All three read the user's file, use the Python standard library only, and share one column-typing module (scripts/profile_core.py), so a 0/1 flag is a rate, an ID is never summed and only continuous measures are tested for extreme values.
python3 scripts/data_profiler.py assets/flawed_orders.csv
python3 scripts/data_profiler.py --file assets/sound_orders.csv --top 10 --format json
python3 scripts/query_optimizer.py assets/flawed_query.sql
python3 scripts/query_optimizer.py --sql "SELECT * FROM orders WHERE status = NULL" --format json
python3 scripts/report_generator.py assets/sound_orders.csv --group-by plan
python3 scripts/report_generator.py assets/sound_orders.csv --metric amount --date-col order_date --title "H1 orders" --format json
python3 scripts/report_generator.py assets/sound_orders.csv --group-by plan --test-json plan_test.json --test-on is_paid --test-groups free,pro
| Tool | What it does | Key flags |
|---|---|---|
data_profiler.py | Types every column (empty, constant, binary, numeric, date, id, categorical, text) and runs only the checks that fit: duplicate keys and rows, unparseable or impossible dates, mixed date formats, non-numeric and currency-formatted numbers, placeholder nulls (N/A, -), sentinel codes (999, -1), case/space label variants, mixed yes/no encodings, constant columns, extreme values (Tukey 3 x IQR, measures only). Each finding quotes values with line numbers and gives the fix. | <file> or --file, --top, --format text|json (--json alias) |
query_optimizer.py | Masks comments and strings, then checks each statement: unbounded UPDATE/DELETE, = NULL, NOT IN (SELECT ...), cartesian and implicit joins, functions on filtered columns, leading-wildcard LIKE, SELECT *, DISTINCT over a JOIN, division without NULLIF, deep nesting, OR chains, UNION vs UNION ALL. Prints a rewritten query with the mechanical fixes applied. | <file>, --file, --sql, - for stdin, --format text|json |
report_generator.py | Markdown report: data caveats first, then key figures, rates for 0/1 flags, breakdown by a group column, monthly trend, and highlights computed from the figures. Group differences are described, never called significant; --test-json writes a statistical-analyst run_test.py input (two_proportion for a 0/1 flag, welch_t for a number) so the difference can be tested. | <file>, --group-by, --metric, --date-col, --title, --test-json <out.json> --test-on <col> --test-groups a,b, --format text|markdown|json |
Samples in assets/: sound_orders.csv / flawed_orders.csv / malformed_orders.csv for the profiler and report, sound_query.sql / flawed_query.sql / malformed_query.sql for the query checker. assets/contract.json declares the expected exit code of each.
| Code | data_profiler.py | query_optimizer.py | report_generator.py |
|---|---|---|---|
| 0 | no issue to fix (notes may remain) | no high/medium finding | report built on clean data |
| 1 | issues to fix | findings | report built, but data issues change its numbers |
| 2 | file missing, empty, not UTF-8, not a table, header only | no SQL statement, unbalanced parentheses | unusable file, unknown or wrong-type column |
Errors print one BLOCKED: <reason> line on stderr, never a traceback.
$ python3 scripts/data_profiler.py assets/flawed_orders.csv
FIX 10 issue(s) (4 high, 6 medium) + 2 note(s)
Read 122 rows x 11 columns from assets/flawed_orders.csv (CSV, delimiter ','). Rows are cited by file line (header = line 1).
...
2. [high] signup_date: INVALID_DATE
Problem: cast 'signup_date' to date: 3 row(s) fail parsing, e.g. '31/02/2024' (line 9), '2024-13-05' (line 21), 'yesterday' (line 35)
Evidence: 3 row(s), 2.5%; e.g. '31/02/2024' at line 9; '2024-13-05' at line 21; 'yesterday' at line 35
Rule: every value must be a real calendar date
Fix: Correct those cells at the source (an impossible date such as 31 February needs the real date) or set them to NULL, then cast with one explicit format: pandas pd.to_datetime(df['signup_date'], format='%Y-%m-%d', errors='coerce').
The is_paid 0/1 column in the same file is reported as 42 of 122 true (34.4%), not as outliers.
| Problem | Likely cause | Resolution |
|---|---|---|
A column you expected to be numeric is typed text | More than 20% of its values do not parse as numbers | Run the profiler: NON_NUMERIC and FORMATTED_NUMBERS list the cells; clean them and re-run |
| A count looks too high | Duplicate keys or exact duplicate rows | DUPLICATE_KEY / DUPLICATE_ROWS give the lines; deduplicate before counting |
| An ID column was not recognised | Its name has no id/uuid and its values repeat | Repeating IDs are typed id (foreign key) only when the name says so; otherwise they show as categorical or text, which is harmless for profiling |
| Dates like 03/04/2024 | Day and month are both <= 12 | The profiler reads them with the column's dominant format and reports how many were ambiguous |
query_optimizer.py misses an issue | It reads SQL text and has no access to the schema or plan | Run EXPLAIN ANALYZE on the real database for plan-level problems |
| Report shows a big gap between groups | Small groups or chance | Test it with statistical-analyst before reporting it |
query_optimizer.py (exit 0) before it feeds a production dashboard.data_profiler.py runs on every new export before analysis, and every remaining issue is stated as a caveat.In scope: profiling exports for data quality, SQL review, summary reports, cohort and funnel analysis, chart choice, insight delivery.
Out of scope: significance tests (use statistical-analyst), predictive modelling (data-scientist), recurring dashboards and KPI systems (business-intelligence), pipelines and warehouse modelling (analytics-engineer).
Limitations: the tools read local CSV/TSV/JSON/JSONL files into memory (very large files need sampling first) and never connect to a database. query_optimizer.py is static analysis: it does not know table sizes, indexes or the dialect, so its findings are what to check, and EXPLAIN decides. Thresholds marked heuristic in the output (missing-value bands, 15 distinct values for a measure) are this skill's defaults, not published standards.
data-analytics/analytics-engineer): Provides the clean mart models that analysts query; data quality issues found during analysis feed back to the analytics engineer.data-analytics/business-intelligence): Ad-hoc analyses that prove valuable often graduate into repeatable BI dashboards.data-analytics/data-scientist): Complex findings requiring predictive modeling or causal inference are handed off to data science.product-team/): Product managers consume funnel and cohort analyses for feature prioritization.business-growth/): Revenue and customer health analyses inform growth strategy.assets/contract.json (opens in a new tab)assets/flawed_orders.csv (opens in a new tab)assets/flawed_query.sql (opens in a new tab)assets/malformed_orders.csv (opens in a new tab)assets/malformed_query.sql (opens in a new tab)assets/sound_orders.csv (opens in a new tab)assets/sound_query.sql (opens in a new tab)scripts/data_profiler.py (opens in a new tab)scripts/profile_core.py (opens in a new tab)scripts/query_optimizer.py (opens in a new tab)scripts/report_generator.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
data-profiling, sql-review, data-quality, analytics, reporting
8 skills in this plugin
/analytics-engineerAnalytics engineering across data modeling, dbt, transformation, and semantic layers, with tools that check a dbt manifest/catalog (model quality, downstream impact, schema drift, model docs). Use when building dbt models, designing star schemas, writing staging or mart SQL, configuring data tests, optimizing warehouse queries, or before merging a dbt change that may break dashboards.
/business-intelligenceScore KPIs against targets, validate metric definitions, lay out dashboards and review a finished dashboard spec for overload, chart misuse and conflicting definitions. Use when designing, reviewing or automating BI dashboards and KPIs.
/npx claudepluginhub borghei/claude-skills --plugin data-analytics-skillsOther plugins' skills for the same job