Builds and debugs WordPress Interactivity API features: data-wp-* directives, @wordpress/interactivity stores/actions, block viewScriptModule, wp_interactivity_* functions, hydration, performance.
npx claudepluginhub joshuarweaver/cascade-code-general-misc-4 --plugin wordpress-agent-skills-9This skill uses the workspace's default tool permissions.
Use this skill when the user mentions:
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Use this skill when the user mentions:
@wordpress/interactivity,data-wp-interactive, data-wp-on--*, data-wp-bind--*, data-wp-context,viewScriptModule / module-based view scripts,wp-project-triage).Search for:
data-wp-interactive@wordpress/interactivityviewScriptModuleDecide:
block.json view script module?If you’re creating a new interactive block (not just debugging), prefer the official scaffold template:
@wordpress/create-block-interactive-template (via @wordpress/create-block)Locate store definitions and confirm:
data-wp-on--*.Pre-render HTML on the server before outputting to ensure:
For components using block.json, add supports.interactivity:
{
"supports": {
"interactivity": true
}
}
For themes/plugins without block.json, use wp_interactivity_process_directives() to process directives.
Use wp_interactivity_state() to define initial global state:
wp_interactivity_state( 'myPlugin', array(
'items' => array( 'Apple', 'Banana', 'Cherry' ),
'hasItems' => true,
));
For local context, use wp_interactivity_data_wp_context():
<?php
$context = array( 'isOpen' => false );
?>
<div <?php echo wp_interactivity_data_wp_context( $context ); ?>>
...
</div>
When derived state affects initial HTML rendering, replicate the logic in PHP:
wp_interactivity_state( 'myPlugin', array(
'items' => array( 'Apple', 'Banana' ),
'hasItems' => function() {
$state = wp_interactivity_state();
return count( $state['items'] ) > 0;
}
));
This ensures directives like data-wp-bind--hidden="!state.hasItems" render correctly on first load.
For detailed examples and patterns, see references/server-side-rendering.md.
When touching markup directives:
WordPress 6.9 changes:
data-wp-ignore is deprecated and will be removed in future versions. It broke context inheritance and caused issues with client-side navigation. Avoid using it.--- separator (e.g., data-wp-on--click---plugin-a="..." and data-wp-on--click---plugin-b="...").AsyncAction<ReturnType> and TypeYield<T> help with async action typing.For quick directive reminders, see references/directives-quickref.md.
Verify the repo supports the required module build path:
@wordpress/scripts, prefer its conventions.If “nothing happens” on interaction:
viewScriptModule is enqueued/loaded,data-wp-interactive,See references/debugging.md.
wp-project-triage indicates signals.usesInteractivityApi: true after your change (if applicable).data-wp-interactive.wp_interactivity_state() with closures.supports.interactivity not set in block.json (for blocks).wp_interactivity_process_directives() not called (for themes/plugins).state.hasItems missing on server, causing hidden attribute to be absent.getServerState() and getServerContext() now reset between page transitions—ensure your code doesn't assume stale values persist.attachTo for rendering overlays (modals, pop-ups) dynamically.@wordpress/scripts or a custom bundler (webpack/vite)?"references/server-side-rendering.mdreferences/directives-quickref.mdreferences/debugging.md