Community코딩 & 개발github.com

fswp-block-developer

Full-Stack WP 개발자를 위한 WordPress 블록 에디터 작업 도메인 스킬입니다. 사용자 정의 Gutenberg 블록(block.json, 정적/동적 렌더링, 속성, supports, InnerBlocks, 변형, 폐기, 블록 바인딩), 블록 패턴, Interactivity API(data-wp 디렉티브, 스토어, 서버 측 상태)를 다루며 @wordpress/scripts 빌드 워크플로우를 포함합니다. 플러그인이나 테마에서 사용자 정의 블록, 패턴 또는 프론트엔드 인터랙티브 작업 시 사용하세요.

fswp-block-developer란 무엇인가요?

이 스킬은 WordPress 개발자가 Gutenberg 블록 에디터 환경에서 사용자 정의 블록과 패턴, 인터랙티브 기능을 구축할 수 있도록 안내합니다. 핵심 블록만으로 요구사항을 표현할 수 없을 때 사용자 정의 블록을 만들도록 권장하며, block.json 정의부터 정적(save.js) 및 동적(render.php) 렌더링, 속성(attributes), supports, InnerBlocks, 블록 변형(variations), 폐기(deprecations), 블록 바인딩(Block Bindings API)까지 폭넓게 다룹니다. 또한 블록 패턴 등록 방법과 Interactivity API(data-wp 디렉티브, 스토어, 서버 상태 시딩)를 통해 프레임워크 없이 반응형 동작을 구현하는 방법을 상세히 설명합니다. @wordpress/scripts 기반의 빌드 및 테스트 워크플로우를 지원하며, 보안(i18n, 이스케이프, 접근성)과 코딩 표준을 준수하도록 유도합니다. 이 스킬은 fswp-developer, fswp-security-engineer 스킬과 함께 사용되어 전체적인 개발 품질을 보장합니다.

지원 대상~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      name, title, category, attributes, supports, render, editorScript, viewScriptModule, style
  edit.js         편집기 UI (useBlockProps 사용)
  save.js         정적 마크업, 또는 동적 블록을 위해 생략
  render.php      동적 블록을 위한 서버 렌더링
  view.js         프론트엔드 동작 (모듈)
  style.scss / editor.scss

메타데이터에서 등록: register_block_type( __DIR__ . '/build/my-block' )를 init에서 호출 (init 콜백에는 이름 있는 함수 사용). "apiVersion": 3 (WordPress 6.3부터 현재) 설정하고 "$schema": "https://schemas.wp.org/trunk/block.json" 추가. 필드별 참고 자료는 블록 에디터 핸드북을 기준으로 검증: references/block-json.md.

결정 사항

질문선택
출력이 저장된 속성에만 의존정적 블록 (save.js)
출력이 실시간 데이터에 의존하거나, 재저장 없이 변경되어야 하거나, 로직 포함동적 블록 (render.php); save는 null 반환 또는 InnerBlocks만 반환
중첩된 콘텐츠InnerBlocks와 allowedBlocks, template 사용
속성을 데이터(포스트 메타, 사용자 정의 소스)에 바인딩블록 바인딩 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 객체)를 전달받습니다. 페이지에서 블록 인스턴스당 한 번 로드되므로, 그 안에서 함수나 클래스를 절대 선언하지 말고 다른 파일의 공유 코드를 호출하세요.
  • 스크립트 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.

관련 스킬