CommunityCoding & Developmentgithub.com

fswp-block-developer

Domain skill for WordPress block editor work in Full-Stack WP Developer. Covers building custom Gutenberg blocks (block.json, static and dynamic rendering, attributes, supports, InnerBlocks, variations, deprecations, block bindings), block patterns, and the Interactivity API (data-wp directives, stores, server-side state), with the @wordpress/scripts build workflow. Use for any custom block, pattern, or front-end interactivity in a plugin or theme.

What is fswp-block-developer?

fswp-block-developer is a Claude Code agent skill that domain skill for WordPress block editor work in Full-Stack WP Developer. Covers building custom Gutenberg blocks (block.json, static and dynamic rendering, attributes, supports, InnerBlocks, variations, deprecations, block bindings), block patterns, and the Interactivity API (data-wp directives, stores, server-side state), with the @wordpress/scripts build workflow. Use for any custom block, pattern, or front-end interactivity in a plugin or theme.

Works with~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/syncwin/fswp-developer/tree/main/skills/fswp-block-developer

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

FSWP Block Developer

Foundational (always applied): fswp-developer/references/lean-coding.md (write less, reuse first), fswp-developer/references/coding-standards.md (coding standards, docs, i18n, accessibility), and fswp-security-engineer (input, output, authorization).

Use core blocks first; write a custom block only when core blocks and patterns cannot express the requirement. Official references: Block Editor Handbook links in fswp-developer/references/official-docs.md. Check the minimum WordPress version for each API against the project's declared minimum.

Anatomy

blocks/my-block/
  block.json      name, title, category, attributes, supports, render, editorScript, viewScriptModule, style
  edit.js         editor UI (uses useBlockProps)
  save.js         static markup, or omit for dynamic blocks
  render.php      server render for dynamic blocks
  view.js         front-end behavior (module)
  style.scss / editor.scss

Register from metadata: register_block_type( __DIR__ . '/build/my-block' ) on init (use a named function for the init callback). Set "apiVersion": 3 (current since WordPress 6.3) and add "$schema": "https://schemas.wp.org/trunk/block.json". Field-by-field reference, verified against the Block Editor Handbook: references/block-json.md.

Decisions

QuestionChoose
Output depends only on saved attributesStatic block (save.js)
Output depends on live data, must change without re-saving, or contains logicDynamic block (render.php); save returns null or only InnerBlocks
Nested contentInnerBlocks with allowedBlocks and template
Bind an attribute to data (post meta, custom source)Block Bindings API (register_block_bindings_source) where the minimum WordPress version allows
Alternate presets of an existing blockBlock variations or styles, not a new block
Reusable layoutA pattern, not a block

Rules

  • Attributes: give every attribute a type and default; source them from markup or comments consistently; validate in render.php.
  • Use supports (color, spacing, typography, align, anchor) instead of writing controls.
  • Editor markup must use useBlockProps(); dynamic PHP uses get_block_wrapper_attributes().
  • render.php (block.json render, WordPress 6.1+) receives $attributes, $content, and $block (a WP_Block). It loads once per block instance on the page, so never declare functions or classes inside it; call shared code from another file.
  • Scripts vs modules: viewScript is for classic scripts (and anything depending on WordPress scripts); viewScriptModule (6.5+) is for script modules such as the Interactivity API. They are not interchangeable, so do not mix dependencies across the two.
  • Escape everything in render.php (fswp-security-engineer); attributes are user input.
  • Changing saved markup of a shipped static block breaks existing content. Add a deprecated entry with the old save, attributes, and a migrate function, then change the block.
  • Translate strings (__() with the text domain) in JS and PHP; wp_set_script_translations or block.json textdomain.
  • Load front-end scripts only where the block renders (block.json viewScriptModule/script do this).

Patterns

More detail on patterns, variations, block hooks, and bindings: references/patterns-variations.md. Interactivity API depth (server rendering, async actions, data-wp-each, watchers, performance): references/interactivity.md.

Register in PHP with register_block_pattern() (and register_block_pattern_category()), or as files in a theme's patterns/. Patterns use presets and translated text; no remote images; give them a clear title, categories, and keywords.

Interactivity API

Server-rendered markup plus small reactive behavior, no framework needed.

  • Enable with "supports": { "interactivity": true } and "viewScriptModule": "file:./view.js".
  • Markup directives: data-wp-interactive="namespace", data-wp-context='{"open":false}', data-wp-on--click="actions.toggle", data-wp-bind--hidden="!context.open", data-wp-class--is-open="context.open", data-wp-text="state.label".
  • Store in view.js: import { store, getContext } from '@wordpress/interactivity'; store( 'namespace', { state: {...}, actions: { toggle() { const c = getContext(); c.open = ! c.open; } } } );
  • Seed server state with wp_interactivity_state( 'namespace', array(...) ) so first paint is correct and no flash occurs. Keep state serializable.
  • Namespace everything to avoid collisions; never put secrets in state or context (both are printed into the page).
  • For accessibility, tie aria-expanded and focus handling to state, and test keyboard use.

