agentleFS
SnoozleStudioSnoozleStudio/opencode-wp-settings/skills/wp-plugin/SKILL.md

wp-plugin

Skill4 starsChanged 3 days agoMITView on GitHub

Architect, scaffold, and extend enterprise-grade WordPress plugins. Use when creating a new plugin, adding plugin features (CPTs, settings pages, REST routes, admin/public split), or reviewing plugin structure. Covers file structure, main-file headers, activation/deactivation/uninstall semantics, options and transients discipline, REST API registration, and the WPCS verification chain.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    REST: read model, WP_REST_Response, rest_ensure_response

    line 51
  2. Very specific:

    Run the canonical 4-step chain — build → format:all:check → phpcs → phpstan, in order, stopping at the first red (see …

    line 55

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

WordPress Plugin — Enterprise Architecture

Build plugins that survive Plugin Review: correct contract semantics, no namespace pollution, enterprise-grade security. Load docs/wordpress-plugin-architecture.md and docs/wordpress-php-standards.md for the full reference.

Canonical structure

plugin-slug/
├── plugin-slug.php          # main file — ONLY file with the plugin header
├── uninstall.php            # guarded by WP_UNINSTALL_PLUGIN; permanent data removal
├── languages/               # load_plugin_textdomain path
├── includes/                # classes + shared functions (class-{name}.php, one per file)
├── admin/                   # admin-only code (still capability-checked)
└── public/                  # front-end code

Non-negotiables

  1. Prefix everything — functions myplugin_, classes Myplugin_Class, namespaces Prefix\Module, options/transients/hook names all prefixed (≥4 chars). Never wp_, __, _ prefixes. function_exists only for shared libraries.
  2. Lifecycle contract — activation: defaults, CPTs, flush_rewrite_rules(). Deactivation: temp data + flush rewrites. Deactivation is NOT uninstall — permanent data removal only in uninstall.php.
  3. Main file header — Plugin Name, Description, Version, Requires at least, Requires PHP, Author, License, Text Domain (slug with dashes), Domain Path.
  4. Security — escaping matrix at output, wp_unslash before sanitize, nonces paired with current_user_can(), $wpdb->prepare(), ABSPATH guard on every file with top-level code.
  5. i18n — every string translated, text domain last arg, translators comments.
  6. Data — Options API with autoload: false for large data; Transients for cached computed data; settings via Settings API (register_setting).
  7. REST — register on rest_api_init; namespace {vendor}/{version}; permission_callback on every non-public route; validate_callback + sanitize_callback per arg; WP_Error with machine-readable codes + status.

Common modules

  • CPT/CT registration: init hook, prefixed names, register_post_type args with show_in_rest, labels translated
  • Admin settings: Settings API, register_setting with sanitize callback, nonce via settings_fields
  • AJAX (classic): wp_ajax_ / wp_ajax_nopriv_ with check_ajax_referer + capability
  • REST: read model, WP_REST_Response, rest_ensure_response

Verification chain

Run the canonical 4-step chain — build → format:all:check → phpcs → phpstan, in order, stopping at the first red (see docs/verification-chain.md).

Scaffolding

For greenfield plugins, delegate to the scaffolder agent (templates/plugin/ is the source of truth — adapt, don't reinvent).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.