First Look
Read the first rows and the true row count of a CSV or spreadsheet, profile it against a fixed checklist, and write the result to analysis/profiles/<name>.md so the dataset's condition is on record before anyone queries it.
/first-look[data file path]A Claude Code slash command that profiles a data file before you analyze it. It counts the rows for real rather than estimating, samples the head and the tail, runs the dataset-first-look checklist over what it read, and writes analysis/profiles/<name>.md: shape, columns, nulls, cardinality, suspicious values, and the questions to settle first.
Install to ~/.claude/commands/first-look.md
npx agentscamp add commands/first-lookProfile a data file before you write a query against it, and leave the profile on disk so the next person does not repeat the work. This command runs the dataset-first-look procedure over a real file: it counts the rows exactly instead of guessing, samples enough of them to infer types, works through the same checklist every time, and writes the result to analysis/profiles/. Committed alongside the analysis, those profiles become a record of what the data looked like on the day the numbers were produced.
Scope
$ARGUMENTS is a path to a data file. Interpret it in this order:
- A
.csv,.tsv, or.txtpath: use it directly. - A
.xlsxor.xlspath: use it, and treat each sheet as a separate profile section. If a sheet is a formula model rather than an extract, say so and point at the spreadsheet-formula-auditor skill instead of profiling it as data. - A
.json,.jsonl, or.parquetpath: profile what you can read and state plainly what the format prevented you from seeing. - A directory:
Globfor data files inside it, list what you found with sizes, and ask which one to profile. Do not profile all of them silently. - Empty:
Globfordata/**,*.csv, and*.xlsxfrom the project root, list the candidates, and stop.
If the path does not exist, say so and stop. Never profile a file you did not read.
Step 1 — Establish the real shape
Get the facts a sample cannot give you. Count lines with wc -l and subtract the header. Get the file size. Read the header row and the first 50 data rows with head, then the last 20 with tail, because export bugs, trailing totals rows, and truncation live at the end of a file. For a delimited file, check the delimiter and the quoting before trusting any column split. For a spreadsheet, read the sheet names first.
Record exactly what you read: "1,402,881 data rows counted with wc -l; 70 rows inspected (first 50, last 20)". Every statement in the profile is scoped to that.
Step 2 — Run the checklist
Apply the dataset-first-look procedure to what you read, in its order: column inventory with inferred types and evidence, null and blank patterns, cardinality, suspicious columns (mixed types, sentinel values, trailing spaces, inconsistent categories, numbers stored as text, mixed date formats), duplicate-key risk, and outliers worth a look.
Where a check needs more than the sampled rows to settle, use Bash on the file rather than guessing: cut and sort -u on a column to see its real distinct values, sort | uniq -d on the candidate key to test uniqueness across the whole file, grep -c for a sentinel. Say in the profile which findings came from the full file and which from the sample. Read only; never edit the data file.
Step 3 — Write the profile
Write to analysis/profiles/<name>.md, where <name> is the data file's basename without its extension, creating the directory if needed. Include a Source line with the path, the file's modification date, and the row count, so the profile can be matched to the extract it describes.
If a profile for that name already exists, read it first and add a dated section rather than overwriting it, then note what changed since the last run: new columns, a changed row count, a category that appeared or disappeared. A diff between two profiles is often the fastest explanation for a number that moved.
Output
The profile path, the row count and column count, the count of findings by category, and the questions-to-answer list printed in the terminal so you can act on it without opening the file. Then the next step: take the questions to whoever owns the source, and when you write the query, use /define-metric to pin the metric definition it implements. Before the finished analysis ships, the analysis-reviewer agent reads the profile alongside the code. The rest of the analyst set is in Claude skills for data analysts, and the Claude Code setup around it in Claude Code for data analysts.
Related
- Dataset First LookTurn a pasted CSV header with sample rows, a pasted table, or an attached data file into a fixed plain-language profile: shape, column inventory with inferred types, null and blank patterns, cardinality, suspicious columns, duplicate-key risk, outliers worth a look, and the questions to settle before analyzing. Use when a dataset just landed and you need to know what you are holding before you write a query.
- Define MetricWrite or refine a metric definition — name, plain-language meaning, grain, filters, source tables and columns, edge cases, and owner — into analysis/metrics/<slug>.md, after searching the repo for a definition that already exists.
- Analysis ReviewerUse this agent to review a finished analysis for methodological errors before it ships — checking grain and double counting, join fan-out, rows silently dropped by filters and inner joins, sampling and truncation, null handling, time zone and date boundaries, numbers in the prose that disagree with the code's output, charts that mislead, and causal language resting on correlational evidence. Examples — 'review this notebook before I send the deck', 'the query and the summary disagree somewhere, find it', 'does this analysis actually support the conclusion it draws?'.
- Claude Code for Data Analysts: Notebooks, SQL, and CSV Work Without a Data EngineerRun analysis work in Claude Code: an analysis repo with CLAUDE.md, a CSV profiling pass, a pandas loop, a read-only warehouse query, and permission rules.
- Claude Skills for Data Analysts: 5 to Upload TodayFive portable skills that make Claude behave like a careful analyst: first look, chart choice, memo writing, SQL explanation, and formula auditing.