check-code-examples

Checks code examples in MDX files for summaries, completeness, and realistic values.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the common issue of inconsistent or vague code examples in documentation. It enforces summaries, completeness, realistic values, and adherence to WAF (Well-Architected Framework) patterns for Terraform, Packer, and related tools to improve learning and implementation accuracy.

Core Features & Use Cases

  • Enforces code block summaries: ensures each code block is prefixed with a 1-2 sentence description of purpose.
  • Checks for completeness: validates required elements (e.g., provisioners, data sources, backends) exist and are realistic.
  • Promotes realistic values: discourages hard-coded placeholders and encourages data-driven configurations.
  • Supports review workflows: integrates with CI or documentation review to flag issues for manual fixes.
  • Real-world use case: when a doc includes a Terraform example, this skill verifies you can reference the data source and show backend configuration.

Quick Start

Use the /check-code-examples command to scan a file, e.g. /check-code-examples docs/deploy.mdx, and optionally run with --fix to auto-add basic summaries.

Frequently Asked Questions about check-code-examples

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

FAQPage Schema
How do I validate Terraform code examples in documentation?

Validating Terraform code examples involves checking MDX files for summaries, completeness, and realistic values. This skill scans your documentation to enforce quality criteria and Well-Architected Framework patterns for embedded snippets.

What's the best way to add summaries to code blocks in MDX files?

Adding summaries to code blocks in MDX files can be automated using a --fix command option. This auto-inserts basic 1-2 sentence descriptions of the code's purpose, while leaving deeper structural edits to human reviewers.

Does this documentation checker work with Packer configurations?

Yes, this documentation checker works with Packer configurations alongside Terraform and related tooling. It reviews embedded Packer demonstrations to verify required elements and discourage hard-coded placeholders.

How do I enforce Well-Architected Framework patterns in documentation code snippets?

Enforcing Well-Architected Framework patterns in documentation requires verifying that code examples use data-driven configurations and realistic values. This skill flags snippets missing provisioners or backends for manual correction.

Can I integrate code example validation into a CI review workflow?

Yes, you can integrate code example validation into CI or documentation review workflows. By passing file-path arguments to the scanner, it automatically flags incomplete snippets and missing summaries for manual fixes during the review process.

What are the limitations of auto-fixing documentation code blocks?

The limitation of auto-fixing documentation code blocks is that the --fix option only inserts basic summaries. It does not perform deeper edits or resolve complex structural issues, leaving those manual corrections to human reviewers.