agentleFS
jaakkokorhonenjaakkokorhonen/claude-skills/skills/document-validator/SKILL.md

document-validator

Skill0 starsChanged 4 months agoApache-2.0View on GitHub

Unified linter that validates both YAML frontmatter schemas and Markdown style best practices (heading nesting, blank line spacing, trailing whitespace, end-of-file newlines) across all repository documentation.

  • Installs packages

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Run it locally via the Claude client skill, or directly from the command line, before committing — see the repo root README.md's "No CI …

    line 9
  2. Distinctive:

    Trailing Whitespace: No line may end with trailing space or tab characters.

    line 37
  3. Very specific:

    Add it to the appropriate group in CONTRIBUTING.md's Tag Taxonomy section.

    line 54
  4. Very specific:

    Add it to the matching group in TAG_TAXONOMY in document_validator.py, in the same commit.

    line 55
  5. Very specific:

    All files in the skills/ directory are fully skipped (frontmatter and style) — they're this skill's own meta-docs.

    line 73

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill: document-validator

Unified validator for YAML frontmatter schemas and Markdown style best practices in this repository. Run it locally via the Claude client skill, or directly from the command line, before committing — see the repo root README.md's "No CI merge gate" note: there is currently no GitHub Actions workflow running this.

Contents

  • What it checks
  • Tag taxonomy
  • Files excluded from validation
  • Running locally
  • Known issue fixed: Marp double-frontmatter
  • Extending the schema

What it checks

1. Frontmatter Validation

  • Checks for required fields: title, tags, category, type, status, version, review_owner, review_interval_days, last_reviewed, next_review, changelog, classification.
  • Checks values of status, type, classification against allowed enumerations.
  • Enforces sop_id when type: sop.
  • Enforces DPO approval fields (approved_by, approved_date) when status: published and type: policy (this includes compliance documents like DPIA.md, which uses type: policy — there is no separate filename-based check).
  • Enforces date math checks: next_review == last_reviewed + review_interval_days (+-3 day tolerance).
  • Enforces tag taxonomy matching.

2. Markdown Style Validation

  • Heading Nesting Hierarchy: Heading levels must only increment by 1 level at a time (e.g. H2 followed by H3, H4; H3 cannot directly follow H1).
  • Blank Line Spacing: Headings must be surrounded by blank lines. (Skipped for Marp slides).
  • End-of-File Newline: Files must end with exactly one newline character (no trailing empty lines).
  • Trailing Whitespace: No line may end with trailing space or tab characters. (Skipped inside fenced code blocks).

Tag taxonomy

TAG_TAXONOMY / ALLOWED_TAGS in document_validator.py must always mirror the Tag Taxonomy section in the repo root CONTRIBUTING.md — same rule as ALLOWED_TYPES/ALLOWED_STATUSES (see Extending the schema below): two independent, hand-maintained copies of the same list, updated together in one commit.

An unknown tag fails the check with an actionable error naming the offending tag, the full allowed list, and where to add a new one.

To add a new tag:

  1. Add it to the appropriate group in CONTRIBUTING.md's Tag Taxonomy section.
  2. Add it to the matching group in TAG_TAXONOMY in document_validator.py, in the same commit.

Files excluded from validation

The following files are exempt from the frontmatter schema requirement only (they are repository/tooling infrastructure, not operational SOPs/guides, so they legitimately have no YAML frontmatter) — but Markdown style rules (heading blank lines, trailing whitespace, EOF newline, heading nesting) still apply to them like any other .md file, and --fix corrects them too:

  • README.md
  • CONTRIBUTING.md
  • CHANGELOG.md
  • AGENTS.md
  • CODE_OF_CONDUCT.md
  • SECURITY.md

All files in the skills/ directory are fully skipped (frontmatter and style) — they're this skill's own meta-docs.


Running locally

Requires Python 3.9+ and PyYAML.

# Install dependencies
pip install -r skills/document-validator/requirements.txt

# Run linter on the current directory
python skills/document-validator/document_validator.py

# Run on a specific path
python skills/document-validator/document_validator.py path/to/folder

# Run unit tests
pip install -r skills/document-validator/requirements-dev.txt
pytest skills/document-validator/tests/ -v

Known issue fixed: Marp double-frontmatter

service-overview-presentation.md previously had two --- blocks — the standardised frontmatter block followed by the original Marp block (marp: true, theme: default, paginate: true). Marp only reads the first --- block, so marp: true was silently ignored and the file no longer rendered as a slide deck.

Fix: merge both YAML blocks into one — put marp, theme, and paginate inside the same frontmatter block as title, tags, etc. See service-overview-presentation.md for the current source of truth.

The duplicate-block detector only flags a genuine second YAML mapping after the first --- close — a document body that simply opens with a Markdown horizontal rule (--- followed by prose) is not flagged.


Extending the schema

ALLOWED_TYPES, ALLOWED_STATUSES, and TAG_TAXONOMY in this script must always mirror the type, status, and Tag Taxonomy sections documented in the repo root CONTRIBUTING.md. They are independent, hand-maintained copies of the same schema — if you change one without the other, the validator will start rejecting (or silently accepting) values that disagree with the documented contract. Update both in the same commit.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.