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.

referencesregistration.md

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

Registration patterns (PHP-first)

Use this file when you need to register blocks robustly across repo types (plugin/theme/site).

Prefer metadata registration

Prefer:

  • register_block_type_from_metadata( $path_to_block_dir, $args = [] )

Why:

  • keeps metadata authoritative (block.json)
  • supports dynamic render (render) and other metadata-driven fields
  • enables cleaner asset handling

Upstream reference:

Where to register

  • Plugins: register on init in the main plugin bootstrap or a dedicated loader.
  • Themes: register on init (or after_setup_theme if you need theme supports first), but keep it predictable.

Dynamic render mapping

If block.json includes render, ensure the file exists relative to the block root. Inside the render file, use get_block_wrapper_attributes() for wrapper attributes.

Source: SKILL.md on GitHub

1 warning17d5 checks · Risk SAFE
  • Gen Agent Trust Hub17d

    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.

  • Socket17d

    No alerts

  • Snyk17d

    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.