wp-guard
它能做什么
这个智能体会检查 WordPress 插件、主题和区块代码在安全性、国际化、性能以及 API 使用是否正确等方面的问题。它能帮你避免 AI 生成代码时容易出现的常见问题。
适用场景
- ✓AI 智能体生成或修改了 WordPress 代码之后。
- ✓发布新的 WordPress 插件或主题之前。
- ✓审查现有代码,查找安全或翻译方面的漏洞时。
技能链接
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/wp-guard/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“帮我检查这段 WordPress 插件代码,确保它足够安全,并且方便翻译。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会分析代码,查找已知的安全漏洞,例如缺少安全防护、本应可翻译却写死的英文字符串,或者写得不好的数据库查询。随后,它会针对这些问题给出修改建议。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
⚠️ AUTHORIZED USE ONLY This skill is for educational purposes or authorized security assessments only. You must have explicit, written permission from the system owner before using this tool. Misuse of this tool is illegal and strictly prohibited.
Mandatory confirmation gate Before running any command that probes, exploits, changes, persists on, extracts data from, or attempts credential access against a target:
- Ask the user to state the exact target URL, IP, account, or resource.
- Ask the user to confirm written authorization and the permitted scope.
- Show the exact command(s) and explain their expected effect.
- Wait for explicit confirmation in the current conversation.
Without that confirmation, remain read-only and provide defensive guidance only. Prefer a sandbox, disposable VM, or controlled lab.
WP Guard
[!WARNING] Authorized Use Only. Review only WordPress code and environments the user owns or is explicitly authorized to assess. Keep checks non-destructive and inside the approved scope.
You are reviewing generated or changed WordPress code before it ships. Apply the rules below as a guard pass after the first implementation pass. Be a sharp reviewer, not a pedantic one: flag what creates vulnerabilities, breaks translations, or melts servers — ignore cosmetic preferences WPCS tooling already handles.
These rules exist because AI agents produce WordPress code with systematic failures: raw echo of request data, AJAX handlers with neither nonce nor capability check, SQL built by string interpolation, English hardcoded into user-facing strings, posts_per_page => -1 on sites with a million posts, and hand-rolled replacements for APIs core already ships. Each one looks fine in a demo and fails in production.
When to Use
Use this skill when reviewing generated or changed WordPress code — plugins, themes, and blocks — before it ships. Activate it reactively after an agent writes, edits, or reviews code touching WordPress APIs: hooks, custom post types, REST endpoints, database queries, and block editor integrations.
How to use this skill
Guard-pass mode (recommended): after WordPress code has been generated or edited, apply the rules to the diff or target files, then run the self-check before delivery. Fix violations before showing the user.
Live mode (explicit): when the user invokes this skill before writing WordPress code, apply the same rules while writing, then run the self-check before delivery.
Review mode (the user asks you to review, audit, or rate WordPress code): walk references/review-checklist.md against the target files and produce a structured findings report. Do not edit code in review mode unless asked.
Pair this skill with clean-code-guard when both are installed: clean-code-guard owns generic code quality; wp-guard owns the WordPress layer.
Adapt to the project first
- Read the project's agent instructions (CLAUDE.md, AGENTS.md),
phpcs.xml/WPCS config, andcomposer.json. Project conventions win on conflict. - Identify the established prefix (functions, options, meta keys, handles) and the minimum supported WP/PHP versions. Match both.
- Detect context: WooCommerce APIs in play → apply woo-guard alongside this skill when it is installed; otherwise apply WooCommerce's HPOS, CRUD, and checkout rules from its developer documentation. Multilingual site (WPML/Polylang/multisite) → i18n rules are blocking, not advisory.
- Read one neighboring file before writing. Mirror its error handling, hook registration style, and escaping habits — unless they violate the security rules below, which are non-negotiable.
The Rules
Security — must fix, no exceptions
- Escape late, escape everything. Every variable crossing into HTML output goes through the context-correct function:
esc_html(),esc_attr(),esc_url(), orwp_kses()/wp_kses_post()for rich content. Data passed to inline JS goes throughwp_json_encode()+wp_add_inline_script()—esc_js()is legacy, for single-quoted strings in inline attributes only. Escaping happens at output, not at storage.echo $anything;without anesc_*wrapper fails review.
…
常见问题
我为什么需要许可才能使用这个工具?
这个工具功能很强,可以用来查找安全漏洞。因此你只应在自己拥有或已获得明确授权测试的系统上使用,以免引发法律和道德问题。
什么是 “nonce” 和 “capability check”?
这两者都是 WordPress 的安全机制。“nonce” 用于确认请求确实来自预期的用户,且没有被篡改。“capability check” 则用于检查用户是否有权限执行所请求的操作。
“sanitize” 和 “escape” 数据是什么意思?
“Sanitize”(清理)是在接收数据时,去掉其中危险或无效的字符。“Escape”(转义)是在输出数据之前对其进行格式处理,使其不会被当作恶意代码(如 HTML 或 JavaScript)来执行。
详情
作者的原始描述
Review generated or changed WordPress plugins, themes, and blocks for security, internationalization, performance, and API correctness.
热度
- GitHub 星标
- 48k
- 排名
- #6205
- 许可证
- MIT
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
00-andruia-consultant
48k帮你的智能体启动或改进 AI 项目。它可以分析代码、推荐工具,并用西班牙语制定行动计划。
007
48k让你的智能体执行安全审计和威胁建模。它有助于保护项目免受攻击和漏洞的威胁。
10-andruia-skill-smith
48k帮你的智能体创建或改进 AI 工具。它可以定义工具的工作方式、编写文档,并验证其结构。
20-andruia-niche-intelligence
48k让你的智能体创建某个特定行业的摘要。它有助于借助可靠的信息来源,了解项目的背景、规则、使用模式和风险。