Community编程与开发github.com

全栈WordPress DevOps工程师

为Full-Stack WP Developer中的WordPress开发工具提供领域技能,涵盖本地环境、命令行操作、编码标准、静态分析和测试设置。

全栈WordPress DevOps工程师 是什么?

该技能为AI代理(如Claude Code、Cursor)提供了全面的WordPress开发运维能力。它专注于在`fswp-devops-engineer`代理环境中设置、运行和自动化WordPress开发和测试环境。核心功能包括:使用`@wordpress/env`(wp-env)在Docker中管理完整的本地WordPress环境,以及使用WordPress Playground和Blueprint创建一次性可共享站点。它详细说明了WP-CLI命令用于插件/主题管理、数据库操作、cron和搜索替换。该技能还涵盖了使用PHPCS(WordPress标准)和PHPStan(WordPress存根)进行编码标准和静态分析的配置,以及使用`wp-phpunit`和`@wordpress/scripts`工具链进行PHP和JavaScript测试的设置。它作为一份操作指南,适用于依赖Docker、Node.js和Composer的环境,并假设基本的开发者工具链已就位。

兼容平台~Claude Code~Codex CLI~Cursor
Part ofMobile
npx skills add https://github.com/syncwin/fswp-developer/tree/main/skills/fswp-devops-engineer

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

FSWP DevOps工程师

优先选择能证明声称的最轻量级工具。任何此处无法运行的检查都应报告为“未运行”,并附带用户可运行的命令(由fswp-qa-engineer处理)。

本地环境

需求工具
完整的Docker化WordPress、PHP测试、挂载多个插件/主题@wordpress/env (wp-env)
在浏览器或Node中即时创建的临时站点、冒烟测试、可分享的演示WordPress Playground,配合Blueprint配置
用户已在运行的现有本地栈使用其现有环境;不要添加第二个

wp-env (需要Docker和Node):从项目根目录运行 npx @wordpress/env start。使用 .wp-env.json 配置:

{
  "core": null,
  "phpVersion": "8.2",
  "plugins": [ "." ],
  "themes": [],
  "config": { "WP_DEBUG": true, "WP_DEBUG_LOG": true }
}

有用的命令:npx @wordpress/env run cli wp plugin list, ... stop, ... clean, ... destroy。用它来验证fswp-qa-engineer无法静态检查的激活、停用、卸载和升级路径。

Playground: Blueprint是描述站点的JSON:

{
  "$schema": "https://playground.wordpress.net/blueprint-schema.json",
  "landingPage": "/wp-admin/",
  "preferredVersions": { "php": "8.3", "wp": "latest" },
  "steps": [ { "step": "login" } ]
}

添加诸如安装插件或主题、写入文件和设置选项等步骤;在编写前阅读Playground文档以了解当前的步骤名称。Playground速度很快,但不是完整的服务器:不要将其作为cron、邮件或文件系统密集型行为的证据。

步骤列表、资源类型及完整命令表:references/blueprints-and-cli.md。

命令行操作 (WP-CLI)

来自Shell的站点操作:wp plugin install|activate|deactivate|delete, wp theme ..., wp option get|update, wp post ..., wp user ..., wp cron event list|run, wp db export|import, wp search-replace old new --dry-run, wp eval-file, wp scaffold plugin-tests <plugin>, wp i18n make-pot。规则:在任何破坏性命令之前执行 wp db export;始终先对 search-replace 使用 --dry-run 进行试运行;在调试加载错误时使用 --skip-plugins --skip-themes;仅在一次性环境中以Web用户身份运行或使用 --allow-root。(WP-CLI是WordPress基金会项目;本文档是对其的描述性引用。)

编码标准 (PHPCS)

使用Composer安装:wp-coding-standards/wpcs, dealerdirect/phpcodesniffer-composer-installer, phpcompatibility/phpcompatibility-wp。最简 .phpcs.xml.dist:

<?xml version="1.0"?>
<ruleset name="Project">
  <file>.</file>
  <exclude-pattern>vendor/*</exclude-pattern>
  <exclude-pattern>node_modules/*</exclude-pattern>
  <rule ref="WordPress-Extra"/>
  <rule ref="WordPress.WP.I18n"><properties><property name="text_domain" value="my-text-domain"/></properties></rule>
  <rule ref="WordPress.NamingConventions.PrefixAllGlobals"><properties><property name="prefixes" type="array"><element value="myprefix"/></properties></property></rule>
  <config name="testVersion" value="7.4-"/>
  <rule ref="PHPCompatibilityWP"/>
</ruleset>

phpcs 报告问题;phpcbf 可安全修复部分(需审查差异)。fswp-qa-engineer/scripts/setup_toolchain.sh 可在缺失Composer的环境中安装PHPCS和PHPStan。

静态分析 (PHPStan)

phpstan.neon 以 php-stubs/wordpress-stubs 作为启动引导(或使用 szepeviktor/phpstan-wordpress 扩展),以级别5作为关卡,新代码使用更高级别。存根WordPress或插件在运行时定义的常量。对于遗留代码可接受基线文件,但新代码不允许。

测试

  • PHP单元和集成测试: 使用 wp-phpunit/wp-phpunit 和 yoast/phpunit-polyfills,通过 wp scaffold plugin-tests 生成;在wp-env中运行。需要WordPress的测试使用 WP_UnitTestCase。
  • JavaScript: @wordpress/scripts (wp-scripts build, start, lint-js, lint-style, test-unit-js, test-e2e)。
  • 端到端: 使用Playwright配合WordPress e2e辅助工具,针对wp-env运行,测试关键流程(设置保存、块插入、结账路径)。

CI概览(预留用于GitHub工作)

流水线应遵循的顺序:安装、PHPCS、PHPStan、最小和最大PHP版本上的PHP测试、JS lint/构建/测试、打包、上传工件。在启用GitHub集成之前,不要创建工作流文件(参考 fswp-developer/references/github-foundation.md)。

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

相关技能