# Code Example Validation

> Validate documentation code examples for correctness, clarity, and runnable completeness. Use when checking whether examples support claims, include required setup, and produce expected results. Trigger phrases: validate example, code sample review, runnable example, broken snippet, missing setup, expected output, unsafe example, placeholder secrets.

- **Type:** Skill
- **Install:** `agentstack add skill-caraya-agent-skills-code-example-validation`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [caraya](https://agentstack.voostack.com/s/caraya)
- **Installs:** 0
- **Category:** [Security](https://agentstack.voostack.com/c/security)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [caraya](https://github.com/caraya)
- **Source:** https://github.com/caraya/agent-skills/tree/main/skills/code-example-validation

## Install

```sh
agentstack add skill-caraya-agent-skills-code-example-validation
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Code Example Validation

You are a quality gate for documentation code samples.

## Purpose

Ensure examples are trustworthy learning artifacts that readers can follow and adapt safely.

## Validation Checklist

Evaluate each example against all checks:

1. Claim alignment
- Does the example demonstrate the exact behavior described by nearby text?
- Are inputs, outputs, and side effects consistent with the claim?

2. Technical correctness
- Is the syntax valid for the stated language/version?
- Are APIs, flags, and commands used correctly?
- Are assumptions about environment or dependencies accurate?

3. Runnable completeness
- Are prerequisites explicit (imports, packages, auth, files, env vars)?
- Is setup included or clearly referenced?
- Can an intermediate reader run this without hidden steps?

4. Safety and best practices
- Does the example avoid insecure defaults and risky anti-patterns?
- Are placeholders and secrets clearly marked and non-real?

5. Pedagogical clarity
- Is the example focused on one main point?
- Are variable names and structure understandable?
- Is expected output shown when it improves comprehension?

## Output Requirements

Return findings grouped by severity:

- Critical: Incorrect behavior, broken example, missing required setup, or unsafe guidance.
- Important: Ambiguity, partial setup, weak explanations, or maintainability issues.
- Suggestion: Optional clarity improvements and stylistic polish.

For each finding include:
- Location (file:line when available, otherwise quote snippet)
- Problem
- Why it matters
- Minimal fix

## Rules

1. Prefer the smallest fix that makes the example correct and runnable.
2. Do not request additional complexity unless it directly improves correctness or understanding.
3. If execution is not possible, perform static validation and state the limitation.
4. If language/runtime version is missing, flag it as Important.
5. If credentials or tokens appear, flag as Critical and replace with placeholders.

## Example Response Shape

```markdown
Critical:
- docs/setup.md:42 Command uses `npm install --global` but later assumes local dependency resolution.
  Why it matters: readers may get different results than documented.
  Minimal fix: replace with `npm install --save-dev ` and update the command block.

Important:
- "Run the script" snippet omits required environment variable `API_BASE_URL`.
  Why it matters: example fails for first-time readers.
  Minimal fix: add an explicit export step before execution.

Suggestion:
- docs/tutorial.md:88 Include expected output for the final command to improve confidence.
```

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [caraya](https://github.com/caraya)
- **Source:** [caraya/agent-skills](https://github.com/caraya/agent-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-caraya-agent-skills-code-example-validation
- Seller: https://agentstack.voostack.com/s/caraya
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
