docs-validate-code-samples

docs-validate-code-samples is a skill for Claude Code from elastic/elastic-docs-skills. It costs 55 tokens per session (6,037 once invoked), scanned A, original, Apache-2.0.

A documentation checker for code examples in Markdown files. It verifies details such as language labels, callouts, JSON format, ES|QL queries, and Painless scripts.

In plain words
What is it for?
Use it to audit code blocks in Elastic documentation before review, while writing new examples, or when checking a whole directory of Markdown files.
Why use it?
It catches example errors that can confuse readers or make copied code fail. It reports the issues and leaves the documentation unchanged.

Skill for Claude Code ✓ vendor

Written for Claude Code: allowed-tools in frontmatter.

Part of the elastic-docs-skills plugin — 26 skills, 1 agent shipped together

Good fit Use it to audit code blocks in Elastic documentation before review, while writing new examples, or when checking a whole directory of Markdown files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/elastic/elastic-docs-skills/docs-validate-code-samples
About the project

Elastic Docs Skills is a collection of Claude Code skills for creating and maintaining Elastic documentation. It is for developers and documentation contributors who use coding agents such as Claude Code, Cursor, or Codex. The catalogue entries are the project's reusable documentation workflows, agents, plugin, and instruction.

elastic/elastic-docs-skills · 72 stars · on GitHub · elastic.github.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add elastic/elastic-docs-skills --skill docs-validate-code-samples
Clone the repo
git clone --depth 1 https://github.com/elastic/elastic-docs-skills

Made for: Claude Code.

Or install elastic-docs-skills, the plugin that ships this one along with the rest of its 26 skills, 1 agent.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for docs-validate-code-samples

README.md
[![agentmods](https://agentmods.dev/badge/skills/elastic/elastic-docs-skills/docs-validate-code-samples/github.svg)](https://agentmods.dev/skills/elastic/elastic-docs-skills/docs-validate-code-samples)
Your own site
<a href="https://agentmods.dev/skills/elastic/elastic-docs-skills/docs-validate-code-samples"><img src="https://agentmods.dev/badge/skills/elastic/elastic-docs-skills/docs-validate-code-samples/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for docs-validate-code-samples

Your own site · 80×15
<a href="https://agentmods.dev/skills/elastic/elastic-docs-skills/docs-validate-code-samples"><img src="https://agentmods.dev/badge/skills/elastic/elastic-docs-skills/docs-validate-code-samples.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 55 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 6,037 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Prompt Injection · line 13
    Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
    Fix: Audit all comments and invisible characters. Remove any instructions that direct the agent to perform unauthorized actions. Use plain, reviewable content.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00055 $0.06037
Opus 5.5 $0.00022 $0.02415
Sonnet 5.5 $0.00011 $0.01207
Haiku 4.5 $0.00006 $0.00604

Measured 1mo ago against content hash 365f20b3add3, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

docs-validate-code-samples scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

**A-1 (Low): empty info string.** Flag any block whose info string is empty. Infer the identifier from the content when it is unambiguous: an HTTP method line (`GET`, `PUT`, `POST`, `DELETE`, `HEAD`) means `console`; a b
skills/review/docs-validate-code-samples/SKILL.md · 283 lines

How it starts

The opening of the file, as written. The whole thing — 283 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are a code sample validator for Elastic documentation. Check every code block in one or more markdown files against the docs-builder style rules and report all violations.

Never modify documentation source files. Only analyze and report.


Step 1: Resolve files

Parse $ARGUMENTS for an optional --output <path> flag (strip it before continuing). Resolve the target:

  • Single .md file — analyze that file only.
  • Directory — find all .md files recursively with find <dir> -name "*.md" -type f | sort.
  • Glob — expand with bash -O globstar -c 'printf "%s\n" <glob>'.
  • No argument — ask: "Please provide a file path, directory, or glob pattern."

Step 2: Extract code blocks

Find blocks with the extract_fences.awk script that ships with this skill (in scripts/, next to this file) instead of grepping for fence lines. Grep cannot tell an opening fence from a closing one, and it mispairs nested fences. <skill-dir> below is the directory that contains this SKILL.md (the base directory shown when the skill loads). Run it with Bash over every resolved file (pass the file list as arguments):

awk -f <skill-dir>/scripts/extract_fences.awk <files>

Read the full file on GitHub · 283 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +65 lines 365f20b3add3
  2. 2mo ago Changed 93189913cd97
  3. 3mo ago First seen · 218 lines · 55 tokens per session scan A 199459a011bc

Subscribe to this mod's changes

docs-validate-code-samples is a skill published in the GitHub repository elastic/elastic-docs-skills (72 stars, last pushed today), licensed Apache-2.0. It adds 55 tokens to every session and 6,037 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

docs-validate-code-samples compared with skills from other repositories

docs-validate-code-samples next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
docs-validate-code-sampleselastic/elastic-docs-skillsSkill72todayApache-2.0A55Claude Code
pdfagentscope-ai/QwenPawSkill38ktodayApache-2.0A95Claude Code, Codex
officecliiOfficeAI/OfficeCLISkill34k3d agoApache-2.0A56Claude Code, Codex
office-file-processxstongxue/best-skillsSkill3.3k11d agoApache-2.0A209Claude Code, Codex
huashu-md-to-pdfalchaincyf/huashu-skillsSkill2.4k4d agoMITA83Claude Code, Codex
mxl-decompileNikolay-Shirokov/cc-1c-skillsSkill849yesterdayMITA39Claude Code
officecli-data-dashboardiOfficeAI/OfficeCLISkill34k3d agoApache-2.0C159Claude Code, Codex