text-classification
LLM-based text classification. Codebook, validation, agreement statistics.
npx skills add majiayu000/claude-skill-registry --skill text-classification-scdenney-open-science-skills --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
What it does
Guides an AI agent to design and apply an LLM-based text classification workflow for social science data, including codebook structure (labels, definitions, clarifications, negatives, examples), learning regimes (zero-shot, few-shot, fine-tuning, instruction-tuning, encoder-only fine-tuning), model selection and reproducibility practices, prompt construction, pilot testing/validation steps, hybrid human-LLM workflows, analysis and interpretation plans, and comprehensive reporting requirements.
How it works
- Codebook Design: specifies population and sampling constraints; structures each code with Label, Definition, Clarification, Negative clarification, and Examples; recommends 3–6 codes, allows multi-labels if instructed, includes a residual category (none_of_above or uncodeable); iterates via pilot testing.
- Choosing a Learning Regime: provides decision framework mapping document characteristics to prompting or training approaches (Zero-shot, Few-shot, Fine-tuning, Instruction-tuning, Encoder-only fine-tuning); suggests testing multiple regimes when possible.
- Model Selection and Reproducibility: advocates open-weight models for publishable research; if using proprietary models, require exact model identifiers and set temperature to 0; recommends running ~50 responses twice to measure agreement and report variance.
- Prompt Construction: instructs to place the codebook in the system prompt with all components, specify exact output format (code labels, comma-separated if multi-label), constrain no extra text, and prefer JSON for structured inputs/outputs; include input text in the user message with a consistent delimiter.
- Pilot Testing and Validation: outlines stages to test label recovery, definition recovery, and in-context labeling, hand-code 50–100 responses with two independent coders, report Cohen’s κ, consider self-coding, compare LLM outputs to ground truth with per-category metrics, and perform error analysis with justifications for misclassifications; specifies an iterative path if zero-shot F1 is inadequate.
- Hybrid Human-LLM Workflows: describes a hybrid approach with a high target accuracy (93%+), flags for human review using confidence, disagreements, residuals, and boundary cases; estimates 10–15% of responses requiring human review and discusses codebook refinement from flagged cases; provides ensemble workflow guidance.
- Analysis and Interpretation: recommends reporting code prevalence by subgroups, cross-tabulations, and accounting for measurement error when LLM labels serve as variables in downstream analyses; advises design-based corrections and pre-registration considerations.
- Reporting: requires full documentation of model name/version, generation parameters, prompt text, codebook, and run dates; mandates validation metrics (per-category precision/recall/F1, overall accuracy, Cohen’s Kappa), variance tests, human-review rates; and archiving prompts, codebooks, and classification code.
When to use it
Use when designing an LLM-based text classification study in social science, especially with a predefined codebook structure and a need for rigorous validation, reproducibility, and hybrid human-in-the-loop workflows.
What it can touch
The skill references tools and concepts such as: codebook components (Label, Definition, Clarification, Negative clarification, Examples), model regimes (Zero-shot prompting, Few-shot prompting, Fine-tuning, Instruction-tuning, Encoder-only fine-tuning), model identifiers for proprietary models, and outputs formatted as code labels (comma-separated for multi-label) or JSON. It instructs running ~50 responses for variance checks and using two independent coders for pilot tests.
Caveats
It notes license and risk considerations around data privacy and proprietary model behavior, suggests open-weight models for reproducibility, and emphasizes reporting risk of future deprecation for proprietary models. It specifies attention to per-category F1 thresholds (0.7 as a practical benchmark) and acknowledges potential limitations in cross-language validation and classifier reliability. It requires documenting full classification pipeline and acknowledging measurement error in downstream analyses.
# LLM-Based Text Classification for Social Science Research ## Instructions ### 1. Codebook Design - Before drafting the codebook, specify the population, sampling frame, and (for experimental data) the treatment condition each response is drawn from. These constrain which categories can plausibly exist and which demographic subgroups any bias assessment must cover. LLM classification extends, rather than replaces, the longer open-ended coding tradition in survey methodology (Geer 1988; Lupia 2018). - Treat codebook design as the most consequential decision in the classification pipeline. LLMs struggle with loose instructions and revert to general-purpose definitions rather than following researcher-specific operationalizations (Halterman & Keith 2025). - Structure each code with the following components (adapted from Halterman & Keith 2025): - **Label**: The exact output string the model should return - **Definition**: A single-sentence operationalization of the construct - **Clarification**: What IS included — boundary cases that belong in this category - **Negative clarification**: What is NOT included — common confusions and adjacent categories - **Examples**: 2-3 positive exam
- Instructions
- 1. Codebook Design
- 2. Choosing a Learning Regime
- 3. Model Selection and Reproducibility
- 4. Prompt Construction
- 5. Pilot Testing and Validation
- 6. Hybrid Human-LLM Workflows
- 7. Analysis and Interpretation
- 8. Reporting
- Quality Checks
What does the text-classification skill do?
LLM-based text classification. Codebook, validation, agreement statistics.
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill text-classification-scdenney-open-science-skills --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
