agent-instructions
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when considering fine-tuning a model. Covers when fine-tuning beats prompting or RAG, dataset construction, LoRA and full fine-tuning, evaluation, and the failure modes that waste the effort.
$ npx -y skills add nimadorostkar/Claude-Skills-collection --skill fine-tuning --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/fine-tuningContext preview
The summary Claude sees to decide when to auto-load this skill.
Use when considering fine-tuning a model. Covers when fine-tuning beats prompting or RAG, dataset construction, LoRA and full fine-tuning, evaluation, and the failure modes that waste the effort.
name: fine-tuning description: Use when considering fine-tuning a model. Covers when fine-tuning beats prompting or RAG, dataset construction, LoRA and full fine-tuning, evaluation, and the failure modes that waste the effort. metadata: category: ai version: 1.0.0 tags: [fine-tuning, lora, training, dataset, evaluation]
Decide whether fine-tuning is warranted, and do it properly if it is. Most fine-tuning projects should have been prompt engineering or retrieval, and the ones that should be fine-tuning usually fail on dataset quality rather than on the training.
1. **Exhaust prompting first** — Few-shot examples, a clearer output contract, a better model. Fine-tuning cannot teach knowledge the model lacks; it teaches behavior. If the problem is that the model does not *know* something, use retrieval instead. 2. **Decide what fine-tuning is actually for** — Format adherence, tone, a domain-specific classification boundary, or distilling a large model's behavior into a small one. Those are the cases where it works. 3. **Build the dataset carefully** — This is where the project succeeds or fails. A thousand clean, consistent examples beat fifty thousand noisy ones. Inconsistent labels teach the model to be inconsistent. 4. **Split before you look** — Train, validation, test. The test set is touched once, at the end. Selecting a checkpoint on the test set is how you produce a model that scores well and performs badly. 5. **Start with LoRA** — It is cheap, fast, and sufficient for the majority of tasks. Full fine-tuning is warranted rarely. 6. **Compare against the base model on the same test set** — With the same prompt. A fine-tuned model that does not beat a well-prompted base model is a liability, not an asset.
**The decision, made honestly:**
Task: classify support tickets into 40 internal categories. Baseline (prompt only, large model): 71% accuracy + 8 few-shot examples: 79% + clarified overlapping category defs: 86% <- the definitions were the problem + RAG over past labeled tickets: 88% Large model, cost: $0.011/ticket, 1.9s latency Fine-tune (LoRA, small model, 4k examples): 91% Fine-tuned small model, cost: $0.0004/ticket, 210ms latency Decision: FINE-TUNE. Not for the 3-point accuracy gain — that alone would not justify the maintenance burden. The justification is a 27x cost reduction and a 9x latency reduction at higher accuracy, on a task running 200,000 times a month. That is $2,200/month becoming $80/month. Note that 15 of the original 29 points of improvement came from fixing the category definitions — free, and available before any training. This is usually where the gain is.
**Dataset construction that will not undermine the training:**
# Consistency is worth more than volume. Two annotators disagreeing on 12% of
# examples means the model learns to be 12% arbitrary.
def audit_dataset(examples: list[Example]) -> DatasetReport:
return DatasetReport(
total=len(examples),
# Near-duplicates inflate the count and cause memorization.
duplicates=count_near_duplicates(examples, threshold=0.95),
# Class balance: a category with 4 examples will not be learned.
per_class=Counter(e.label for e in examples),
underrepresented=[c for c, n in Counter(e.label for e in examples).items() if n < 30],
# The critical check: do two annotators agree?
inter_annotator_agreement=cohens_kappa(annotator_a, annotator_b),
# Leakage between splits is the most embarrassing failure mode.
train_test_overlap=count_overlap(train, test),
)
# Fix before training:
# kappa < 0.8 -> the labeling guidelines are ambiguous. Fix them and relabel.
# underrepresented -> gather more, or merge the category.
# train_test_overlap > 0 -> the test score is meaningless. Re-split.A curated library of 137 production-grade skills for Claude and other AI coding agents. Every skill follows one structure, speaks with one voice, and earns its place by changing what the agent does.
Repo: nimadorostkar/Claude-Skills-collection
Use when writing project instructions for a coding agent (CLAUDE.md, AGENTS.md, or equivalent). Covers what belongs in them, what does not, structure, and…
Use when an agent needs state that survives a session or a context compaction. Covers what to persist, file-based memory, structuring notes for retrieval, and…
Use when automating agent behavior with lifecycle hooks. Covers hook events, deterministic enforcement of rules the model should not be trusted to remember,…
Use when packaging skills, commands, hooks, and MCP servers into a distributable plugin. Covers manifest structure, bundling, versioning, testing, and…
Use when writing a new skill for an AI agent. Covers scoping, description writing for reliable triggering, progressive disclosure, and the difference between a…
Use when reviewing or improving an existing agent skill. Covers triggering accuracy, content quality, redundancy with the base model, and measuring whether the…