Security guidance for AI coding agents that write or review WordPress plugins and themes.
AI agents often produce WordPress code that works but skips the basics: nonce checks, capability checks, output escaping, prepared SQL queries. These skills give agents such as Claude Code, Cursor, Codex, OpenCode, and Gemini CLI the rules, examples, and checklists they need to write secure code by default and to audit existing code properly.
What you get
- 27 focused skills, one per security topic, each with wrong-vs-right code examples and a checklist.
- A structured audit workflow that separates confirmed vulnerabilities from open questions and hardening advice, with evidence-based severity.
- Links to the official WordPress documentation for every API the skills rely on.
What this is not
- Not a WordPress plugin, a scanner, or runtime protection for a website.
- Not a guarantee of secure output. Skills improve the instructions an agent follows; you still review the code it produces.
Quick start · Using the skills · Skills · Manual installation · Contributing · Report a vulnerability
Requires Node.js. Run this in the project where you want the skills:
# Choose skills and install scope interactively
npx skills add wpultimatesecurity/WordPress-Security-Skills
# Install all skills without prompts
npx --yes skills add wpultimatesecurity/WordPress-Security-SkillsOpen your AI coding agent in your WordPress project and paste:
Install the WordPress security skills from
https://github.com/wpultimatesecurity/WordPress-Security-Skills for this project.
Use this agent's supported skills location (project scope unless I say global).
Copy each skill directory with its references. Keep my existing skills and ask
before replacing anything with the same name. Do not change my WordPress site,
commit, or push. When done, list the installed skills and where they are, and
confirm the agent can discover them.
Add "install them globally" if you want the skills in every project. Pick one scope to avoid duplicate copies.
Restart or reload your agent if needed, then ask:
Which WordPress security skills can you see, and where were they loaded from?
If your agent does not support skills, ask it to read the relevant SKILL.md file and its
linked references before starting work.
Once installed, agents load the right skill automatically based on the task. You can also name a skill directly.
Writing new code. Start with
secure-plugin-development. It sets the secure
baseline and routes the agent to the focused skills it needs.
Add a REST endpoint that lets editors bulk-update post meta. Follow the
WordPress security skills.
Reviewing existing code. Start with
security-auditing-code-review.
Use the WordPress security skills to review this plugin. Start read-only:
map entry points and permission checks, then report confirmed findings with
file/line, who can exploit each one, impact, and a fix. List open questions
and hardening suggestions separately. Propose a plan before editing anything.
Tips for better results
- Give context. Your WordPress and PHP versions, plugin or theme, multisite or WooCommerce, and which user roles matter. Never paste production credentials.
- Ask for evidence, not a score. Each finding should state the file and line, the role that can exploit it, the impact, and how to verify the fix.
- Keep changes reversible. Review the diff, test locally or on staging, and keep a backup before deploying. Installing skills does not authorize an agent to change a live site.
Each skill targets a specific mistake AI agents make in WordPress code.
| Skill | Use it when | What it prevents |
|---|---|---|
secure-plugin-development |
Starting any new plugin or feature | Missing ABSPATH guards, work done before checks, hand-rolled SQL and HTTP instead of core APIs |
security-auditing-code-review |
Auditing or reviewing existing code | Style-only reviews that miss real bugs, inflated severity, findings without fixes |
| Skill | Use it when | What it prevents |
|---|---|---|
input-sanitization-validation |
Reading $_GET, $_POST, or any request data |
Missing wp_unslash(), wrong sanitizer, trusting strip_tags(), no validation |
output-escaping |
Printing anything into HTML, attributes, URLs, or JavaScript | Cross-site scripting (XSS) from unescaped or wrongly escaped output |
sql-injection-prevention |
Writing custom $wpdb queries |
SQL injection from concatenated input or misused prepare() |
object-injection-deserialization |
Handling serialized data | unserialize() on attacker-controlled data |
| Skill | Use it when | What it prevents |
|---|---|---|
capability-permission-checks |
Deciding who may do something | Role checks instead of capabilities, hidden UI instead of real checks, missing per-object checks |
nonces-csrf-protection |
Handling forms and state-changing requests | Cross-site request forgery (CSRF), and nonces used as a substitute for permission checks |
authentication-session-security |
Building login, 2FA, or session features | Custom password checks, unthrottled logins, sessions that survive password or role changes |
| Skill | Use it when | What it prevents |
|---|---|---|
rest-api-security |
Registering REST routes | __return_true permission callbacks on writes, unvalidated arguments |
ajax-security |
Adding admin-ajax.php handlers |
Missing nonces, privileged actions exposed to logged-out users |
settings-options-security |
Building settings pages or storing options | Settings saved without sanitization, options printed unescaped |
shortcode-block-security |
Writing shortcodes or dynamic blocks | Unescaped attributes, trusting shortcode_atts() to sanitize |
gutenberg-block-editor-security |
Building block editor features | Unescaped render callbacks, REST fields without permission checks, unsafe editor JavaScript |
wp-cli-security |
Writing WP-CLI commands | SQL built from CLI arguments, assumed admin context, printed secrets |
cron-background-job-security |
Scheduling cron or background jobs | Permission checks that cannot work in cron, secrets in job arguments |
| Skill | Use it when | What it prevents |
|---|---|---|
file-upload-security |
Accepting file uploads | Executable uploads, trusted client MIME types, path traversal |
filesystem-security |
Reading, writing, or deleting files | File paths built from input, including user-controlled files |
http-api-ssrf-prevention |
Fetching remote URLs | Server-side request forgery (SSRF) to internal hosts |
| Skill | Use it when | What it prevents |
|---|---|---|
user-data-protection-privacy |
Storing personal data | No GDPR export/erase support, full IP storage, personal data shown to the wrong users |
secrets-credentials-management |
Handling API keys, tokens, or passwords | Hardcoded keys, reversible password storage, tokens in logs |
| Skill | Use it when | What it prevents |
|---|---|---|
multisite-security |
Code runs on multisite networks | Site and network permissions confused, untrusted blog_id, data leaking between sites |
woocommerce-security |
Extending WooCommerce | Orders exposed to the wrong users, stored payment data, leaked customer data |
ai-llm-integration-security |
Adding AI or LLM features | Unescaped model output, AI tools without permission checks, provider keys in the browser |
| Skill | Use it when | What it prevents |
|---|---|---|
wp-hardening-best-practices |
Configuring wp-config.php and the server |
Debug output in production, the file editor left on, executable uploads, loose permissions |
security-headers-csp |
Setting HTTP headers, CSP, CORS, or cookies | Missing headers, permissive CSP, CORS that trusts any origin |
dependency-supply-chain-security |
Adding libraries, CDN assets, CI, or updaters | Outdated libraries, unpinned scripts, remotely loaded code, leaked release secrets |
Every skill has the same sections: when to use it, core principles, step-by-step instructions,
common AI mistakes with wrong and corrected code, a checklist, and official references. Longer
material lives in each skill's references/ folder and is loaded only when needed. Examples
are illustrations, not a drop-in plugin: adapt prefixes, capabilities, and storage to your
project.
Skills are plain folders. Copy the ones you want, or the whole skills/ folder, into your
agent's skills directory. Run these commands from a clone of this repository.
Claude Code
# All your projects
mkdir -p ~/.claude/skills && cp -r skills/* ~/.claude/skills/
# This project only (can be committed with the project)
mkdir -p .claude/skills && cp -r skills/* .claude/skills/Claude Code reads ~/.claude/skills/<name>/SKILL.md and .claude/skills/<name>/SKILL.md.
See the Claude Code skills docs.
Cursor
mkdir -p .cursor/skills && cp -r skills/* .cursor/skills/Cursor also reads .agents/skills/. See the Cursor skills docs.
OpenCode
# This project only
mkdir -p .opencode/skills && cp -r skills/* .opencode/skills/
# All your projects
mkdir -p ~/.config/opencode/skills && cp -r skills/* ~/.config/opencode/skills/OpenCode also reads the Claude Code locations. See the OpenCode skills docs.
Other agents (Codex, Gemini CLI, and others)
Any agent that implements the Agent Skills specification
can load these skills. Many read .claude/skills/ or .agents/skills/, so the Claude Code
commands above often work as they are. Check your agent's documentation for its skills path.
To update, pull the latest version of this repository, review the changes, and copy the skills again. Note the installed commit if you need reproducible results.
- Examples use PHP 7.4 syntax as a baseline. Newer WordPress or PHP requirements are noted where they apply. Use a supported PHP version and a maintained WordPress release in production.
- Skills follow the open Agent Skills specification:
each is a folder with a
SKILL.mdfile and areferences/folder.
- The skills guide development and review. They do not enforce security at runtime or prove that a site is secure.
- Automated checks in this repository validate structure, PHP syntax, and coding standards. They are not an independent security audit of every example.
- Always check API behavior against the WordPress and PHP versions you support.
Fixes and new skills are welcome. See CONTRIBUTING.md for the skill format, writing rules, and the requirement to verify every API against developer.wordpress.org.
This content is written with AI assistance under human direction. See docs/ai-authorship.md for what our validation does and does not establish.
To report a vulnerability or an insecure example, follow SECURITY.md.
- Security — Common APIs Handbook
- Plugin Security — Plugin Handbook
- Data Validation · Sanitizing · Escaping · Nonces
- Hardening WordPress
- WordPress Coding Standards
- OWASP Top Ten · OWASP Cheat Sheet Series
The audit workflow in security-auditing-code-review (verdicts, severity anchors, coverage
tracking, attack classes), and the AI/LLM and resource-exhaustion guidance, adapt ideas from
Cloudflare's MIT-licensed security-audit skill,
rewritten for WordPress.