extract-examples

Extract, validate, and export code examples from Markdown/MDX documentation.

78|252|Updated Feb 7, 2024
One-click install
npx skills add https://github.com/hashicorp/web-unified-docs --skill extract-examples
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: extract-examples
Source: https://github.com/hashicorp/web-unified-docs/tree/main/content/well-architected-framework/docs/.claude/skills/extract-examples
Command: npx skills add https://github.com/hashicorp/web-unified-docs --skill extract-examples

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the extraction, validation, and export of code examples from documentation, reducing manual effort and ensuring consistency across docs.

Core Features & Use Cases

  • Code Block Discovery and Extraction: scans Markdown/MDX docs for fenced code blocks and captures language and content.
  • Syntax Validation and Quality Checks: validates HCL/Terraform, YAML, JSON, and Shell syntax, and flags placeholders or incomplete examples.
  • Export and Testing Readiness: exports runnable samples organized by language and optionally generates test harnesses for CI workflows.

Quick Start

Run the extraction on your docs to pull code examples and prepare them for validation and export: /extract-examples docs/**/*.mdx --validate --export /tmp/examples/

Frequently Asked Questions about extract-examples

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I extract code examples from Markdown documentation?

To extract code examples from Markdown documentation, you scan fenced code blocks across MDX files to capture language tags and content automatically. This process pulls runnable samples from your docs without manual copy-pasting.

Can I validate Terraform and YAML syntax in documentation code blocks?

Yes, you can validate HCL/Terraform, YAML, JSON, and Shell syntax in documentation code blocks. Syntax validation checks structural correctness and flags incomplete examples or placeholders to ensure documentation accuracy.

What is the best way to prepare documentation code samples for CI testing?

The best way to prepare documentation code samples for CI testing is to export them organized by language into a test-ready format. This automatically generates test harnesses for CI workflows directly from your MDX files.

Does this code block extraction work with MDX files?

Yes, code block extraction works with MDX files. It specifically targets Markdown and MDX content across documentation directories to discover fenced code blocks and capture their language and content.

How do I detect placeholders in documentation code examples?

To detect placeholders in documentation code examples, you run automated syntax validation and quality checks against the extracted code. This process flags placeholders and incomplete examples to prevent test failures.