Communityコーディング&開発github.com

FSWPブロック開発者

WordPress フルスタック開発者向けの、ブロックエディター(Gutenberg)に関するドメインスキルです。カスタムブロックの構築、パターン、インタラクティブ API をカバーします。

FSWPブロック開発者 とは?

このスキルは、WordPress のフルスタック開発者(fswp-developer)が Gutenberg ブロックエディターのカスタマイズに取り組むための専門的な知識とルールを提供します。主な対象領域は、カスタムブロック(静的・動的レンダリング、属性、サポート、InnerBlocks、バリエーション、非推奨、ブロックバインディング)、ブロックパターン、および Interactivity API(data-wp ディレクティブ、ストア、サーバーサイドステート)です。開発ワークフローは @wordpress/scripts によるビルドを前提とし、常にコアブロックを優先した上でカスタムブロックを実装するという原則に基づきます。このスキルは、公式リファレンス(Block Editor Handbook)へのリンクを参照しつつ、セキュリティ(入力・出力・認可)、コーディング標準、i18n、アクセシビリティといった横断的なプラクティスと組み合わせて適用されます。プラグインやテーマにおけるあらゆるカスタムブロック、パターン、フロントエンドのインタラクティブ処理に使用します。

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

Installed? Explore more コーディング&開発 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

FSWPブロック開発者 は何をしますか?

常に適用される基本スキル: fswp-developer/references/lean-coding.md(少なく書き、再利用を優先)、fswp-developer/references/coding-standards.md(コーディング標準、ドキュメント、i18n、アクセシビリティ)、および fswp-security-engineer(入力、出力、認可)。

コアブロックを優先して使用し、コアブロックとパターンでは要件を表現できない場合にのみカスタムブロックを作成します。公式リファレンス: fswp-developer/references/official-docs.md にあるブロックエディターハンドブックのリンクを参照。各APIの最低WordPressバージョンをプロジェクトの宣言済み最低バージョンと照合してください。

構造

blocks/my-block/
  block.json      名前、タイトル、カテゴリ、属性、supports、render、editorScript、viewScriptModule、style
  edit.js         エディターUI(useBlockPropsを使用)
  save.js         静的マークアップ、動的ブロックの場合は省略
  render.php      動的ブロックのサーバーレンダリング
  view.js         フロントエンドの挙動(モジュール)
  style.scss / editor.scss

メタデータからの登録: init で register_block_type( __DIR__ . '/build/my-block' )(init コールバックには名前付き関数を使用)。"apiVersion": 3(WordPress 6.3以降で標準)を設定し、"$schema": "https://schemas.wp.org/trunk/block.json" を追加。フィールドごとのリファレンスは、Block Editor Handbook で検証済み: references/block-json.md。

決定

質問選択肢
出力が保存済み属性のみに依存する静的ブロック(save.js)
出力がライブデータに依存し、再保存なしで変更が必要、またはロジックを含む動的ブロック(render.php); save は null または InnerBlocks のみを返す
ネストされたコンテンツallowedBlocks と template を指定した InnerBlocks
属性をデータ(投稿メタ、カスタムソース)にバインドするブロックバインディングAPI(register_block_bindings_source)、最低WordPressバージョンが許可する場合
既存ブロックの代替プリセット新しいブロックではなく、ブロックバリエーションまたはスタイル
再利用可能なレイアウトブロックではなくパターン

ルール

  • 属性: すべての属性に type と default を指定し、マークアップまたはコメントから一貫してソースを取得し、render.php で検証する。
  • コントロールを自作する代わりに supports(color、spacing、typography、align、anchor)を使用する。
  • エディターマークアップは useBlockProps() を使用し、動的PHPでは get_block_wrapper_attributes() を使用する。
  • render.php(block.json の render、WordPress 6.1以降)は $attributes、$content、$block(WP_Block オブジェクト)を受け取る。ページ上のブロックインスタンスごとに1回読み込まれるため、内部で関数やクラスを宣言せず、他のファイルから共有コードを呼び出す。
  • スクリプト vs モジュール: viewScript は従来のスクリプト(WordPressスクリプトに依存するものすべて)用、viewScriptModule(6.5以降)は Interactivity API などのスクリプトモジュール用。これらは互換性がないため、依存関係を混在させない。
  • render.php ではすべてをエスケープする(fswp-security-engineer); 属性はユーザー入力である。
  • 出荷済みの静的ブロックの保存済みマークアップを変更すると、既存のコンテンツが壊れる。古い save、属性、migrate 関数を deprecated エントリとして追加し、その後ブロックを変更する。
  • 文字列をJSとPHPで翻訳する(テキストドメインを指定した __()); wp_set_script_translations または block.json の textdomain。
  • フロントエンドスクリプトはブロックがレンダリングされる場所でのみ読み込む(block.json の viewScriptModule/script がこれを実現する)。

パターン

パターン、バリエーション、ブロックフック、バインディングの詳細: references/patterns-variations.md。Interactivity API の詳細(サーバーレンダリング、非同期アクション、data-wp-each、ウォッチャー、パフォーマンス): references/interactivity.md。

PHPでは register_block_pattern()(および register_block_pattern_category())で登録するか、テーマの patterns/ ディレクトリにファイルとして配置する。パターンはプリセットと翻訳済みテキストを使用する; リモート画像は使用しない; 明確なタイトル、カテゴリ、キーワードを付与する。

Interactivity API

サーバーレンダリングされたマークアップに小さなリアクティブな動作を追加。フレームワーク不要。

  • "supports": { "interactivity": true } と "viewScriptModule": "file:./view.js" で有効化。
  • マークアップディレクティブ: 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"。
  • view.js 内のストア: import { store, getContext } from '@wordpress/interactivity'; store( 'namespace', { state: {...}, actions: { toggle() { const c = getContext(); c.open = !c.open; } } } );
  • サーバーステートを wp_interactivity_state( 'namespace', array(...) ) でシードし、初回描画が正しくフラッシュが発生しないようにする。ステートはシリアライズ可能に保つ。
  • 名前空間ですべてを分離し、衝突を防ぐ; シークレットをステートやコンテキストに決して入れない(両方ともページに出力される)。
  • アクセシビリティのために、aria-expanded とフォーカス処理をステートに結び付け、キーボード操作をテストする。

ビルドとテスト

npx @wordpress/create-block で開始点を作成; @wordpress/scripts で build、start、lint-js、lint-style、test-unit-js を実行。ビルド済みファイルを src/、package.json、ロックファイルとともに配布する(コンパイルコードのディレクトリルール)。エディター(挿入、編集、保存、リロード、コードビューへの切り替え)とフロントエンドでテストする。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.

関連スキル