add-block
Create a new Gutenberg block with scaffolding
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Create a new Gutenberg block with scaffolding
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Use when working with the WordPress Abilities API (wp_register_ability, wp_register_ability_category, /wp-json/wp-abilities/v1/*, @wordpress/abilities) including defining abilities, categories, meta, REST exposure, and permissions checks for clients.
Prepare plugin for WordPress.org deployment
Use when generating responses containing factual claims, API details, configuration specifics, version compatibility, or recalled knowledge that could be hallucinated - especially when not working directly from source code or command output
Use when executing implementation plans with independent tasks in the current session
Create a block extension to enhance core WordPress blocks
Create a block variation with preset configurations
| name | add-block |
| description | Create a new Gutenberg block with scaffolding |
| argument-hint | ["block-name"] |
| allowed-tools | Read, Write, Edit, Glob, Grep, Bash(mkdir *), Bash(npm run *) |
Create a new Gutenberg block following WordPress best practices.
Before scaffolding a new block, run this check:
src/blocks/*) for anything conceptually similar.save() output structure?registerBlockVariation, not a new block. Variations have no migration cost and no deprecation debt.See the "Variations vs. new blocks" section in .claude/claude.md for rationale and the consolidation pattern for sibling blocks.
src/blocks/[block-name]/block.json with proper metadata and attributesindex.js to register the blockedit.js with editor controlssave.js with frontend markupstyle.scss for frontend styleseditor.scss for editor-only stylesfrontend.js (if needed for interactivity)render.php (if dynamic rendering needed)Before generating any block code, check src/hooks/ and src/components/shared/ for primitives that already cover the patterns you're about to write. The plugin maintains shared building blocks specifically to keep new blocks consistent with the rest of the codebase. See the Shared Primitives First and Variation vs New Block sections of .claude/claude.md for the full list and the variation-vs-block decision rule.
If a new block differs from an existing one only by 1–3 attributes and shares the same save() output, register a variation in the existing block's block.json instead of creating a new block.
ALWAYS use these in edit.js:
useBlockProps() for block wrapperuseInnerBlocksProps() for nested blocks (NOT plain <InnerBlocks />)useEffect for styles)ALWAYS include in block.json:
supports for FSE compatibilityexample property for pattern libraryColor controls:
ColorGradientSettingsDropdown (NOT PanelColorSettings)<InspectorControls group="color">clientId parameter in edit functionBlock will be auto-detected by webpack - no need to modify src/index.js.
If dynamic rendering is used, add PHP registration in includes/class-plugin.php.
npm run build
Test in both editor and frontend.
See BEST-PRACTICES-SUMMARY.md for complete patterns.