PluginBench
Skill
Official
Fail
Audit score 45

wp-plugin-development

wordpress/agent-skills

Develop WordPress plugins with architecture, hooks, security, and release guidance.

What is wp-plugin-development?

This skill guides plugin development from structure and lifecycle hooks through settings UI, data storage, security hardening, and release packaging. Use it when building, refactoring, or securing WordPress plugins targeting 6.9+ (PHP 7.2.24+).

  • Create and refactor plugin structure with proper bootstrap and namespacing
  • Register and manage hooks, actions, and filters
  • Implement activation, deactivation, and uninstall lifecycle with migrations
  • Build admin settings pages using the Settings API
  • Apply security baseline: nonces, capability checks, sanitization, escaping, and SQL safety
  • Package releases with build artifacts, readme, and assets

How to install wp-plugin-development

npx skills add https://github.com/wordpress/agent-skills --skill wp-plugin-development
Prerequisites
  • WordPress 6.9+ and PHP 7.2.24+
  • Node.js and bash for running detection scripts
  • WP-CLI for some workflows (optional but recommended)
  • Access to plugin repository root or target plugin path
Claude Code
Cursor
Windsurf
Cline

How to use wp-plugin-development

  1. 1.Run triage to detect the WordPress project: node skills/wp-project-triage/scripts/detect_wp_project.mjs
  2. 2.Detect plugin headers and entrypoints: node skills/wp-plugin-development/scripts/detect_plugins.mjs
  3. 3.Follow plugin architecture guidelines: single bootstrap file, lazy-load on hooks, separate admin code
  4. 4.Implement activation/deactivation/uninstall hooks at top-level scope, not nested in other hooks
  5. 5.Use Settings API (register_setting, add_settings_section, add_settings_field) for options and admin UI
  6. 6.Apply security baseline: validate/sanitize input early, escape output late, use nonces and capability checks, use wpdb->prepare() for SQL
  7. 7.Test plugin activation, settings save/read, uninstall data cleanup, and run repo lint/tests

Use cases

Good for
  • Building a new WordPress plugin from scratch with proper architecture
  • Adding settings pages and admin UI to an existing plugin
  • Implementing security fixes for nonce validation and input sanitization
  • Setting up plugin activation/deactivation hooks and database migrations
  • Packaging and releasing a plugin with proper documentation and assets
Who it's for
  • WordPress plugin developers
  • Full-stack developers extending WordPress sites
  • DevOps engineers managing WordPress multisite deployments
  • Security-focused developers hardening plugin code

wp-plugin-development FAQ

When should I use this skill?

Use it for plugin creation, refactoring, adding hooks/settings, security fixes, and release packaging. It covers WordPress 6.9+ with PHP 7.2.24+.

What are the main security requirements?

Always validate/sanitize input early, escape output late, use nonces for CSRF prevention, enforce capability checks for authorization, and use wpdb->prepare() for SQL queries.

How do I handle plugin activation and migrations?

Register activation/deactivation hooks at top-level in the main plugin file, not nested. Flush rewrite rules only after registering CPTs. Write explicit uninstall routines and store schema versions for upgrades.

Should I use custom database tables or options?

Prefer options for small configuration data. Use custom tables only when necessary. For any schema changes, write upgrade routines and track schema version.

What should I verify before shipping?

Ensure plugin activates without fatals/notices, settings save/read with nonce and capability enforcement, uninstall removes only intended data, and all repo lint/tests pass.

Full instructions (SKILL.md)

Source of truth, from wordpress/agent-skills.


name: wp-plugin-development description: "Use when developing WordPress plugins: architecture and hooks, activation/deactivation/uninstall, admin UI and Settings API, data storage, cron/tasks, security (nonces/capabilities/sanitization/escaping), and release packaging." compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Filesystem-based agent with bash + node. Some workflows require WP-CLI."

WP Plugin Development

When to use

Use this skill for plugin work such as:

  • creating or refactoring plugin structure (bootstrap, includes, namespaces/classes)
  • adding hooks/actions/filters
  • activation/deactivation/uninstall behavior and migrations
  • adding settings pages / options / admin UI (Settings API)
  • security fixes (nonces, capabilities, sanitization/escaping, SQL safety)
  • packaging a release (build artifacts, readme, assets)

Inputs required

  • Repo root + target plugin(s) (path to plugin main file if known).
  • Where this plugin runs: single site vs multisite; WP.com conventions if applicable.
  • Target WordPress + PHP versions (affects available APIs and placeholder support in $wpdb->prepare()).

Procedure

0) Triage and locate plugin entrypoints

  1. Run triage:
    • node skills/wp-project-triage/scripts/detect_wp_project.mjs
  2. Detect plugin headers (deterministic scan):
    • node skills/wp-plugin-development/scripts/detect_plugins.mjs

If this is a full site repo, pick the specific plugin under wp-content/plugins/ or mu-plugins/ before changing code.

1) Follow a predictable architecture

Guidelines:

  • Keep a single bootstrap (main plugin file with header).
  • Avoid heavy side effects at file load time; load on hooks.
  • Prefer a dedicated loader/class to register hooks.
  • Keep admin-only code behind is_admin() (or admin hooks) to reduce frontend overhead.

See:

  • references/structure.md

2) Hooks and lifecycle (activation/deactivation/uninstall)

Activation hooks are fragile; follow guardrails:

  • register activation/deactivation hooks at top-level, not inside other hooks
  • flush rewrite rules only when needed and only after registering CPTs/rules
  • uninstall should be explicit and safe (uninstall.php or register_uninstall_hook)

See:

  • references/lifecycle.md

3) Settings and admin UI (Settings API)

Prefer Settings API for options:

  • register_setting(), add_settings_section(), add_settings_field()
  • sanitize via sanitize_callback

See:

  • references/settings-api.md

4) Security baseline (always)

Before shipping:

  • Validate/sanitize input early; escape output late.
  • Use nonces to prevent CSRF and capability checks for authorization.
  • Avoid directly trusting $_POST / $_GET; use wp_unslash() and specific keys.
  • Use $wpdb->prepare() for SQL; avoid building SQL with string concatenation.

See:

  • references/security.md

5) Data storage, cron, migrations (if needed)

  • Prefer options for small config; custom tables only if necessary.
  • For cron tasks, ensure idempotency and provide manual run paths (WP-CLI or admin).
  • For schema changes, write upgrade routines and store schema version.

See:

  • references/data-and-cron.md

Verification

  • Plugin activates with no fatals/notices.
  • Settings save and read correctly (capability + nonce enforced).
  • Uninstall removes intended data (and nothing else).
  • Run repo lint/tests (PHPUnit/PHPCS if present) and any JS build steps if the plugin ships assets.

Failure modes / debugging

  • Activation hook not firing:
    • hook registered incorrectly (not in main file scope), wrong main file path, or plugin is network-activated
  • Settings not saving:
    • settings not registered, wrong option group, missing capability, nonce failure
  • Security regressions:
    • nonce present but missing capability checks; or sanitized input not escaped on output

See:

  • references/debugging.md

Escalation

For canonical detail, consult the Plugin Handbook and security guidelines before inventing patterns.