# AGENTS.md — Codex Playbook for Building a WordPress Plugin
> A precise, no-nonsense blueprint for orchestrating autonomous and semi-autonomous coding agents to plan, scaffold, implement, test, and ship a production‑grade WordPress plugin.
---
## 0) Purpose & Scope
This document defines the **agents**, **tools**, **workflows**, **constraints**, and **acceptance criteria** for using an agentic coding system ("Codex") to create and maintain a WordPress plugin. It is optimized for **real, shippable code**, not demos.
Outcomes:
* A production‑ready WordPress plugin following WP Coding Standards.
* **Goal:** Build admin screens with React + WP Scripts (or Vite w/ WP deps externals).
* **Artifacts:** `admin/` React app, enqueue via `wp_enqueue_script/style`, settings pages, components, forms with wp.data/wc.data if Woo, and REST integration.
### E. APIGatewayAgent (REST & Webhooks)
* **Goal:** Define REST routes, permissions callbacks, and (optionally) webhooks.
* **Checks:** Nonces or auth tokens, caps mapping, rate limiting where applicable.
### F. CLIAgent (WP‑CLI)
* **Goal:** Add WP‑CLI commands for power users & CI automation.
* **Artifacts:** `src/CLI/Commands.php` with subcommands, argument validation, exit codes.
### G. TestAgent (QA)
* **Goal:** Unit, integration (WP core bootstrap), e2e (Playwright) with headless Chromium.
* **Artifacts:** `tests/phpunit.xml`, `tests/`, GitHub Actions CI templates.
* Provide diffs/patches or exact file paths in outputs.
* Every change must include: rationale → code → tests → docs.
**Prompt scaffolds**:
* **PlannerAgent:**
* *"Given this brief: `project-brief.md`, enumerate functional/non‑functional requirements, risks, milestones, metrics, and a phased MVP plan. Output `PLAN.md` with tables and a Gantt‑style milestone list."*
* **ScaffolderAgent:**
* *"Generate a WordPress plugin skeleton named `logo-soup`. Include Composer (PSR‑4), Vite (or @wordpress/scripts), PHPCS (WPCS), PHPStan. Produce file tree and initial file contents. No placeholder TODOs—write minimal viable code."*
* **BackendAgent:**
* *"Implement feature `<feature>` behind capability `<cap>`. Add actions/filters, sanitize/validate, and unit tests. Return diff with file paths. Include acceptance tests for edge cases."*
* **FrontendAgent:**
* *"Create admin view `<view>` with React, using WP components. Implement controlled inputs, form validation, REST calls with nonce, and optimistic updates. Provide Playwright tests."*
* **APIGatewayAgent:**
* *"Define REST endpoint `<method> /<ns>/<route>` with schema, permission callback respecting `<cap>`. Include unit tests for auth and validation failures."*
* **CLIAgent:**
* *"Add WP‑CLI command `wp <ns> <cmd>` with flags `<flags>`. Validate args, handle errors gracefully, and return exit codes. Provide usage examples."*
* **TestAgent:**
* *"Write PHPUnit tests for `<class>` with edge cases. Bootstrap WP test suite. Add Playwright test for `<user flow>`. Ensure CI green."*
* **ReleaseAgent:**
* *"Prepare release `<version>`. Update plugin header + `readme.txt` stable tag, generate changelog (Conventional Commits), build zip, create Git tag and GitHub Release with assets."*
---
## 10) Acceptance Criteria (Definition of Done)
* ✅ Linting: PHPCS (WPCS) and ESLint pass with 0 errors.
The Logo Soup WordPress plugin is designed to provide users with an easy way to create and manage a collection of logos on their WordPress site. The plugin allows users to upload logos, add links, and display them in a format that implements the library found here: https://github.com/sanity-labs/logo-soup. The plugin is user-friendly and can be easily integrated into any WordPress theme.
## Features
- **Logo Upload**: Users can upload logos directly from the WordPress post/page editor.
- **Link Management**: Each logo can have an associated link that directs users to a specified URL when clicked.
- **Customizable Display**: Users can choose how the logos are displayed on their site, including options for layout and styling.
- **Responsive Design**: The plugin ensures that logos are displayed correctly on all devices, including desktops, tablets, and smartphones.
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.