Introduction¶
When building WordPress plugins, the common challenges aren’t usually about “whether a feature can be coded,” but rather about missing details in lifecycle management, backend settings, and security. Common issues include incorrect registration location for activation hooks, the Settings API not being connected to sanitize, and incomplete data cleanup during uninstallation. While the official Plugin Handbook and security documentation are comprehensive, an Agent often has to stitch the sequence together by consulting multiple documents when modifying code.
Here, we introduce wp-plugin-development from the official WordPress Agent Skills repository. It organizes plugin architecture, Hooks, the Settings API, data and cron jobs, security baselines, and release packaging into actionable steps and a reference documentation index. It complements the Block Development skills in the same repository—one covering the traditional plugin battlefield, and the other covering block-side development.
What is this¶
wp-plugin-development is a Skill located under WordPress/agent-skills, targeting the plugin development workflow “from initial architecture to release packaging.”
The description in the Skill’s metadata summarizes it as: Use when developing WordPress plugins, covering architecture and Hooks, activation/deactivation/uninstallation, admin UI and the Settings API, data storage, cron jobs, security (nonces, capabilities, sanitization and escaping), and release packaging.
Compatibility and Environment (Based on the SKILL front matter):
- Targets WordPress 7.0+, PHP 7.4.0+
- Filesystem-based Agent, requires bash + node
- Some workflows require WP-CLI
Core Features¶
The following capabilities are derived from the official SKILL content, organized in recommended execution order.
Project Triage and Plugin Entry Point Identification¶
- Run the project triage script:
node skills/wp-project-triage/scripts/detect_wp_project.mjs
- Scan for plugin header information (deterministic scan):
node skills/wp-plugin-development/scripts/detect_plugins.mjs
If the repository is a whole site, you should first select a specific plugin under wp-content/plugins/ or mu-plugins/ before modifying code.
Predictable Plugin Architecture¶
- Single bootstrap file (main file with plugin header)
- Avoid heavy side effects during file loading; load via Hooks
- Prioritize using a separate loader/class to register Hooks
- Place admin code behind
is_admin()or admin-specific Hooks to reduce frontend overhead
See references/structure.md within the Skill for detailed conventions.
Hooks and Lifecycle¶
Activation-related Hooks are error-prone. Constraints provided officially include:
- Register activation/deactivation Hooks at the top level; do not nest them inside other Hooks
- Flush rewrite rules only when necessary, and only after registering CPTs/rules
- The uninstall path must be explicit and safe:
uninstall.phporregister_uninstall_hook
See references/lifecycle.md.
Settings API and Admin UI¶
Prioritize using the Settings API to manage options:
register_setting(),add_settings_section(),add_settings_field()- Perform sanitization via
sanitize_callback
See references/settings-api.md.
Security Baseline¶
Check the following by default before release:
- Validate/sanitize input early, escape output before display
- Use Nonces for CSRF protection and simultaneously use capabilities for authorization
- Do not trust
$_POST/$_GETdirectly; usewp_unslash()and only retrieve explicit keys - Use
$wpdb->prepare()for SQL to avoid string concatenation in SQL
See references/security.md.
Data Storage, Cron, and Migration (As needed)¶
- Prefer options for small configurations; use custom tables only when necessary
- Cron tasks should be idempotent and provide a manual execution path (WP-CLI or admin)
- Table structure changes must have an upgrade routine and record the schema version
See references/data-and-cron.md.
Validation and Common Failures¶
Validation Checklist: Plugin activates without fatal errors/notices; settings are readable/writable and capability + nonce work; uninstall only removes intended data; if the repo has PHPUnit/PHPCS or frontend builds, they should pass.
Typical Failures (Excerpt):
- Activation Hook not triggering: Registration is not in the main file scope, main file path is incorrect, or it involves network activation, etc.
- Settings not saving:
register_settingnot called, incorrect option group, missing capability, nonce failure - Security regressions: Having nonce without capability, or input is sanitized but output is not escaped
See references/debugging.md. For deeper details, consult the Plugin Handbook and security guidelines rather than inventing patterns.
Installation and Activation¶
The installation method listed on officialskills.sh is:
npx skills add https://github.com/WordPress/agent-skills --skill wp-plugin-development
You can also provide the Skill directory link to a coding assistant that supports Agent Skills for installation:
https://github.com/WordPress/agent-skills/tree/trunk/skills/wp-plugin-development
The materials do not distinguish installation differences between Cursor, Codex CLI, and Claude Code; use the aforementioned npx skills add and repository path as the standard.
Typical Usage¶
Before starting plugin-related tasks, the Agent should be provided with:
- Repository root directory and target plugin path (if known, the main plugin file path)
- Runtime environment: Single site or Multisite; whether WP.com conventions apply
- Target WordPress and PHP versions (affects APIs and
$wpdb->prepare()placeholder behavior, etc.)
Applicable Work Examples (Official “When to use”):
- Create or refactor plugin structure (bootstrap, includes, namespaces/classes)
- Add actions/filters
- Activation/deactivation/uninstallation behaviors and migrations
- Settings pages, options, admin UI (Settings API)
- Security fixes (nonces, capabilities, sanitization/escaping, SQL safety)
- Release packaging (build artifacts, readme, assets)
Use Cases and Notes¶
Suitable for: WordPress developers who need to systematically complete the full lifecycle of plugin development with Agent assistance; when combined with the Block Development Skill, it covers the two main lines of “Classic Plugins” and “Blocks” respectively.
Notes:
- Relies on node scripts for triage and plugin detection, requiring a bash and node environment
- Some workflows depend on WP-CLI; local or CI environments need it pre-installed
- Targets WordPress 7.0+ / PHP 7.4+; API and placeholder behavior may differ in older environments
Conclusion¶
wp-plugin-development codifies the recommended sequence of plugin development, entry points for reference documentation, and common failure modes into a single Skill, reducing the cost of manual cross-referencing between the Handbook and security documentation. Official directory:
https://github.com/WordPress/agent-skills/tree/trunk/skills/wp-plugin-development