home / skills / louloulin / claude-agent-sdk / skill-validator

This skill validates SKILL.md files for format, completeness, and best practices, ensuring reliable documentation and easier collaboration.

npx playbooks add skill louloulin/claude-agent-sdk --skill skill-validator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
4.4 KB
---
name: skill-md-validator
description: "Validates SKILL.md files for format, completeness, and best practices"
version: "1.0.0"
author: "Documentation Team <[email protected]>"
tags:
  - validation
  - documentation
  - quality
  - tooling
dependencies: []
---

# SKILL.md Validator

A utility for validating SKILL.md files to ensure they follow best practices and are complete.

## What It Checks

### Required Fields
- `name:` - Skill name (required)
- `description:` - Skill description (required)
- `version:` - Semantic version (required)

### Format Validation
- YAML frontmatter starts with `---`
- YAML frontmatter ends with `---`
- Proper YAML syntax
- Valid semantic version

### Content Validation
- Content exists after frontmatter
- Minimum content length (50 characters)
- Contains Markdown headers
- No obvious formatting issues

## Usage

### Basic Validation
```bash
./validate_skill.sh path/to/SKILL.md
```

### Validate All Skills
```bash
for skill in examples/.claude/skills/*/SKILL.md; do
    echo "Validating $skill..."
    ./validate_skill.sh "$skill"
    echo
done
```

### Integration with CI/CD
```yaml
# .github/workflows/validate-skills.yml
name: skill-md-validator

on: [push, pull_request]

jobs:
  validate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - name: Validate SKILL.md files
        run: |
          for skill in examples/.claude/skills/*/SKILL.md; do
            ./examples/.claude/skills/skill-validator/validate_skill.sh "$skill"
          done
```

## Validation Output

### Success Example
```
šŸ” Validating code-reviewer/SKILL.md...

āœ… YAML frontmatter starts correctly
āœ… YAML frontmatter formatted correctly
āœ… Found required field: name:
āœ… Found required field: description:
āœ… Found required field: version:
āœ… Content present (2540 characters)
āœ… Contains Markdown headers

šŸŽ‰ Validation complete! SKILL.md looks good.
```

### Failure Example
```
šŸ” Validating bad-example/SKILL.md...

āŒ Missing YAML frontmatter start (---)

Validation failed. Please fix the issues above.
```

## Best Practices

### Writing SKILL.md Files

1. **Start with YAML frontmatter**
   ```markdown
   ---
   name: "My Skill"
   description: "What this skill does"
   version: "1.0.0"
   ---
   ```

2. **Add meaningful content**
   - Include clear instructions
   - Provide examples
   - Use proper Markdown formatting
   - Add sections with headers

3. **Follow naming conventions**
   - Use kebab-case for skill IDs
   - Use semantic versioning
   - Be descriptive but concise

4. **Include metadata**
   - Author information
   - Relevant tags
   - Dependencies on other skills

## Common Issues

### Missing Required Fields
```
āŒ Error: Missing required field: name:

Fix: Add the name field to YAML frontmatter
---
name: skill-md-validator
---
```

### Invalid YAML
```
āŒ Error: YAML parsing error

Fix: Ensure proper YAML syntax
- Use spaces for indentation (not tabs)
- Quote strings with special characters
- Properly format lists
```

### Insufficient Content
```
āš ļø  Warning: Content seems very short (< 50 chars)

Fix: Add more detailed instructions and examples
```

## Integration Examples

### Pre-commit Hook
```bash
#!/bin/bash
# .git/hooks/pre-commit

for file in $(git diff --cached --name-only | grep SKILL.md); do
    if ! ./examples/.claude/skills/skill-validator/validate_skill.sh "$file"; then
        echo "āŒ Validation failed for $file"
        exit 1
    fi
done
```

### Makefile Target
```makefile
# Makefile

.PHONY: validate-skills
validate-skills:
	@echo "Validating all SKILL.md files..."
	@for skill in examples/.claude/skills/*/SKILL.md; do \
		./examples/.claude/skills/skill-validator/validate_skill.sh "$$skill"; \
	done
```

## Extending the Validator

You can extend this validator to check for:

1. **Custom fields**
   ```bash
   if ! grep -q "author:" "$SKILL_FILE"; then
       echo "āš ļø  Warning: Missing author field"
   fi
   ```

2. **Code examples**
   ```bash
   if ! grep -q '```' "$SKILL_FILE"; then
       echo "āš ļø  Warning: No code examples found"
   fi
   ```

3. **Tag conventions**
   ```bash
   tags=$(sed -n '/^---$/,/^---$/p' "$SKILL_FILE" | grep "^tags:" | tail -n +1)
   if [ -z "$tags" ]; then
       echo "āš ļø  Warning: No tags defined"
   fi
   ```

## Related Tools

- [yamllint](https://yamllint.readthedocs.io/) - YAML linter
- [markdownlint](https://github.com/igorshubovych/markdownlint-cli) - Markdown linter
- [vale](https://vale.sh/) - Prose linter for documentation

Overview

This skill validates skill metadata files for correct frontmatter, structure, and content quality. It checks required fields, YAML syntax, semantic versioning, and basic Markdown formatting to ensure documentation is complete and consistent. Use it to catch formatting and content issues early in CI or local workflows.

How this skill works

The validator parses the file frontmatter to confirm required keys (name, description, version) and verifies YAML formatting and semantic version correctness. It then inspects the body for minimum length, presence of Markdown headers, code blocks, and obvious formatting problems, and emits clear pass/fail messages and actionable warnings. The tool can run on a single file or iterate over many files for batch validation.

When to use it

  • Before merging changes that touch skill metadata or documentation
  • As a CI step to prevent malformed or incomplete skill manifests
  • During local development to verify latest edits meet format rules
  • When onboarding new contributors to enforce consistent documentation

Best practices

  • Always include required frontmatter keys: name, description, version
  • Use semantic versioning (MAJOR.MINOR.PATCH) for the version field
  • Keep descriptive content with examples and Markdown headers (>=50 chars)
  • Quote values with special characters and use spaces for YAML indentation
  • Run the validator in CI and as a pre-commit hook to catch issues early

Example use cases

  • Run a single-file validation: validate the metadata for one skill before publishing
  • Batch validate all skills in a repository as part of a CI pipeline
  • Fail pull requests when required fields are missing or YAML is invalid
  • Add the validator to a pre-commit hook to block commits with formatting errors

FAQ

What required fields are enforced?

The validator checks for name, description, and version in the frontmatter.

How does it handle YAML parsing errors?

It reports parsing errors with a brief message and highlights that proper YAML syntax must be used (spaces over tabs, quoted strings when needed).

Can it be integrated into CI?

Yes. The validator is designed to run in CI workflows and can iterate over multiple files to fail a job on validation errors.