How to write agent skills that don't hallucinate or hog tokens
A concentrated set of best practices for writing, structuring, and validating LLM agent skills so they trigger correctly, execute deterministically, and stay under 500 lines.

What it does
This guide defines how to package domain expertise into agent “skills” — structured bundles of instructions, scripts, and references that LLM agents can discover and execute. It enforces a rigid directory layout with a single SKILL.md brain under 500 lines, supported by flat subdirectories for scripts/, references/, and assets/. The goal is to keep the context window pristine by loading details only when needed, while ensuring agents don’t hallucinate steps or fire on the wrong prompts.
The interesting bit
The unusual angle is using LLMs to adversarially validate LLM skills. The guide includes explicit prompt templates to make an LLM act as a QA tester, a logic validator, and an architecture refiner — essentially treating skill development like test-driven development where your test suite is another instance of the model. It also mandates “negative triggers” in metadata descriptions so agents know when not to use a skill, which is a rare bit of defensive API design.
Key highlights
- Rigid structure:
SKILL.mdmust stay under 500 lines; supporting files live exactly one level deep inscripts/,references/, orassets/. - Frontmatter rules: skill
namemust match the directory name exactly; descriptions must include negative triggers to avoid false positives. - Progressive disclosure: instructions use just-in-time loading with explicit relative paths rather than stuffing context into the main prompt.
- Deterministic scripts: fragile or repetitive logic moves to tiny CLI scripts in
scripts/instead of asking the LLM to generate code from scratch. - Validation by LLM: includes prompt templates for discovery testing, logic simulation, edge-case probing, and architecture refinement.
Caveats
- This is a concentrated guide, not a comprehensive spec; the README explicitly redirects readers to Claude’s official docs for full coverage.
- The validation steps are manual LLM prompts, not an automated framework — the repo itself contains no tooling to run the tests.
- The
agentskills.iospec is referenced but not defined here; you’ll need external context to understand the underlying standard.
Verdict
Worth reading if you’re building agent platforms or authoring reusable skills for LLM agents and need a battle-tested structure. Skip it if you’re looking for a library or CLI tool; this is pure methodology and prompt templates.
Frequently asked
- What is mgechev/skills-best-practices?
- A concentrated set of best practices for writing, structuring, and validating LLM agent skills so they trigger correctly, execute deterministically, and stay under 500 lines.
- Is skills-best-practices open source?
- Yes — mgechev/skills-best-practices is an open-source project tracked on heatdrop.
- What language is skills-best-practices written in?
- mgechev/skills-best-practices is primarily written in Python.
- How popular is skills-best-practices?
- mgechev/skills-best-practices has 2.1k stars on GitHub.
- Where can I find skills-best-practices?
- mgechev/skills-best-practices is on GitHub at https://github.com/mgechev/skills-best-practices.