
Description
Create, edit, build, and review a custom WordPress Gutenberg block plugin inside a Studio-backed site.
SKILL.md
Block Creator
Use this skill when the user wants to create or modify a custom Gutenberg block inside a local Studio site.
Ownership
This skill is the single entry point for custom block work. It owns:
- block plugin workflow inside a Studio site
- structural decisions such as static versus dynamic blocks
- implementation rules for block plugin code
Use studio for review and iteration after the block is built into a site.
Workflow
1. Verify Studio readiness
Use studio so the selected site can be managed and reviewed with Studio tools.
2. Resolve the target site
Use Studio tools to:
- list available sites
- select or confirm the working site
- start it if needed
- fetch the site path and URL
Once you begin the actual block implementation workflow, call record_workflow_event with workflow: "block-build" and stage: "started".
3. Understand the request
If the request is vague, clarify:
- what the block should display
- whether it needs live data
- whether it needs frontend interaction
4. Decide static or dynamic
Default to a static block unless the user clearly needs server-rendered data.
Use a static block when the content can be serialized at edit time. Use a dynamic block when the frontend output depends on server-side data or computation.
Keep the implementation consistent with standard Gutenberg block conventions.
5. Generate identifiers
Create:
- a human block name in Title Case
- a kebab-case slug
- a registry name like
create-block/{slug}unless the project already has a namespace
6. Scaffold the plugin in the selected Studio site
Create the plugin directory here:
<site-path>/wp-content/plugins/<slug>/
<site-path>/wp-content/plugins/<slug>/src/
Then write:
<slug>.phppackage.jsonreadme.txtsrc/block.jsonsrc/index.jssrc/edit.jssrc/save.jssrc/render.phpsrc/view.jssrc/style.scsssrc/editor.scss
After the build, compiled assets live in build/.
Use the selected Studio site as the root for all block-related files.
Core rules
1. Keep view.js plain JavaScript
view.js runs on the frontend.
- no JSX
- no React
- no imports from
@wordpress/* - use DOM APIs directly
2. Match editor and frontend output
The editor preview should look and behave as close to the frontend as possible.
- use matching class names
- use real block UI, not placeholder boxes unless absolutely necessary
- keep style rules shared when possible
3. Be proactive with controls
Prefer controls the editor already provides when they fit the request.
Prefer components such as:
InspectorControlsBlockControlsRichTextMediaUploadToggleControl,RangeControl,SelectControl,TextControl
Prefer supports in block.json when WordPress can provide built-in UI for color, spacing, or typography.
Core file guidance
package.json
Use @wordpress/scripts for build tooling. Keep the package minimal and aligned with the block's actual needs.
Include build scripts that support the current task rather than copying a large default scaffold.
block.json
Keep metadata valid and minimal. Use only the fields the block actually needs.
PHP plugin bootstrap
The plugin main file should:
- guard direct access with
if ( ! defined( 'ABSPATH' ) ) { exit; } - wrap function definitions with
function_exists - register the block from
build/
HTML rule
Each block should render a single wrapper element. Do not accidentally nest identical wrapper tags.
Defaults
If unsure:
- make it static
- use
designorwidgetscategory depending on the block - include editor controls for the attributes the user will obviously want to change
PHP standards
- no closing
?>at end of file - guard functions with
function_exists - use escaping like
esc_html(),esc_attr(), orwp_kses_post()where appropriate
Studio workflow
Inside the block plugin directory, prefer:
pnpm install
pnpm exec wp-scripts build
If the generated block package is being used outside this repo and only npm is available, npm install && npx wp-scripts build is fine too.
After a successful build:
- activate the plugin with
wp_cli - insert the block into a test page or post with
wp_cli - follow the review and iteration workflow in
studio - call
record_workflow_eventwithworkflow: "block-build"andstage: "completed"
When editing an existing block:
- locate the block project in the selected site's
wp-content/plugins/ - identify affected files based on the change request
- update only the necessary files
- rebuild
- re-run activation or page setup steps if needed
- follow the review and iteration workflow in
studio
Error recovery
When a build fails:
- read the full error output
- identify the exact file and issue
- fix only the relevant file
- rebuild without reinstalling packages
- retry up to 3 times before escalating to the user
More skills from the build-with-wordpress repository
View all 8 skillsauditing
audit WordPress sites for performance and accessibility
Apr 6AccessibilityAuditPerformanceWordPressdesign-previews-creator
generate WordPress design preview options
Apr 6DesignThemesWordPressplugin-creator
create WordPress plugins
Apr 6Plugin DevelopmentWordPresssite-creator
create WordPress sites from a brief
Apr 6Local DevelopmentWordPressstudio
run local WordPress development with Studio
Apr 6CLILocal DevelopmentMCPWordPresstheme-creator
create WordPress block themes
Apr 6DesignFrontendThemesWordPress
More from Automattic
View publisherannotate
collect visual feedback with browser annotation tools
studio
May 6FrontendProductivityUX CopyUX Designblock-content
write editable WordPress block markup
studio
May 27Block EditorCSSHTMLWordPresshosting-plans-helper
provide WordPress.com hosting plan information
studio
Jul 2PricingReferenceWordPressliberate
migrate websites to WordPress
studio
Jul 9CMSMigrationWeb DevelopmentWordPressneed-for-speed
run frontend performance audits for WordPress sites
studio
May 6AuditFrontendPerformanceWordPressplugin-recommendations
recommend WordPress plugins for site features
studio
May 27Content CreationPlugin DevelopmentWordPress