security
Securing WordPress Plugins with the wp-plugin-security Agent Skill
A practical skill for AI agents to enforce WordPress security: sanitization, escaping, nonces, and more, based on real CVEs.
Where this fits
You're building a WordPress plugin that accepts user input, renders dynamic HTML, and registers an AJAX endpoint. The code works, but you're not sure if you've covered every security boundary. Instead of manually cross-referencing the WordPress Developer Handbook, you can hand that review to an AI agent equipped with the wp-plugin-security skill. It encodes the same rules—sanitization, validation, escaping, nonces, capabilities, SQL injection prevention, XSS and CSRF mitigation—into concrete, checkable guidelines. The skill is especially useful after a security incident like CVE-2026-81754, where a missing capability check led to privilege escalation. It turns a vague "be careful" into a structured checklist your agent can execute.
Why agents benefit
- Audits code against WordPress-specific rules, not generic security advice. The skill knows the difference between
esc_html,esc_attr, andesc_url, and when to usesanitize_text_fieldvs.sanitize_email. - Detects missing nonces and capability checks in AJAX and REST handlers, flagging both the absence and the incorrect usage (e.g., checking
current_user_canagainst a post object instead of a capability). - Validates escaping in admin JavaScript, catching
innerHTMLassignments and unescapedwp_localize_scriptdata—areas often overlooked in PHP-centric reviews. - Enforces multisite privilege boundaries, such as preventing file writes outside the uploads directory or ensuring network-wide operations respect site IDs.
- Suppresses PHPCS security sniffs deliberately, but requires justification. The skill forces the agent to explain why a suppression is safe, preventing blind
// phpcs:ignorecomments.
Practical scenarios
Reviewing a plugin before release
You've written a settings page that saves user input to the database and echoes it back. The agent runs the skill, flags three missing esc_html() calls, one unvalidated nonce, and suggests using sanitize_option for a custom option. It also catches a SQL injection in a $wpdb->get_results call where you interpolated a variable directly.
Auditing a legacy plugin after a vulnerability disclosure
Your team maintains a plugin that was affected by CVE-2026-81754. You ask the agent to apply the skill to the affected file. It identifies the missing capability check on an AJAX action and also finds a second instance where an object's ID was used as a capability, not the required edit_post.
Adding security to a new API endpoint
You're building a REST endpoint that accepts file uploads. The agent uses the skill to verify wp_handle_upload is used, that the endpoint checks current_user_can('upload_files'), and that the response is escaped with wp_json_encode and proper headers.
Add it to your agent workflow
Install the skill with:
npx skills add fernandotellado/ai-skills --skill wp-plugin-security
Then, in your agent prompt, reference the skill explicitly:
Use the wp-plugin-security skill to audit the file `includes/ajax-handler.php`. Focus on nonce verification, capability checks, and SQL injection. Output a list of findings with severity and suggested fixes.
The skill will guide the agent through each security layer and produce actionable results.
Compare before adopting
Before committing, evaluate the skill against alternatives. Check its maintenance freshness—it's based on official WordPress resources and a recent CVE review, so it's likely up to date. Compare it with generic security linters (e.g., PHPCS with WordPress-Core rules) to see if it adds value. Also assess whether your agent workflow can incorporate the skill's structured guidelines without too much overhead. The GitHub repo has 40 stars and a clear license (GPL-2.0), which is a good sign, but verify the skill's version and compatibility with your WordPress/PHP environment.
Why it is worth tracking
This skill is more than a checklist—it's a living reference tied to real incidents. Its basis in CVE-2026-81754 means it reflects lessons from an actual exploit, giving you confidence that it covers edge cases that generic tutorials miss. The author, fernandotellado, maintains the skill actively (v1.2 as of now), and the community has shown interest (40 stars). If you build or maintain WordPress plugins, this skill is worth evaluating now, and you can track its updates on its OpenAgentSkill page to see when new security patterns are added. Given the high cost of a WordPress vulnerability, having an agent that can systematically apply these rules is a practical investment.
Featured Skill
wp-plugin-security
Skill by fernandotellado