본문으로 건너뛰기
cccskills
무료GitHub에 공개

generate-codebook

Use when a tabular dataset (CSV, Excel, Parquet, Stata, SAS) needs a data dictionary. Profiles every variable (type, levels, range, missingness) into codebook.md and codebook.json and flags coded values of unknown meaning as [NEEDS DICTIONARY] instead of guessing.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

연동 도구Excel
설치 방법 보기

포함된 파일(5)

  • SKILL.md4.4 KB
  • references/codebook_schema.md3.9 KB
  • scripts/generate_codebook.py12.7 KB
  • skill.yml1.2 KB
  • tests/test_generate_codebook.sh6.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Generate Codebook Skill

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. Distributions, types, and missingness are observable and the bundled script profiles them; the meaning of a coded value (fatty_liver_grade = 0) is not observable from the data and lives only in the authoritative data dictionary. You generate code and review output — you do not invent the meaning of coded values.

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.

Step 2: Review with the researcher (gate)

Read ${CLAUDE_SKILL_DIR}/references/codebook_schema.md (the codebook.json schema, the role-inference heuristics, the needs_dictionary rule) before interpreting the output. Present codebook.md and walk the user through it. Gate: role inference is a heuristic, so the user confirms the inferred roles (e.g., an integer-coded scale mis-read as continuous, or an id column). Do not proceed to definition work until the user approves the role assignments.

Step 3: Resolve [NEEDS DICTIONARY] items (gate)

For every variable flagged needs_dictionary: true, the level codes are uninterpretable without the authoritative source. Gate: ask the user to supply the meaning of each code from the real data dictionary (file/sheet/row), or to confirm none exists. Fill label, units, and per-level meanings into the codebook only from that source, citing file > sheet > row — never from inference. If the user cannot supply it, leave the [NEEDS DICTIONARY] marker in place; do not erase it.

Example: in a cohort file, sex (levels 1/2) and fatty_liver_grade (0..4) are flagged because their levels are bare codes; smoking_status (never/former/current) is not. Never write sex: 1 = male because "that is the usual coding" — if the dictionary is unavailable, the flag stays.

Step 4: Hand off

The completed codebook.json becomes the input dictionary for /define-variables (operationalization) and the citation source for dictionary-first QC. Gate: confirm with the user that no needs_dictionary flags remain unresolved before the codebook is treated as authoritative for downstream analysis.

Run /deidentify on the raw data before a codebook is shared externally. Cleaning or transforming data is /clean-data.

Known limits

  • Codes longer than 3 characters that are not numbers (C50.9, S001) are not recognised as codes, so their column is not flagged needs_dictionary.
  • An integer-coded column with more distinct values than --max-levels is classed continuous and is not flagged. The Step 2 role review is where such columns are caught.
  • The same holds for a text column holding number strings: any number value (45, 88) is read as a measurement, so integer codes exported as strings with more than --max-levels values are not flagged.

Output Format

codebook.json (schema in references) and codebook.md (review table with a "Columns requiring dictionary lookup" section). Summarize the counts (rows, columns, needs_dictionary_count) in chat; do not paste the full JSON.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Use when a medical AI paper should be found and cited by AI search engines and RAG tools. Optimizes the title, abstract, summary box (Key Points, Research in Context), keywords, preprint, GitHub README/CITATION.cff and Hugging Face card, returning a visible pass/fail checklist.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Aperivue/medsci-skills3462026년 10월 19일 업데이트

Use when a target journal has no profile yet. Reads the journal's author guidelines and writes a detailed /write-paper profile plus a compact /find-journal profile, public or user-local private, in the canonical format with quality gates.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Aperivue/medsci-skills3462026년 10월 19일 업데이트

Use when data needs statistical analysis. Runs reproducible Python/R code for Table 1, diagnostic accuracy, agreement, regression, survival, propensity score, survey-weighted and repeated-measures models, with publication tables. Sample size is /calc-sample-size; pooling studies is /meta-analysis.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Aperivue/medsci-skills3462026년 10월 19일 업데이트

Renamed to /model-selection in v6 (removed in v7).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Aperivue/medsci-skills3462026년 10월 19일 업데이트

Use when analyzing a researcher's publication record from PubMed. Fetches an author's papers, classifies study types and author position, charts the patterns and writes a strategy report, with an optional trajectory-archetype classification. Works from PubMed metadata only.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Aperivue/medsci-skills3462026년 10월 19일 업데이트

Use when one validated cohort analysis must be repeated across many exposure/outcome pairs. Generates one R/Python script per combination from a single methodology template, changing only the variables, and aggregates the results into a summary matrix.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Aperivue/medsci-skills3462026년 10월 19일 업데이트

Aperivue의 스킬 모두 보기

이 스킬의 문제 신고