45 Skills for Claude Code: SQL, Data, Visualization

Cover image for article 1167

Asking an AI agent to “analyze this CSV” produces boilerplate pandas code in 90% of cases: pd.read_csv(), a couple of groupby calls, a simple chart via matplotlib. The result is formally correct, but a professional analyst doesn’t work that way. A translation of the article on Habr (original — a list of 45 skills from a practicing analyst) shows the difference between “writing code that runs” and “solving an analytics problem properly.” Skills cover tool selection for data volume, expectation checking, SQL work, building correct visualizations, and refactoring analytical pipelines. For Claude Code users this is a checklist: what to teach the agent via .claude/skills/ and CLAUDE.md so it stops being a junior with pandas.

Related: Claude Code full start

Related: skills folder practice

Related material: full start with Claude Code

Tools: not everything is pandas

The first group of skills — choosing libraries for the task and data volume. Pandas is convenient up to ~1-2 GB in RAM (with some overhead for intermediate objects). On 40 GB files it hits OOM or works intermittently due to data copying. Professional alternatives:

  • Polars — multi-threaded, lazy, strictly typed DataFrame engine in Rust. Processes 40 GB on 16 GB RAM thanks to streaming and Apache Arrow in memory. Syntax is close to pandas, but expressions (pl.col(…)) compile into an optimized execution plan.
  • DuckDB — embedded OLAP database, SQL interface, vectorized execution, works directly on Parquet/CSV/JSON without loading into RAM. Ideal for aggregations, JOINs, window functions on large files. Connects with a single line: duckdb.query(“SELECT … FROM ‘data.parquet'”).
  • Vaex — lazy DataFrames with memory-mapping, good for exploratory analysis and building charts on full datasets without sampling.
  • Modin / Dask — distributed pandas API on a cluster; justified only at horizontally scalable volumes.

Rule of thumb: up to 1 GB — pandas (ecosystem, compatibility); 1-50 GB — Polars or DuckDB; >50 GB — DuckDB + Parquet on disk or ClickHouse/Trino. Claude Code should know this choice and write import polars as pl instead of import pandas as pd when the task context implies larger volumes.

SQL as the first language of analytics

The second skill group — mastering SQL at a level that lets you avoid pulling data into Python for basic transformations. Key constructs the agent must generate confidently:

  • CTE (WITH) — breaking complex queries into readable steps instead of nested subqueries.
  • Window functions — ROW_NUMBER(), LAG/LEAD, SUM() OVER (PARTITION BY …) for running totals, cohorts, rolling averages without self-joins.
  • Lateral JOIN / CROSS APPLY — invoking a table-valued function per row (e.g., parsing a JSON column).
  • PIVOT / UNPIVOT — transforming long↔wide formats on the DB side.
  • EXPLAIN ANALYZE — reading execution plans, finding Seq Scan, missing indexes, inefficient JOINs.

Example: instead of loading 10M order rows into Polars to calculate LTV by cohorts — write a single SQL with window functions, return 50 aggregated rows. Savings: minutes → seconds, RAM: GB → MB. The agent’s skill — to decompose tasks, solve them cleanly in SQL, and generate the right query per dialect (PostgreSQL, DuckDB, ClickHouse, BigQuery).

Expectation checking: data doesn’t trust words

The third group — defensive programming over data. Boilerplate code assumes: columns exist, types are correct, no gaps, no duplicates, distributions are adequate. A professional verifies all this before analysis:

  1. Schema and types: df.schema (Polars) / df.dtypes (pandas) — match expectations? Did int64 turn into float64 because of a single NaN?
  2. Gaps: null_count() per column, pattern of gaps (MCAR/MAR/MNAR) — determines strategy: drop / fill / model-based imputation.
  3. Duplicates: by business key (order_id, user_id + timestamp), not all columns. df.unique(subset=[‘order_id’]).height != df.height — alarm.
  4. Range and outliers: quantiles (0.1%, 99.9%), IQR, z-scoring. Negative prices, age 200, future dates — data quality problems, not analytical insights.
  5. Relationship consistency: FK checks (do all user_id exist in users table?), temporal logic (ship_date ≥ order_date).

Automation: write a validate_dataset(df, schema_contract) function returning a report with severity (error/warning/info). Agent must run it as first command after data load. In .claude/skills/data-validation.md describe the contract: required columns, types, acceptable ranges, key uniqueness.

Visualization: not “pretty” but “readable”

The fourth group — choosing the right chart type for the question, not “what the library can do.” Skills:

  • Distributions: histogram / KDE / boxplot / violin — for shape, asymmetry, tails. Not pie chart.
  • Group comparison: grouped bar / dodged bar / slope chart — for categories. Stacked bar only for parts of whole.
  • Time series: line chart with confidence intervals, decomposition plot (trend/seasonality/residuals).
  • Relationships: scatter with regression line / hexbin for large N / pair plot for multivariate.
  • Geo/spatial: choropleth / heatmap / hexbin map.

Technical details the agent must apply per convention:

  • Axis labels with units, readable ticks (not scientific notation for money).
  • Color palette: colorblind-safe (viridis, tableau10), semantic color (red = loss/risk, green = growth/norm).
  • Interactivity: Plotly / Altair / Bokeh for dashboards; static PNG/SVG for reports.
  • Export: vector (SVG/PDF) for print, raster (PNG 2x DPI) for web.

Libraries: Polars + Altair (declarative, chart grammar), DuckDB + Plotly, or native Polars plot() (on Vega-Lite) for quick checkpoints.

Pipeline refactoring: from notebook to production

The fifth group — transforming an exploratory script into a reproducible pipeline. Skills:

  • Functional decomposition: each stage — a pure function (df: DataFrame) -> DataFrame with typing (Polars Schema / Pydantic). No side effects.
  • Configurability: parameters (paths, thresholds, dates) — in YAML/TOML/JSON, not hardcoded. config = load_config(“pipeline.yaml”).
  • Logging and observability: structlog / loguru — JSON logs with stage, rows_in, rows_out, duration_ms. Metrics to Prometheus Pushgateway.
  • Testability: property-based tests (hypothesis) on invariants: “row count doesn’t grow after dedup”, “sum of revenue doesn’t change after join with calendar”.
  • Data versioning: DVC / lakeFS / Iceberg — snapshots of input data for reproducibility.
  • Orchestration: for simple — Make / just / Taskfile; for complex — Airflow / Dagster / Prefect / Temporal. Agent must generate DAG under chosen orchestrator.

Transformation example: 300-line Jupyter notebook → analytics_pipeline/ package with stages/, config/, tests/, Dockerfile, pyproject.toml. Claude Code does this in 2-3 iterations if CLAUDE.md sets project standards.

Claude Code setup for analytics: CLAUDE.md and skills

All 45 skills shouldn’t live in context — they must be codified in agent configuration. .claude/ structure for an analytical team:

.claude/
├── CLAUDE.md              # Global rules: libraries, style, taboos
├── skills/
│   ├── data-loading.md    # Polars/DuckDB choice, streaming, schemas
│   ├── sql-patterns.md    # CTE, window, EXPLAIN, dialects
│   ├── validation.md      # Data contracts, validation framework
│   ├── viz-standards.md   # Chart types, color, export, accessibility
│   └── pipeline-structure.md # Functions, config, tests, DVC, orchestration
├── scripts/
│   └── validate.py        # CLI for data validation
└── templates/
    └── pipeline.yaml      # Pipeline config template

In CLAUDE.md — hard rules: “For >1 GB use Polars or DuckDB. Don’t write pandas without my consent. Any data loader must return a validation report. Charts — only Altair/Plotly with colorblind-safe palette. SQL in CTE, with EXPLAIN for queries >1 sec.”

Skills folder works as agent’s long-term memory: on task “analyze churn” Claude reads skills/sql-patterns.md (cohort SQL), skills/validation.md (survival check), skills/viz-standards.md (retention curve). Context doesn’t overload, quality stays consistently high.

What this means for teams with AI agents

The difference between “agent wrote code” and “agent solved the problem” — in codified expert knowledge. 45 skills from the article — the minimum that separates a junior from a senior in analytics. Move them into .claude/skills/ and CLAUDE.md, you give the agent professional guardrails: it stops generating boilerplate and starts choosing right tools, verifying data, writing SQL, building readable charts, and delivering production-ready pipelines.

Start: create .claude/ in your repo, add 5 base skill-files from the list above, write rules in CLAUDE.md. Next task “analyze CSV” yields Polars code with validations, SQL aggregations, and an Altair chart — in one pass. Full Claude Code setup guide from zero — in our article Claude Code: full start.

Useful resources: Claude Code documentation, Polars documentation.

Agent-Analyst Cheatsheet: 45 Skills in CLAUDE.md and skills

Minimal skill-file set for .claude/skills/ (per article):

  • tool-selection.md — pandas/Polars/DuckDB/Vaex: thresholds by RAM, strictness, laziness
  • sql-mastery.md — CTE, window, LATERAL, PIVOT, EXPLAIN ANALYZE, dialects
  • data-contracts.md — schemas, nullable, ranges, uniqueness, FK checks
  • validation-framework.md — validate_dataset function, error/warning/info report
  • viz-grammar.md — chart type per question, colorblind-safe, labels, export, accessibility
  • pipeline-engineering.md — pure functions, config, logging, tests, DVC, orchestration

Key rules for CLAUDE.md (hard, not recommendations):

  • Volume >1 GB → Polars (lazy) or DuckDB. Pandas only by explicit agreement.
  • Aggregations, JOINs, window → SQL (DuckDB/PostgreSQL/ClickHouse). Not in Python.
  • Every data loader returns ValidationReport. No report — no continuation.
  • Charts: Altair (static) or Plotly (interactive). Palette: viridis / tableau10. Axis labels mandatory.
  • Pipeline: functions (DataFrame → DataFrame), config.yaml, structlog JSON, pytest + hypothesis.

Quick templates for agent (in .claude/templates/):

  • pipeline.yaml — stages, params, outputs, schedule
  • validation_report.json — schema: column, check, status, severity, details
  • viz_spec.json — Vega-Lite spec under Altair

Practice of skills-folder organization and prompt versioning — in article Practice of skills-folder for Claude Code.

Agent Analyst: 45 Skills in CLAUDE.md and skills (agent) (agent)

Minimal .claude/skills/ setup for data analysis agents: tool-selection.md (Polars/DuckDB thresholds: >1GB use Polars lazy or DuckDB, pandas only with explicit approval), sql-mastery.md (CTE, window functions ROW_NUMBER LAG LEAD SUM OVER PARTITION, LATERAL JOIN, PIVOT UNPIVOT, EXPLAIN ANALYZE, dialects PostgreSQL DuckDB ClickHouse BigQuery), data-contracts.md (schemas, nullable, ranges, uniqueness, FK checks), validation-framework.md (validate_dataset function returning error/warning/info report), viz-grammar.md (chart type per question: histogram/KDE/boxplot for distributions, grouped bar for comparisons, line with CI for time series, scatter with regression for relationships, colorblind-safe viridis/tableau10, axis labels with units), pipeline-engineering.md (pure functions DataFrame->DataFrame, config.yaml, structlog JSON with stage/rows_in/rows_out/duration_ms, pytest+hypothesis property tests, DVC/lakeFS/Iceberg versioning, Make/just/Taskfile or Airflow/Dagster/Prefect/Temporal orchestration). CLAUDE.md hard rules: >1GB->Polars/DuckDB, aggregations/JOIN/windows->SQL, every loader returns ValidationReport, charts only Altair/Plotly with viridis/tableau10 colorblind-safe, units on axes mandatory, pipelines as pure functions with config.yaml, structlog JSON, pytest+hypothesis.
Like this post? Please share to your friends:
11AI - Your Free LLM
Leave a Reply

;-) :| :x :twisted: :smile: :shock: :sad: :roll: :razz: :oops: :o :mrgreen: :lol: :idea: :grin: :evil: :cry: :cool: :arrow: :???: :?: :!: