All skills
automattic avatar

/wp-block-development

@ad7156c official
by automatticautomattic/agent-skills211 stars
37

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/automattic/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 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The skill is a legitimate tool for WordPress block development authored by Automattic. It provides standard workflows and utility scripts to manage and develop blocks. No security risks were identified.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    12/12 files flagged

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

Last checked against GitHub 5 months ago.

Dormantupdated 9 months ago
Other metadata
compatibility
Targets WordPress 6.9+ (PHP 7.2.24+). 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 automattic/agent-skills/wp-block-development

Develops WordPress Gutenberg blocks: creates block.json metadata, handles block registration, static/dynamic rendering, attribute serialization, and deprecations. Targets WordPress 6.9+ with PHP 7.2.24+ and includes workflows for @wordpress/scripts, @wordpress/create-block, and block migrations.

Generated from the current SKILL.md.

What WordPress versions does this skill support?
WordPress 6.9+ with PHP 7.2.24+. The skill assumes apiVersion 3 in block.json, which is enforced in WordPress 6.9 and required for correct behavior in the iframed editor coming in WordPress 7.0.
Does this skill handle both static and dynamic blocks?
Yes. It covers static blocks (markup saved to post content), dynamic blocks (server-rendered via render.php or render_callback), and interactive blocks using viewScriptModule or the Interactivity API.
What happens if I change a block's saved markup without adding a deprecation?
Existing blocks in posts will show as invalid. You must add a deprecated entry with the old save pattern and an optional migrate function to normalize attributes when the schema changes.
Does this skill require WP-CLI or specific build tools?
Some workflows require WP-CLI. Build tooling depends on what the repo already uses — typically @wordpress/scripts or @wordpress/create-block — but the skill works with whatever is present.

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