Communitygithub.com

syncwin/fswp-plugin-developer

FSWP 外掛開發階段的建置標準與程式碼模板,適用於真實 WordPress 外掛(非短代碼片段),涵蓋資料夾結構、啟用/解除安裝生命週期、自訂文章類型與資料表、管理 UI 層級、Atomic Framework 前端輸出、REST 與 cron、國際化、發行,以及 Tier 3 React 管理堆疊,並附帶腳本產生器。也作為附加元件的基礎結構。由 fswp-developer 在核准的 PRD 後調用;如需特定外掛建置模式,請直接查閱。

fswp-plugin-developer 是什麼?

FSWP Plugin Developer 是 Full-Stack WP Developer 技能套件中的一個專項技能,專注於真實 WordPress 外掛的建置階段。它提供了一套嚴格的標準與程式碼模板,涵蓋從外掛啟動、資料庫遷移、自訂文章類型與 REST 路由,到管理 UI 與前端輸出的完整生命週期。該技能支援多種 JS 技術堆疊(從原生 vanilla 到 Alpine 再到 React SPA),並強制遵循安全、國際化與發行標準。其核心工作流程包含 8 個明確定義的步驟,並透過引導式產生器與預設模板來減少重複勞動。它與 FSWP 生態系統中的其他技能(如安全工程師、API 開發者、區塊開發者)緊密協作,確保每個外掛都符合 WordPress.org 的發行要求與最佳實務。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/syncwin/fswp-developer/tree/main/skills/fswp-plugin-developer

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

FSWP Plugin Developer

基礎(一律套用): fswp-developer/references/lean-coding.md(少寫、優先重用)、fswp-developer/references/coding-standards.md(編碼標準、文件、國際化、無障礙),以及 fswp-security-engineer(輸入、輸出、授權)。

執行已核准的 PRD(fswp-architect)。前綴、發行目標、功能範圍與 JS 技術層級皆已決定;請勿再次詢問。對於每個步驟,請載入該領域技能的一般程序,以及此技能參考文件中的內部深度、模板與更嚴格的規則。優先順序:fswp-developer/references/precedence.md。

若要對現有外掛進行變更,請改用 fswp-maintainer;它會回調此處僅使用結構模式。

層級

1  BOOTSTRAP   plugin-slug.php、uninstall.php、includes/class-plugin.php(不含商業邏輯)
2  LIFECYCLE   啟用器 / 停用器(啟用鉤子、dbDelta、升級檢查)
3  DOMAIN      自訂文章類型、資料表、REST 路由、cron:僅限 PRD 所列出的項目
4a ADMIN UI    預設為原生 wp-admin;一個 React 畫面使用 @wordpress/components;
               僅限應用程式型管理介面使用 React SPA + Tailwind + TanStack Query + Zustand
4b PUBLIC UI   Atomic Framework(使用者提供)、預設為原生 JS,可選擇加入 Alpine

管理介面絕不使用 Atomic Framework 或 Alpine 類別。切勿建立未使用的功能類別。

工作流程

步驟執行內容內部參考文件領域技能
1 產生腳本衍生 slug、前綴、類別名稱、文字網域;先執行 scripts/scaffold_plugin.py --help。僅在真實情況下傳遞 --plugin-uri 與 --author-uri(否則會將該行移除,絕不使用佔位網域)。產生腳本後立即執行一次 fswp-qa-engineer/scripts/run_gate.sh <dir> <min-php> --fix:模板中包含 {{...}} 佔位符,格式化工具在替換前無法安全地重新排版本。architecture.md無
2 Bootstrap + 生命週期Bootstrap 宣告標頭、自動載入,並將控制權交給主類別architecture.md無
3 安全性每個檔案、每個外掛大小都執行完整的基線檢查fswp-security-engineerfswp-security-engineer
4 領域自訂文章類型、資料表(dbDelta、schema 版本)、REST、crondata-cpt.md、rest-cron.mdfswp-api-developer;當 PRD 需要時為 fswp-performance-engineer
5 區塊(若 PRD 包含)自訂區塊、模式、互動性無fswp-block-developer
6 管理 UISettings API、WP_List_Table、Dashicons;僅依檢查清單升級admin-ui.md、modern-app-stack.md無
7 前端輸出先要求使用者提供目前的 Atomic Framework 檔案;在回呼內部進行條件式佇列frontend-output.md無
8 國際化 + 發行每個 PHP 與 JS 字串;readme;授權;版本控制i18n-distribution.mdfswp-release-manager(針對 WordPress.org)

步驟 8 結束後停止,並交給 fswp-qa-engineer。

附加元件結構

當 fswp-maintainer 以附加元件模式執行時,它會重複使用此處的步驟 1-3 與 8。額外的附加元件規則(主機偵測、Requires Plugins、載入順序、優雅地處理外掛不存在的情況)位於 fswp-maintainer。

標準(每次建置、每個迭代)

references/standards.md 規範了版本控制/變更日誌紀律、技術堆疊決策、必要專案中繼資料(絕對不憑空創造缺失值)、docs/ 中的每項功能文件、程式碼品質門檻,以及極簡程式碼紀律(先決定再撰寫的順序、根本原因修正、shortcut: 標記)。請在第一次建置前以及對現有外掛進行任何迭代前閱讀它——這不是一次性設定步驟。

安全姿態

絕不因小型外掛而縮減:對每個特權動作進行能力檢查、對每個狀態變更使用 nonce、淨化輸入與跳脫輸出、對每個查詢使用 $wpdb->prepare()、對每個 REST 路由使用真實的 permission_callback、安全生命週期、無明文秘密。完整規則:fswp-security-engineer。

Alpine 層級

絕不推論。僅由 references/frontend-output.md 中的 5 點檢查清單選擇,且僅在使用者明確確認已看到是哪個檢查觸發了它以及原生的替代方案如何之後。

Atomic Framework(使用者提供,不隨附)

這是一個單獨維護的產品;隨附副本會產生偏移。每當建置包含 frontend 時,要求提供目前的 afw-tokens.css、afw-components.css、afw-foundation-logics.js(以及 alpine.min.js、alpine-loader.js、alpine-components.js,僅在 Alpine 層級已確認時)。產生腳本會透過 --foundation-dir 複製它們,並在缺少時停止並顯示提醒。

相依性

除了 Atomic Framework 之外,所有項目(Tier 2 @wordpress/*、Tier 3 堆疊)在產生腳本時都從其官方註冊表解析為 latest,然後固定:提交鎖定檔,並在 README 中記錄已解析的版本。在產生腳本時為最新版本加上提交的鎖定檔,滿足 WordPress.org 的可重現原始碼規則。例外:使用者指定的相容性上限。詳細資訊:references/modern-app-stack.md。

交付成果

可安裝的 {plugin-slug}.zip(外掛資料夾位於 zip 根目錄)加上 readme.txt 和/或包含真實安裝步驟的私有 README.md,以及簡短摘要:前綴與功能決策、仍需手動執行的步驟(API 金鑰、cron 間隔、初始設定)。編譯後的輸出與其來源一起提供(references/modern-app-stack.md)。

隨附內容

  • scripts/scaffold_plugin.py:--features cpt,db,rest,cron,admin,frontend(任意子集)、--js-tier vanilla|alpine、--admin-tier native|react|app、--distribution wporg|private|both、--plugin-uri、--author-uri、--foundation-dir、--zip。
  • assets/templates/:包含 {{PREFIX}}、{{Prefix}}、{{prefix}}、{{PLUGIN_NAME}}、{{plugin-slug}} 佔位符的外掛骨架。

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-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.

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.

相關技能