agentleFS
matthewdigiuseppematthewdigiuseppe/MStack/skills/codebook/SKILL.md

codebook

Skill17 starsChanged 3 months agoMITView on GitHub

Auto-generates data/codebook.md from the analytic dataset — per-variable stats plus flags for missingness, near-constants, duplicates, and implausible values. Use after cleaning stabilizes, when the user asks to document variables, or before analysis.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After /mstack:data-clean runs without errors.

    line 16

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/mstack:codebook

Stage: build · Voice: data-engineer

After /mstack:data-clean runs without errors; re-run whenever data/clean/analytic.rds changes.

Procedure

  1. Load code/01-clean.R to know what the variables are meant to be.
  2. Generate. Copy ${CLAUDE_PLUGIN_ROOT}/skills/codebook/scripts/00-codebook.R to code/00-codebook.R, set KEY_COLS and UNIT in its PARAMETERS block, and run Rscript code/00-codebook.R. It is idempotent and reports per variable: name; label (from 01-clean.R comments or attr, flagged if missing); type; range or levels; mean / SD / median / IQR, or mode + frequency; missingness (count + share); source (from data/raw/PROVENANCE.md).
  3. Flags it raises, plus any you notice: > 30% missing (document imputation or exclude); mass at an extreme (a winsorized cap); pairs with |r| > 0.99 (apparent duplicates); near-constants (< 5% variation); implausible dates (future, pre-source); rows not unique on the key; values that look like sentinel or missing codes left in an integer column (−66/−77/−88, −9, 99/999), which ${CLAUDE_PLUGIN_ROOT}/references/polisci-data-sources.md lists by source. For each variable, note which raw source and PROVENANCE entry it came from.
  4. data/codebook.md carries a header (dataset, N, K, unit, generation date, source script), the per-variable table, and a flag block with a recommended action per flag.
  5. Print the flags with recommendations. Never accept them silently.

Outputs

  • code/00-codebook.R — idempotent generator; data/codebook.md.
  • Summary block: variable count, missingness extremes, flag count + verdict.

Anti-patterns

  • A codebook without flags. Even clean data has something worth surfacing.
  • A hand-maintained codebook. It rots; generate it.

Next

/mstack:analyze; if flags are unaddressed, fix 01-clean.R first.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.