CommunityCodierung & Entwicklunggithub.com

fswp-block-developer

Domain-Skill für die Arbeit mit dem WordPress Block-Editor im Full-Stack WP Developer. Behandelt die Entwicklung benutzerdefinierter Gutenberg-Blöcke, Blockvorlagen und die Interactivity API.

Was ist fswp-block-developer?

FSWP Block Developer ist ein spezialisiertes Skill-Profil für Entwickler, die im Full-Stack WP Developer Kontext mit dem WordPress Block-Editor arbeiten. Es behandelt den gesamten Workflow zur Erstellung benutzerdefinierter Gutenberg-Blöcke – von der Definition in `block.json` über statische (`save.js`) und dynamische Blöcke (`render.php`) bis hin zu fortgeschrittenen Konzepten wie `InnerBlocks`, Blockvariationen, Deprecations und Block Bindings. Das Skill setzt auf die offiziellen @wordpress/scripts für den Build-Prozess und beinhaltet detaillierte Anleitungen zur Interactivity API (data-wp-Direktiven, Stores, serverseitiger State). Geeignet für jegliche benutzerdefinierte Blöcke, Patterns oder Frontend-Interaktivität in einem Plugin oder Theme. Es wird auf Plattformen wie Claude Code, Cursor und Codex verwendet und stellt sicher, dass alle Codierungsstandards, Sicherheits- und Barrierefreiheitsanforderungen eingehalten werden.

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

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

In Ihrer bevorzugten KI fragen

Öffnet einen neuen Chat, in dem dieser Agent-Skill bereits geladen ist.

Dokumentation

FSWP Block Developer

Grundlegend (immer anwenden): fswp-developer/references/lean-coding.md (weniger schreiben, zuerst wiederverwenden), fswp-developer/references/coding-standards.md (Codierungsstandards, Doku, i18n, Barrierefreiheit) und fswp-security-engineer (Eingabe, Ausgabe, Autorisierung).

Verwende zuerst Kernblöcke; schreibe einen benutzerdefinierten Block nur, wenn Kernblöcke und Patterns die Anforderung nicht abbilden können. Offizielle Referenzen: Block Editor Handbook Links in fswp-developer/references/official-docs.md. Prüfe die Mindest-WordPress-Version für jede API gegen die im Projekt deklarierte Mindestversion.

Aufbau

blocks/my-block/
  block.json      name, title, category, attributes, supports, render, editorScript, viewScriptModule, style
  edit.js         Editor-UI (verwendet useBlockProps)
  save.js         Statisches Markup, oder weglassen für dynamische Blöcke
  render.php      Server-Rendering für dynamische Blöcke
  view.js         Frontend-Verhalten (Modul)
  style.scss / editor.scss

Von Metadaten registrieren: register_block_type( __DIR__ . '/build/my-block' ) bei init (verwende eine benannte Funktion für den init-Callback). Setze "apiVersion": 3 (aktuell seit WordPress 6.3) und füge "$schema": "https://schemas.wp.org/trunk/block.json" hinzu. Feld-für-Feld-Referenz, geprüft gegen das Block Editor Handbook: references/block-json.md.

Entscheidungen

FrageWahl
Ausgabe hängt nur von gespeicherten Attributen abStatischer Block (save.js)
Ausgabe hängt von Live-Daten ab, muss sich ohne erneutes Speichern ändern oder enthält LogikDynamischer Block (render.php); save gibt null zurück oder nur InnerBlocks
Verschachtelte InhalteInnerBlocks mit allowedBlocks und template
Attribut an Daten binden (Beitragsmeta, benutzerdefinierte Quelle)Block Bindings API (register_block_bindings_source) wenn die WordPress-Mindestversion dies erlaubt
Alternative Voreinstellungen eines bestehenden BlocksBlockvariationen oder -stile, kein neuer Block
Wiederverwendbares LayoutEin Pattern, kein Block

Regeln

  • Attribute: gib jedem Attribut einen type und default; beziehe sie konsistent aus Markup oder Kommentaren; validiere in render.php.
  • Verwende supports (color, spacing, typography, align, anchor) anstatt Steuerungen zu schreiben.
  • Editor-Markup muss useBlockProps() verwenden; dynamisches PHP verwendet get_block_wrapper_attributes().
  • render.php (block.json render, WordPress 6.1+) erhält $attributes, $content und $block (ein WP_Block). Es wird einmal pro Blockinstanz auf der Seite geladen, deklariere daher niemals Funktionen oder Klassen darin; rufe gemeinsamen Code aus einer anderen Datei auf.
  • Skripte vs. Module: viewScript ist für klassische Skripte (und alles, was von WordPress-Skripten abhängt); viewScriptModule (6.5+) ist für Skriptmodule wie die Interactivity API. Sie sind nicht austauschbar, daher keine Abhängigkeiten zwischen beiden mischen.
  • Alles in render.php escapen (fswp-security-engineer); Attribute sind Benutzereingaben.
  • Das Ändern des gespeicherten Markups eines ausgelieferten statischen Blocks zerbricht bestehende Inhalte. Füge einen deprecated-Eintrag mit dem alten save, den Attributen und einer migrate-Funktion hinzu, ändere dann den Block.
  • Zeichenketten übersetzen (__() mit der Textdomäne) in JS und PHP; wp_set_script_translations oder block.json textdomain.
  • Lade Frontend-Skripte nur dort, wo der Block gerendert wird (block.json viewScriptModule/script erledigen dies).

Patterns

Mehr Details zu Patterns, Variationen, Block-Hooks und Bindings: references/patterns-variations.md. Tiefe der Interactivity API (Server-Rendering, asynchrone Aktionen, data-wp-each, Watcher, Performance): references/interactivity.md.

Registriere in PHP mit register_block_pattern() (und register_block_pattern_category()), oder als Dateien im patterns/-Verzeichnis eines Themes. Patterns verwenden Voreinstellungen und übersetzten Text; keine Remote-Bilder; gib ihnen einen klaren Titel, Kategorien und Schlüsselwörter.

Interactivity API

Server-gerendertes Markup plus kleines reaktives Verhalten, kein Framework nötig.

  • Aktiviere mit "supports": { "interactivity": true } und "viewScriptModule": "file:./view.js".
  • Markup-Direktiven: 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-Status mit wp_interactivity_state( 'namespace', array(...) ), damit der erste Paint korrekt ist und kein Flackern auftritt. Halte den Status serialisierbar.
  • Namespace alles, um Kollisionen zu vermeiden; setze niemals Geheimnisse in Status oder Kontext (beide werden in die Seite gedruckt).
  • Für Barrierefreiheit: binde aria-expanded und Fokus-Behandlung an den Status und teste die Tastaturnutzung.

Build und Test

npx @wordpress/create-block als Ausgangspunkt; @wordpress/scripts für build, start, lint-js, lint-style, test-unit-js. Liefere die gebauten Dateien zusammen mit src/, package.json und der Lockdatei aus (Verzeichnisregel für kompilierten Code). Teste im Editor (einfügen, bearbeiten, speichern, neu laden, zur Code-Ansicht wechseln) und im Frontend. Übergib an 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.

Verwandte Skills