Wp Block Development
WordPressOfficialPublished by WordPress
- Skill
- Tool integration
- Software development
- GPL-2.0-or-later
- Low risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
This skill provides a structured approach to WordPress block development, covering the full lifecycle from scaffolding and metadata configuration to dynamic rendering and migration strategies. It emphasizes modern best practices like apiVersion 3, proper attribute handling, and the use of the Interactivity API, while offering troubleshooting steps for common issues like invalid blocks or persistence failures.
What it does
- Scaffolds new blocks using standard WordPress tooling.
- Guides the configuration of block.json metadata and asset management.
- Assists in implementing static and dynamic block rendering patterns.
- Provides strategies for handling block deprecations and content migrations.
- Offers debugging workflows for attribute persistence and block invalidation errors.
- Supports integration of modern features like viewScriptModule and the Interactivity API.
When to use it
- When creating a new custom block for a WordPress plugin or theme.
- When updating existing block metadata or changing block functionality.
- When troubleshooting 'Invalid block' errors or attribute saving issues.
- When migrating older blocks to support modern standards like apiVersion 3.
- When implementing dynamic server-side rendering for complex blocks.
Advantages
- Ensures adherence to current WordPress block development standards.
- Reduces common errors related to attribute serialization and markup changes.
- Provides a clear path for maintaining backward compatibility via deprecations.
- Streamlines the development process with standardized scaffolding and testing workflows.
Usage examples
- “How do I update my existing block to support WordPress 6.9+ apiVersion 3?”
- The agent will guide you through updating the apiVersion field in block.json, verifying style handle declarations, and testing the block within the iframed editor environment.
- “My block is showing an 'Invalid block' error after I changed the save function. How do I fix it?”
- The agent will help you define a deprecated version in your block registration to handle the legacy markup, ensuring existing content remains valid while allowing for new updates.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/wordpress/wp-block-development/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip wp-block-development.zip -d .agents/skills
Documentation by WordPress
WP Block Development
When to use
Use this skill for block work such as:
creating a new block, or updating an existing one
changing
block.json(scripts/styles/supports/attributes/render/viewScriptModule)fixing “block invalid / not saving / attributes not persisting”
adding dynamic rendering (
render.php/render_callback)block deprecations and migrations (
deprecatedversions)build tooling for blocks (
@wordpress/scripts,@wordpress/create-block,wp-env)
Inputs required
Repo root and target (plugin vs theme vs full site).
The block name/namespace and where it lives (path to
block.jsonif known).Target WordPress version range (especially if using modules /
viewScriptModule).
Procedure
0) Triage and locate blocks
Run triage:
node skills/wp-project-triage/scripts/detect_wp_project.mjs
List blocks (deterministic scan):
node skills/wp-block-development/scripts/list_blocks.mjs
Identify the block root (directory containing
block.json) you’re changing.
If this repo is a full site (wp-content/ present), be explicit about which plugin/theme contains the block.
1) Create a new block (if needed)
If you are creating a new block, prefer scaffolding rather than hand-rolling structure:
Use
@wordpress/create-blockto scaffold a modern block/plugin setup.If you need Interactivity API from day 1, use the interactive template.
Read:
references/creating-new-blocks.md
After scaffolding:
Re-run the block list script and confirm the new block root.
Continue with the remaining steps (model choice, metadata, registration, serialization).
2) Ensure apiVersion 3 (WordPress 6.9+)
WordPress 6.9 enforces apiVersion: 3 in the block.json schema. Blocks with apiVersion 2 or lower trigger console warnings when SCRIPT_DEBUG is enabled.
Why this matters:
WordPress 7.0 will run the post editor in an iframe regardless of block apiVersion.
apiVersion 3 ensures your block works correctly inside the iframed editor (style isolation, viewport units, media queries).
Migration: Changing from version 2 to 3 is usually as simple as updating the apiVersion field in block.json. However:
Test in a local environment with the iframe editor enabled.
Ensure any style handles are included in
block.json(styles missing from the iframe won't apply).Third-party scripts attached to a specific
windowmay have scoping issues.
Read:
references/block-json.md(apiVersion and schema details)
3) Pick the right block model
Static block (markup saved into post content): implement
save(); keep attributes serialization stable.Dynamic block (server-rendered): use
renderinblock.json(orrender_callbackin PHP) and keepsave()minimal ornull.Interactive frontend behavior:
Prefer
viewScriptModulefor modern module-based view scripts where supported.If you're working primarily on
data-wp-*directives or stores, also usewp-interactivity-api.
4) Update block.json safely
Make changes in the block’s block.json, then confirm registration matches metadata.
For field-by-field guidance, read:
references/block-json.md
Common pitfalls:
changing
namebreaks compatibility (treat it as stable API)changing saved markup without adding
deprecatedcauses “Invalid block”adding attributes without defining source/serialization correctly causes “attribute not saving”
5) Register the block (server-side preferred)
Prefer PHP registration using metadata, especially when:
you need dynamic rendering
you need translations (
wp_set_script_translations)you need conditional asset loading
Read and apply:
references/registration.md
6) Implement edit/save/render patterns
Follow wrapper attribute best practices:
Editor:
useBlockProps()Static save:
useBlockProps.save()Dynamic render (PHP):
get_block_wrapper_attributes()
Read:
references/supports-and-wrappers.mdreferences/dynamic-rendering.md(if dynamic)
7) Inner blocks (block composition)
If your block is a “container” that nests other blocks, treat Inner Blocks as a first-class feature:
Use
useInnerBlocksProps()to integrate inner blocks with wrapper props.Keep migrations in mind if you change inner markup.
Read:
references/inner-blocks.md
8) Attributes and serialization
Before changing attributes:
confirm where the attribute value lives (comment delimiter vs HTML vs context)
avoid the deprecated
metaattribute source
Read:
references/attributes-and-serialization.md
9) Migrations and deprecations (avoid "Invalid block")
If you change saved markup or attributes:
Add a
deprecatedentry (newest → oldest).Provide
savefor old versions and an optionalmigrateto normalize attributes.
Read:
references/deprecations.md
10) Tooling and verification commands
Prefer whatever the repo already uses:
@wordpress/scripts(common) → run existing npm scriptswp-env(common) → use for local WP + E2E
Read:
references/tooling-and-testing.md
Verification
Block appears in inserter and inserts successfully.
Saving + reloading does not create “Invalid block”.
Frontend output matches expectations (static: saved markup; dynamic: server output).
Assets load where expected (editor vs frontend).
Run the repo’s lint/build/tests that triage recommends.
Failure modes / debugging
If something fails, start here:
references/debugging.md(common failures + fastest checks)references/attributes-and-serialization.md(attributes not saving)references/deprecations.md(invalid block after change)
Escalation
If you’re uncertain about upstream behavior/version support, consult canonical docs first:
WordPress Developer Resources (Block Editor Handbook, Theme Handbook, Plugin Handbook)
Gutenberg repo docs for bleeding-edge behaviors
Files
- ATTRIBUTION.mdAdded by AutoGineer904 B
- LICENSELicence file added by AutoGineer750 B
- SKILL.md6.3 KiB
- references/attributes-and-serialization.md759 B
- references/block-json.md2.3 KiB
- references/creating-new-blocks.md1.6 KiB
- references/debugging.md1.3 KiB
- references/deprecations.md665 B
- references/dynamic-rendering.md685 B
- references/inner-blocks.md1.2 KiB
- references/registration.md932 B
- references/supports-and-wrappers.md512 B
- references/tooling-and-testing.md928 B
- scripts/list_blocks.mjsScript2.8 KiB
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Needs Node.js
The author says: Targets WordPress 7.0+ (PHP 7.4.0+). Filesystem-based agent with bash + node. Some workflows require WP-CLI.
Security
What our scanner noticed· Low risk
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- WordPress
- Publisher
- WordPress (Official)
- Source
- WordPress/agent-skills · skills/wp-block-development · commit 7374e6f
- Licence
- GNU General Public License v2.0 or later (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by WordPress or WordPress.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download wp-block-development.zip