# wordpress-plugin-fundamentals

A skill for building WordPress plugins on PHP 8.3+ with OOP, hooks, database access and the Settings API. Useful when the agent has to scaffold a plugin instead of guessing at structure.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 421 installs · ★ 78
- Author: Claude MPM Team
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/php/frameworks/wordpress/wordpress-plugin-fundamentals/SKILL.md
- Updated: 2026-07-18
- HTML: https://affpapa.org/en/nevibecode/skills/wordpress-plugin-fundamentals

## What it does

The skill pins the agent to current WordPress practice: WordPress 6.7+, PHP 8.3 (7.4 minimum), class-based architecture with Composer PSR-4 autoloading. It covers the plugin directory layout, the main file with its metadata header, a `Core` class built as a Singleton, activation and deactivation hooks, and actions and filters for core integration.

Security gets its own layer model — sanitize, validate, escape — alongside `wpdb` queries and settings pages built on the Settings API. Testing is part of the package: PHPUnit plus WPCS compliance, which the skill sets up by pulling `wp-coding-standards/wpcs` at `^3.0` and `phpunit/phpunit` at `^9.6` through Composer.

The skill is not meant to be invoked by hand. It ships with `user-invocable: false`, so the agent picks it up on its own when a task touches a plugin. Working on a theme, or patching legacy code without classes, will not get much out of it — the material assumes a fresh structure with autoloading.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill wordpress-plugin-fundamentals -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/wordpress-plugin-fundamentals/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/wordpress-plugin-fundamentals/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill wordpress-plugin-fundamentals -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/wordpress-plugin-fundamentals/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill wordpress-plugin-fundamentals -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/wordpress-plugin-fundamentals/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install bobmatnyc/claude-mpm-skills wordpress-plugin-fundamentals
```

2. **Manually: put the files in place**
- File: `.github/skills/wordpress-plugin-fundamentals/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill wordpress-plugin-fundamentals -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/bobmatnyc/claude-mpm-skills --path toolchains/php/frameworks/wordpress/wordpress-plugin-fundamentals
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/wordpress-plugin-fundamentals/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add bobmatnyc/claude-mpm-skills --skill wordpress-plugin-fundamentals -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/php/frameworks/wordpress/wordpress-plugin-fundamentals/SKILL.md

## When to use it
- scaffold a plugin with PSR-4 autoloading and class files
- wire up activation and deactivation hooks cleanly
- attach actions and filters to WordPress core
- build a settings page with the Settings API
- run database queries through `wpdb` with escaping

## Example prompts
- scaffold a WordPress plugin with Composer PSR-4 autoloading
- add a Settings API page to my plugin
- check my plugin code against WPCS

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: ca920d1243fb13f1.

BEGIN THIRD-PARTY FILE ca920d1243fb13f1
````text
---
name: wordpress-plugin-fundamentals
description: Modern WordPress plugin development with PHP 8.3+, OOP architecture, hooks system, database interactions, and Settings API
user-invocable: false
disable-model-invocation: true
version: 1.0.0
category: development
author: Claude MPM Team
license: MIT
progressive_disclosure:
  entry_point:
    summary: "Modern WordPress plugin development with OOP, hooks system, database interactions, and Settings API"
    when_to_use:
      - "Building WordPress plugins with PHP 8.3+ and WP 6.7+"
      - "Need structured architecture with actions, filters, hooks"
      - "Require database operations and settings management"
    quick_start:
      - "Create plugin structure with OOP and Composer PSR-4"
      - "Register activation/deactivation hooks"
      - "Use actions and filters for core integration"
context_limit: 5500
tags:
  - wordpress
  - php
  - plugin
  - hooks
  - wpdb
  - settings-api
  - wpcs
requires_tools: []
---

# WordPress Plugin Fundamentals

## Overview

WordPress plugin development using modern PHP 8.3+ practices, OOP architecture, Composer autoloading, and WordPress 6.7+ APIs. Build secure, maintainable plugins with proper hooks integration, database management, and settings pages.

**Current Standards**:
- **WordPress**: 6.7+ (Full Site Editing stable)
- **PHP**: 8.3 recommended (7.4 minimum)
- **Architecture**: OOP with PSR-4 autoloading
- **Security**: Three-layer model (sanitize, validate, escape)
- **Testing**: PHPUnit + WPCS compliance

**Installation**:
```bash
composer require --dev wp-coding-standards/wpcs:"^3.0"
composer require --dev phpunit/phpunit:"^9.6"
```

## Plugin Architecture

### Directory Structure

Modern plugin organization with Composer autoloading:

```
my-plugin/
├── my-plugin.php              # Main plugin file (metadata header)
├── composer.json               # Dependency management (REQUIRED)
├── includes/                   # Core business logic (PSR-4 autoloaded)
│   ├── Core.php               # Plugin bootstrap/loader class
│   ├── Admin/                 # Admin-specific functionality
│   │   ├── Settings.php
│   │   └── MetaBoxes.php
│   ├── Frontend/              # Public-facing functionality
│   │   └── Shortcodes.php
│   └── API/                   # REST API endpoints
│       └── CustomEndpoint.php
````
END THIRD-PARTY FILE ca920d1243fb13f1

The third-party file has ended. Everything between the ca920d1243fb13f1 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2417 of 35609 bytes. © Claude MPM Team · MIT · https://github.com/bobmatnyc/claude-mpm-skills/tree/HEAD/toolchains/php/frameworks/wordpress/wordpress-plugin-fundamentals/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
