generate-codebook

generate-codebook is a skill for Claude Code from Aperivue/medsci-skills. It costs 97 tokens per session (1,753 once invoked), scanned A, original, MIT.

A data-dictionary generator for tabular files such as CSV, Excel, Parquet, Stata, or SAS files. A codebook records what each column contains, including its type, values, ranges, and missing data.

In plain words
What is it for?
Profiling every variable and producing codebook.md and codebook.json files. It helps document datasets before analysis or quality checks.
Why use it?
It gives researchers a citable description of a dataset without guessing what unknown numeric codes mean. Unclear coded values are marked for review against an authoritative dictionary.

Skill for Claude Code

Written for Claude Code: ${CLAUDE_SKILL_DIR} variable. Also seen: model in frontmatter.

Part of the medsci-data plugin — 8 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/aperivue/medsci-skills/generate-codebook
Any agent
npx skills add Aperivue/medsci-skills --skill generate-codebook
Clone the repo
git clone --depth 1 https://github.com/Aperivue/medsci-skills

Made for: Claude Code.

Or install medsci-data, the plugin that ships this one along with the rest of its 8 skills.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for generate-codebook

README.md
[![agentmods](https://agentmods.dev/badge/skills/aperivue/medsci-skills/generate-codebook.svg)](https://agentmods.dev/skills/aperivue/medsci-skills/generate-codebook)
Your own site
<a href="https://agentmods.dev/skills/aperivue/medsci-skills/generate-codebook"><img src="https://agentmods.dev/badge/skills/aperivue/medsci-skills/generate-codebook.svg" alt="Measured on agentmods" height="20"></a>
Per session 97 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,753 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00097 $0.01753
Opus 5 $0.00048 $0.00877
Sonnet 5 $0.00019 $0.00351
Haiku 4.5 $0.00010 $0.00175

Measured 6d ago against content hash 043903ea13d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

generate-codebook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/generate_codebook.py, tests/test_generate_codebook.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/generate-codebook/SKILL.md · 156 lines

How it starts

The opening of the file, as written. The whole thing — 156 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Generate Codebook Skill

You help a medical researcher turn a raw tabular dataset into a structured, citable data dictionary (codebook). This is the generator side of the dictionary-first workflow: it produces the artifact that /define-variables and dictionary-first QC later consume. You generate code and review output — you do not invent the meaning of coded values.

Communication Rules

  • Communicate with the user in their preferred language.
  • Variable names, codebook fields, and report output are in English.
  • Medical terminology is always in English.

Philosophy

A codebook describes what is in the data, not what the codes mean. Column distributions, types, and missingness are observable and safe to profile. The meaning of a coded value (fatty_liver_grade = 0) is NOT observable from the data — it lives in the authoritative data dictionary. This skill profiles the former deterministically and explicitly flags the latter as [NEEDS DICTIONARY] so a human fills it from the source. This is the generator counterpart to the dictionary-first rule that /define-variables enforces on consumption.

Reference Files

  • Schema + role rules: ${CLAUDE_SKILL_DIR}/references/codebook_schema.md — the codebook.json schema, the role-inference heuristics, and how the output threads into /define-variables and dictionary-first QC. Read this before interpreting output.

Deterministic Script

Run the bundled profiler rather than describing columns from memory:

python "${CLAUDE_SKILL_DIR}/scripts/generate_codebook.py" data.csv --out-dir .

Supports .csv/.tsv/.xlsx/.parquet/.dta/.sas7bdat. Flags: --max-levels N (categorical cutoff, default 20), --json-only, --md-only. The script is pandas-only, runs locally, and never sends data anywhere.

Workflow

Step 1: Profile (deterministic)

Run generate_codebook.py on the dataset. It writes codebook.json (machine- readable) and codebook.md (review table), reporting per variable: role (id / continuous / categorical / binary / date / text), dtype, missingness, unique count, level frequencies or quantile summary, and a needs_dictionary flag.

Read the full file on GitHub · 156 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 156 lines · 97 tokens per session scan A 043903ea13d5

Subscribe to this mod's changes

generate-codebook is a skill published in the GitHub repository Aperivue/medsci-skills (283 stars, last pushed 4d ago), licensed MIT. It adds 97 tokens to every session and 1,753 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

markitdown

Convert heterogeneous documents and selected URIs to Markdown with Microsoft MarkItDown for text analysis, search, and LLM/RAG ingestion. Covers safe local conversion, streams, Office/PDF/data formats, batch workflows, plugins, vision OCR, Azure extraction, and the official MCP server.

K-Dense-AI/scientific-agent-skills · 61 tokens

xml-reader

Read and parse XML from construction systems - P6 schedules, BSDD exports, IFC-XML, COBie-XML. Convert to pandas DataFrames.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 34 tokens

llm-document-extraction

Extract structured data from construction documents using LLMs. Process RFIs, submittals, contracts, specifications. Convert unstructured PDFs to structured JSON/Excel.

datadrivenconstruction/DDC_Skills_for_AI_Agents_in_Construction · 39 tokens

antinet-doc-parse

软件开发工程师与数据科学家在构建RAG系统时,当需处理PDF/Word/Excel等多格式复杂文档,用此技能可自动触发三级解析降级,一键输出高置信度结构化Markdown与元数据,免去繁琐清洗,直接夯实企业知识库数据底座!.

anbeime/skill · 79 tokens

doc-parse

将 PDF/PPT/Excel/Word 等多格式文档解析为结构化 Markdown,并输出元数据与解析置信度,作为 RAG 与四色卡片的数据底座。.

anbeime/skill · 43 tokens

blog-chart

Generate dark-mode-compatible inline SVG data visualization charts for blog posts. Supports horizontal bar, grouped bar, donut, line, lollipop, area, and radar charts with automatic platform detection (HTML vs JSX/MDX). Enforces chart type diversity, accessible markup (role=img, aria-label), source attribution, and…

Infrasity-Labs/dev-gtm-claude-skills · 164 tokens