/validate-block-markup:validate-block-markupfrom Validate Block Markup
Validates, diagnoses, and repairs standalone WordPress Gutenberg block markup built from core blocks using a pinned Node.js runtime. Useful when debugging invalid block content or 'Attempt Block Recovery' prompts.
Ships in Validate Block Markup. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Check serialized block markup against the WordPress core block library running in Node.js. Treat structural validity and cross-site portability as separate verdicts, and treat review and repair as separate jobs.
Verdicts are produced against the core block definitions shipped with WordPress 7.0.2. Always tell the user which snapshot the verdict came from.
npm on PATH.npm ci of 350 packages, about 545 MB on disk, roughly 25 seconds, and it needs npm registry access. Later runs are offline and instant. --help and --version answer immediately and install nothing.package.json, no lockfile changes, nothing written to a project-level node_modules. Everything lands in <skill-directory>/node_modules/.npx skills add layout puts this skill inside the user's repository, so those 545 MB land in their repo tree. Say so before the first run. The skill ships a .gitignore covering node_modules/ and rewrites it before installing if it went missing, so git stays clean without the user doing anything.@wordpress/* packages, licensed GPL-2.0-or-later. The skill's own code is MIT.scripts/validate-block-markup.cjs. Do not import the module into your own process.The executable bootstraps itself. Before loading the validator it checks <skill-directory>/node_modules/ for four pinned packages and, if any is absent or at a different version, runs this in the skill directory:
npm ci --omit=dev --ignore-scripts --no-audit --no-fund
| Package | Pinned version |
|---|---|
@wordpress/blocks | 15.13.1 |
@wordpress/block-library | 9.40.2 |
@wordpress/block-serialization-default-parser | 5.40.1 |
jsdom | 26.1.0 |
The pins the executable enforces live in a hardcoded map inside scripts/validate-block-markup.cjs, duplicated from package.json. When bumping a version, change both — they are not read from each other.
Bootstrap progress goes to stderr. If npm, registry access, or a writable skill directory is unavailable, the command exits 2; stop and report that validation could not run. Never run the install in the user's project.
node <skill-directory>/scripts/validate-block-markup.cjs [options] [<file|directory|->...]
- reads stdin. Stdin is also the default when no path is given..html files directly inside it, in sorted order. Scanning is not recursive and ignores every other extension, so pointing at a tree silently validates a subset. Pass files explicitly when the tree matters.-- treats every following argument as a path.-h / --help prints usage. -v / --version prints the skill version and the pinned WordPress snapshot.0 and 1, stdout is nothing but a parseable JSON array — one report per input source. Bootstrap noise and all diagnostics go to stderr. Parse stdout, ignore stderr.Exit codes:
| Code | Meaning |
|---|---|
0 | Every input source passed. |
1 | Findings contain at least one error. |
2 | Usage or input error — unreadable path, unknown option, no input sources found (including a directory with no .html files), or no input given while stdin is a terminal. |
Use this whenever the request is to validate, check, review, or diagnose. Do not modify the user's markup in this mode.
.html file, or pipe it on stdin.valid, every error, every warning, and every entry in notChecked. Never describe a notChecked item as verified.wordpressVersion) the verdict applies to.canonicalMarkup appears when parse-then-serialize changed the input. Offer it as a suggestion. Never silently substitute it for what the user supplied.Use this only when the user asked for markup to be fixed, or when you generated the markup yourself.
valid is true.Errors — these make valid false:
no-blocks: the input produced zero blocks. Check the file is not empty and actually contains block comments.malformed-attribute-json: the JSON in an opening delimiter does not parse. Fix the JSON. Carries line, not path.freeform-html: content fell through as freeform/classic HTML. Wrap it in a core block.unregistered-block: the block is not in the pinned core library. Replace it with a core block.missing-block: the markup already contains a core/missing placeholder, so the editor that produced it did not recognize the original block. Rebuild that section from core blocks; the original block cannot be recovered here.invalid-saved-content: the saved HTML does not match the registered core save implementation — this is what produces "Attempt Block Recovery" in the editor. Read the issues array for the exact mismatch, then fix the opening attributes and the saved HTML together.nonportable-core-block: a core block that depends on post, query, comment, taxonomy, template, authentication, or site-setting context. Replace it with static content.site-entity-id: an attachment, author, post, term, navigation, or reusable-block database ID. Remove the ID and any class derived from it.root-relative-url: an href or src starting with a single /. Use a genuinely portable URL, or disclose the destination-site dependency.missing-fragment-target: a #anchor link with no matching id in the same input. Add the anchor or drop the link.non-idempotent-serialization: a second parse-then-serialize pass changed the canonical markup, so the markup is unstable across editor round-trips and will keep drifting every time it is opened and saved. There is no patch for this — rebuild the affected blocks from scratch.Warnings — these do not affect valid:
noncanonical-serialization: WordPress canonicalized the input. Always emitted at warning level; it never escalates. Compare against canonicalMarkup and let the user decide.theme-dependent-style: preset or style attributes whose appearance depends on the destination theme. Keep only if the user accepts that.custom-class: a custom CSS class that may not exist on the destination site. Same call.valid: true Does Not Meanvalid: true means the markup parses, matches the core save implementations, and carries no cross-site portability error. It is not a publication-safety verdict.
href/src values beginning with a single /, and # fragments with no matching id. javascript: and data: URLs, event-handler attributes such as onclick, and inline <script> all pass unflagged.notChecked array with every verdict, not just when something fails.See references/validation-contract.md for the full report schema, finding field shapes, portability policy, and limitations.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nathanonn/agent-skills --plugin validate-block-markupOther plugins' skills for the same job