Build and test

npx @wordpress/create-block for a starting point; @wordpress/scripts for build, start, lint-js, lint-style, test-unit-js. Ship the built files together with src/, package.json, and the lockfile (directory rule for compiled code). Test in the editor (insert, edit, save, reload, switch to code view) and on the front end. Hand to fswp-qa-engineer.

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

fswp-api-developer

Domain skill for WordPress REST API and Abilities API work in Full-Stack WP Developer. Covers registering routes with schemas, argument validation and sanitization, permission callbacks, controller classes, exposing post types and meta, authentication (cookie nonce, application passwords), pagination and errors, and registering abilities with input and output schemas and safety annotations. Use for any custom endpoint or machine-readable capability in a plugin or theme.

fswp-architect

Planning stage of Full-Stack WP Developer. Classifies the work (new plugin, new theme, update to an existing plugin or theme, add-on for another product, or WordPress Core patch), triages existing code with a bundled detection script, asks one round of essential questions, does competitive research, and produces one reviewable PRD or change brief with a single approval gate. Also covers Migration mode and multi-session handoff docs. Invoked by fswp-developer before any code is written; consult directly for PRD, change-brief, or handoff-doc questions.

fswp-core-contributor

WordPress Core contribution stage of Full-Stack WP Developer. Guides a contributor through finding or filing a Trac ticket, setting up the wordpress-develop checkout and test environment, writing a patch or GitHub pull request that follows Core coding standards, inline documentation, backward compatibility and tests, and preparing the ticket comment; also routes block-editor changes to the Gutenberg repository and security reports to the private process. Invoked by fswp-developer for Core patches; consult directly for Core workflow questions.

fswp-devops-engineer

Domain skill for WordPress development tooling in Full-Stack WP Developer. Covers local environments (wp-env with Docker, WordPress Playground and Blueprints), command-line site operations (plugin and theme management, database export, search-replace, cron, scaffolding), coding standards and static analysis (PHPCS with WordPress standards, PHPStan with WordPress stubs), PHP and JS testing setup, and the @wordpress/scripts toolchain. Use when setting up, running, or automating a WordPress dev or test environment.

fswp-maintainer

Change stage for existing WordPress code in Full-Stack WP Developer. Updates, fixes, refactors, and upgrades existing plugins and themes without breaking them, and builds add-ons for products you do not own (WooCommerce extensions, page-builder elements, extensions of other plugins) using hooks instead of edits to third-party files. Covers reading before changing, parity lists, deprecation, host compatibility, upgrade paths, and patch delivery. Invoked by fswp-developer after an approved change brief; consult directly for safe-change or add-on questions.

fswp-qa-engineer

Verification stage of Full-Stack WP Developer. Runs the mechanical gate for plugins and themes (house-rule scripts, PHP lint, PHPCS with WordPress standards, PHP compatibility, PHPStan with WordPress stubs), the manual checklist, PRD or change-brief scenario tests, and the pre-release check. Reports PASS, FAIL, or NOT RUN and never implies a skipped check passed. Invoked by fswp-developer after a build and again before delivery; consult directly to audit any plugin or theme folder.

fswp-reviewer

Independent review stage of Full-Stack WP Developer. Reviews a finished WordPress plugin, theme, add-on, or Core patch through a security lens (WordPress-specific vulnerabilities, REST and AJAX authorization with an API risk map, AI-generated-code risks), a quality lens (error handling, data and upgrade safety, performance, i18n, accessibility, comment accuracy, test gaps, class and type design, scope), and an optional lean lens for trimming over-engineering, reporting only high-confidence findings in a fixed format. Invoked by fswp-developer after the verify gate, normally through the fswp-code-reviewer agent; consult directly to review or optimize any WordPress code.

fswp-theme-developer

Theme build stage of Full-Stack WP Developer. Builds custom WordPress themes - block themes (theme.json, templates, template parts, patterns, style variations), classic themes (template hierarchy, functions.php, theme supports), hybrids, and child themes - with accessibility, escaping, and directory readiness built in, plus a scaffold script. Invoked by fswp-developer after an approved PRD for a new theme; consult directly for a specific theme pattern. For changes to an existing theme use fswp-maintainer.

syncwin/fswp-plugin-developer

Plugin build stage of Full-Stack WP Developer. House standards and code templates for real WordPress plugins (not shortcode snippets) - folder anatomy, activation/uninstall lifecycle, custom post types and tables, admin UI tiers, front-end output on the Atomic Framework, REST and cron, i18n, distribution, and the Tier 3 React admin stack - plus a scaffold script. Also the base structure for add-ons. Invoked by fswp-developer after an approved PRD; consult directly for a specific plugin build pattern.

Related Skills