Content File Validator
Use this skill when the user wants one reusable validation pass over documentation, Markdown, templates, or mixed content files that need both structural Markdown checks and YAML frontmatter validation.
When to use this combined validator
Run this skill when the request involves any of the following:
- validating Markdown quality or document structure
- checking heading order, duplicate headings, empty headings, or obvious Markdown problems
- checking malformed links or obviously broken local links where they can be verified safely
- enforcing required YAML frontmatter at the top of each file
- validating frontmatter against a configurable schema
- requiring a
versionfield that follows SemVerMAJOR.MINOR.PATCH - checking whether changed files appear to need a version increment when a base Git reference is available
- producing one consolidated validation report instead of separate Markdown and frontmatter reports
Do not use this skill for general prose critique, broad style editing, or auto-fixing content unless the user explicitly asks for that workflow.
Default scope and file types
By default, scan files/ recursively and include:
.md.mdx.html.php.twig.njk.liquid.yml.yaml
Allow configurable include and exclude globs. Use the built-in defaults unless the user narrows the scope.
How Markdown validation works
For Markdown-style files, validate:
- exactly one H1 when the file is document-style
- heading level order without jumps such as H2 to H4
- empty headings
- repeated headings when they look accidental
- malformed inline links
- obviously broken local file links when the target can be checked from the current filesystem
- trailing structural issues that make the document look unfinished or invalid
Use references/markdown-validation-rules.md as the source of truth for these checks and their intended interpretation.
How frontmatter validation works
For all matching files, validate that:
- the file begins with YAML frontmatter at the very top
- nothing appears before the opening
--- - the frontmatter parses safely as a YAML object
- required fields are present
- field types, enums, patterns, and property limits satisfy the schema
- unknown fields are allowed or rejected according to the schema
- per-file-type overrides are applied where the schema defines them
Use references/frontmatter.schema.yaml as the source of truth for metadata rules.
How SemVer version checks work
Every validated document must include:
version: "1.0.0"
Validate version as SemVer MAJOR.MINOR.PATCH.
When --enforce-version-increment and a usable --base-ref are provided:
- compare each changed file with the base reference when possible
- fail when file content changed but the
versionvalue did not change - warn when the file changed and the version changed, but the correct increment type cannot be inferred safely from the diff alone
- do not guess whether the change should be MAJOR, MINOR, or PATCH; ask the user to confirm the intended change type when it matters
Use references/semver-versioning-rules.md for the human rules behind version increments.
Inputs to confirm
Before validating, identify:
- the target directory to scan
- the schema file to use
- any include globs that narrow the scan
- any exclude globs that should be added to the defaults
- whether version increment checks should be enforced
- which base Git reference to compare against, when version-increment validation is requested
- whether the user wants report-only output or explicit fix suggestions
Default assumptions when the user does not specify them:
- target directory:
files/ - schema file:
references/frontmatter.schema.yaml - output format: consolidated Markdown report
- behaviour: validate and suggest fixes only
- overwrite policy: never modify files unless the user explicitly asks for that
Validation workflow
- Locate the target directory.
- Recursively collect matching files using the configured include and exclude globs.
- Validate YAML frontmatter placement and schema compliance.
- Validate Markdown structure for Markdown-like files.
- Validate the required
versionfield and SemVer pattern. - If version increment enforcement is enabled, compare current files against the supplied base reference when available.
- Produce one consolidated Markdown report covering summary metrics, failures, warnings, and suggested fixes.
- Only propose rewrites when the user explicitly asks for modification or auto-fix behaviour.
How to customise schemas
Customise metadata rules in references/frontmatter.schema.yaml instead of changing the validator logic.
Use references/schema-customisation.md to adapt:
- required fields
- enum values
- type rules
- property limits
- defaults used in suggested fixes
- per-file-type overrides
How to interpret reports
Treat the report in three layers:
- Markdown issues: structure, headings, links, or document-shape problems
- Frontmatter issues: missing, invalid, or non-compliant metadata
- Version issues: missing SemVer, invalid SemVer, or changed files without a visible version increment
Use references/example-validation-report.md when the user wants a concrete example of the consolidated report format.
When to suggest fixes
Suggest fixes when:
- a missing frontmatter field can be repaired safely from schema defaults or explicit placeholders
- a Markdown issue can be described clearly enough for a developer or editor to fix quickly
- a version issue is obvious, such as a missing
versionfield or unchanged version after a confirmed content change
Do not invent unknown metadata values or silently bump versions on the user's behalf.
When not to modify files
Never modify files by default.
Do not overwrite files unless the user explicitly asks for rewrite or auto-fix behaviour. Even then:
- keep a preview of proposed changes
- avoid changing content beyond the validated issue scope
- do not guess the correct SemVer increment when the change type is ambiguous
Supporting Files
scripts/validate_content_files.py— consolidated validator for Markdown, frontmatter, and SemVer/version-increment checks.references/frontmatter.schema.yaml— metadata schema and SemVer requirements.references/markdown-validation-rules.md— Markdown structure rules and check explanations.references/semver-versioning-rules.md— versioning guidance for MAJOR, MINOR, and PATCH decisions.references/schema-customisation.md— schema customisation examples.references/example-validation-report.md— example consolidated report.tests/— example files for validating the merged skill behaviour.
_Maintained with ❤️ by the 🚀 LightSpeedWP Automation Team_