wp-interactivity-api
Installation
SKILL.md
WordPress Interactivity API
Use WordPress's block-oriented reactive runtime when frontend elements need shared state, declarative DOM updates, or server-rendered markup that hydrates without changing. Do not use it merely to enqueue an unrelated JavaScript widget.
Choose the right mechanism
| Requirement | Prefer |
|---|---|
| One isolated click handler with no block integration | A small viewScript or viewScriptModule |
| Reactive state, directives, or communication between blocks | Interactivity API |
| Editor inspector/sidebar UI | @wordpress/data and Block Editor packages |
| Data persistence or privileged work | REST API with authorization; Interactivity API is only the UI/runtime layer |
Minimal block contract
Declare support and load a script module through block metadata: