brycewang-stanford/Auto-Empirical-Research-Skills / skills/29-quarcs-lab-project20XXy/dot-claude/skills/codebook
codebook
VerifiedAuto-generates a Markdown codebook from a dataset (CSV, DTA, Excel, Parquet) with types and summary statistics. Use when documenting variables.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.1 KB |
SKILL.md
View on GitHub---
name: codebook
description: Auto-generates a Markdown codebook from a dataset (CSV, DTA, Excel, Parquet) with types and summary statistics. Use when documenting variables.
argument-hint: <path to dataset>
allowed-tools: Bash, Read, Write, Glob, Grep
---
# Generate Variable Codebook
Auto-generate a Markdown codebook documenting all variables in a dataset.
## Arguments
- `$ARGUMENTS` — path to a dataset file (e.g., `data/rawData/sample_data.csv`, `data/panel.dta`)
## Steps
1. Determine the file format from the extension:
- `.csv` — read with pandas `read_csv`
- `.dta` — read with pandas `read_stata`
- `.xlsx` / `.xls` — read with pandas `read_excel`
- `.parquet` — read with pandas `read_parquet`
- Other formats: ask the user how to load it
2. Load the dataset using `uv run python` and extract metadata for each variable:
- Variable name
- Data type (numeric, string, categorical, datetime)
- Non-missing count and missing count
- Number of unique values
- For numeric variables: min, max, mean, median, standard deviation
- For categorical/string variables: top 5 most frequent values with counts
- For datetime variables: min and max date
3. Generate a Markdown codebook with:
- **Header:** Dataset name, file path, number of observations, number of variables, date generated
- **Summary table:** Variable name | Type | Non-missing | Unique | Description (placeholder)
- **Detailed sections per variable:** Full statistics and a `[FILL: description]` placeholder for the user to add a human-readable description
4. Derive the output filename from the dataset name:
- `data/rawData/sample_data.csv` → `references/sample-data-codebook.md`
5. Save to `references/<dataset-name>-codebook.md`
6. Report the file path and the number of variables documented.
## Error handling
- If the file does not exist, report the error and suggest checking the path.
- If the file cannot be read (corrupt, unsupported format), report the error and ask for guidance.
- Never modify the source data file. This command is read-only with respect to data.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |