All skills
wordpress avatar

/wp-block-development

@20324d2 official
by wordpresswordpress/agent-skills2.2k stars
327

Use when developing WordPress (Gutenberg) blocks: block.json metadata, register_block_type(_from_metadata), attributes/serialization, supports, dynamic rendering (render.php/render_callback), deprecations/migrations, viewScript vs viewScriptModule, and @wordpress/scripts/@wordpress/create-block build and test workflows.

Use this Skill: https://skilld.dev/gh/wordpress/agent-skills/wp-block-development

This session only. Nothing lands on disk.

referencesdebugging.md

≈343 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Debugging quick routes

Block doesn’t appear in inserter

  • Confirm block.json name is valid and the block is registered.
  • Confirm build output exists and scripts are enqueued.
  • If using PHP registration, confirm register_block_type_from_metadata() runs (wrong hook/file not loaded is common).

“This block contains unexpected or invalid content”

  • You changed saved markup or attribute parsing.
  • Add deprecated versions and a migration path.
  • Reproduce with an old post containing the previous markup.

Attributes not saving

  • Confirm attribute definition matches actual markup.
  • If the value is in delimiter JSON, avoid brittle selectors.
  • Avoid meta attribute source (deprecated).

Console warnings about apiVersion (WordPress 6.9+)

If you see "The block 'namespace/block' is registered with API version 2 or lower":

  • Update apiVersion to 3 in block.json.
  • This warning only appears when SCRIPT_DEBUG is true.
  • WordPress 7.0 will require apiVersion 3 for proper iframe editor support.

Styles not applying in editor (apiVersion 3 / iframe)

If styles work on frontend but not in the editor:

  • Ensure style handles are declared in block.json (editorStyle, style).
  • Styles not included in block.json won't load inside the iframed editor.
  • Check for Dashicons or other dependencies that need explicit inclusion.

Source: SKILL.md on GitHub

1 warning16d5 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill is a legitimate development assistant for WordPress block development. It includes instructions and a utility script to help developers manage block metadata, registration, and build workflows using official WordPress tools and documentation. No malicious patterns or security vulnerabilities were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    12/12 files flagged

  • ZeroLeaks5mo

    Score: 93/100 · 2 sections analyzed

Signed by skilld at 20324d2. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 3 months ago
Other metadata
compatibility
Targets WordPress 7.0+ (PHP 7.4.0+). Filesystem-based agent with bash + node. Some workflows require WP-CLI.
  • React
  • wordpress
  • gutenberg
  • block-development
  • block-json
  • php
  • javascript
  • wp-scripts
  • dynamic-rendering
  • deprecations

README badge

README badge for wordpress/agent-skills/wp-block-development

Guides block development for WordPress 6.9+ using Gutenberg, covering block.json metadata, PHP registration, static vs dynamic rendering, attributes/serialization, deprecations, and @wordpress/scripts build workflows. Targets developers working with block.json, register_block_type, render.php, and the Block Editor's wrapper patterns.

Generated from the current SKILL.md.

Does this skill work with WordPress versions before 6.9?
The skill targets WordPress 6.9+ (PHP 7.2.24+). Blocks with apiVersion 2 or lower will trigger console warnings on 6.9, and WordPress 7.0 will run the editor in an iframe regardless of block apiVersion, so migration to apiVersion 3 is recommended.
Can I use this skill for dynamic blocks with server-side rendering?
Yes. The skill covers dynamic rendering via render.php or render_callback in block.json, including best practices for wrapper attributes with get_block_wrapper_attributes().
Does this skill handle block deprecations and migrations?
Yes. The skill provides guidance on adding deprecated entries, writing save() functions for old versions, and using migrate() to normalize attributes when you change saved markup or attributes.
What build tools does this skill support?
The skill assumes you're using whatever build tooling the repo already has in place, typically @wordpress/scripts or @wordpress/create-block. It also covers wp-env for local WordPress development and E2E testing.
Does this skill require WP-CLI?
Some workflows require WP-CLI, but it is not always necessary. The skill uses filesystem-based agent work with bash and node as the primary approach.

Generated from the current SKILL.md. These answers refresh after source changes.