Communitygithub.com

syncwin/fswp-plugin-developer

全栈 WordPress 插件开发构建阶段。提供真实 WordPress 插件的内部标准与代码模板,包含文件夹结构、激活/卸载生命周期、自定义文章类型与数据表、管理 UI 层次、基于 Atomic Framework 的前端输出、REST 与 cron、国际化、分发机制以及第三层 React 管理栈,并附带脚手架脚本。同时作为附加组件的基础结构。由 fswp-developer 在 PRD 批准后调用;如需特定插件构建模式,请直接参考此技能。

fswp-plugin-developer 是什么?

FSWP Plugin Developer 是一个专业的 AI 代理技能,专为生成性 AI 代码助手(如 Claude Code、Cursor、Codex)设计,用于构建真实、可发布的 WordPress 插件。它基于已批准的 PRD 执行,涵盖从引导加载、生命周期管理、领域建模(自定义文章类型、数据表、REST 路由、cron)、安全基线、到管理 UI(原生 wp-admin、React 单页应用或完整应用栈)、基于用户提供的 Atomic Framework 的前端输出、国际化与分发、以及块编辑器开发的完整工作流。该技能强制使用严格的编码标准、最小化代码原则、安全最佳实践,并通过预定义的脚手架脚本和模板(包含占位符替换)确保输出结构一致。对于现有插件的维护,应使用 fswp-maintainer 技能;该技能仅用于新插件构建或通过架构师批准的 PRD 启动主要功能添加。最终交付物为可安装的 zip 包,包含 readme.txt、README.md 和完整的源代码。

兼容平台~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  引导        plugin-slug.php、uninstall.php、includes/class-plugin.php(无业务逻辑)
2  生命周期    激活器/停用器(激活钩子、dbDelta、升级检查)
3  领域        自定义文章类型、数据表、REST 路由、cron:仅限 PRD 列出的内容
4a 管理 UI    默认为原生 wp-admin;对于单个 React 屏幕使用 @wordpress/components;
               仅当管理界面类似应用时才使用 React SPA + Tailwind + TanStack Query + Zustand
4b 公开 UI    Atomic Framework(用户提供),默认使用原生 JavaScript,可选 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 引导 + 生命周期引导声明文件头、自动加载,并将控制权交给主类architecture.md无
3 安全对每个文件、每个插件大小执行完整基线fswp-security-engineerfswp-security-engineer
4 领域自定义文章类型、数据表(dbDelta、模式版本)、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 i18n + 分发每个 PHP 和 JavaScript 字符串;readme;许可证;版本控制i18n-distribution.md对于 WordPress.org 使用 fswp-release-manager

在第 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 点检查表选择,并且仅在用户明确确认看到触发它的检查以及纯 JavaScript 替代方案的外观之后才能选择。

Atomic Framework(用户提供,不捆绑)

它是一个独立维护的产品;捆绑副本会漂移。每当构建包含 frontend 时,请求当前的 afw-tokens.css、afw-components.css、afw-foundation-logics.js(如果 Alpine 层级已确认,还需 alpine.min.js、alpine-loader.js、alpine-components.js)。脚手架通过 --foundation-dir 复制它们,并在缺失时发出提醒并停止。

依赖项

除 Atomic Framework 外(第 2 层 @wordpress/*、第 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.

相关技能