用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Dev-Toolbelt/dev-team-agents --skill wordpress命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | wordpress |
| description | WordPress core, plugin/theme development, and security hardening reference. |
wp-config.php, wp-content/, wp-includes/ in the project treefunctions.php inside a wp-content/themes/<theme>/ directoryPlugin Name: header comment in wp-content/plugins/<plugin>/composer.json requiring johnpbloch/wordpress or roots/wordpresswp CLI usage in scripts (wp-cli.yml, wp plugin, wp db)| Rule | Detail |
|---|---|
| Never edit WordPress core | Core files are overwritten on update. Extend via plugins/themes/hooks only. |
| Use hooks, not core patches | add_action() / add_filter() for all behavior changes. Never modify wp-includes/ or wp-admin/. |
| Prefix everything | Functions, classes, options, hooks, transients, and DB tables must use a unique prefix (myplugin_) — avoids collisions with other plugins/themes. |
| Enqueue, never hardcode | Load CSS/JS via wp_enqueue_script() / wp_enqueue_style() with proper dependency arrays and version strings (cache busting). Never <script>/<link> directly in templates. |
Use the $wpdb API or WP_Query | Avoid raw mysql_*/PDO connections outside WordPress's abstraction — breaks multisite/table-prefix portability. |
| Internationalize strings | Wrap user-facing text in __()/_e()/esc_html__() with a text domain matching the plugin/theme slug. |
| Child themes for customization | Never edit a parent/purchased theme directly — create a child theme (style.css with Template: header) so updates don't wipe changes. |
| Autoloader / namespaces for larger plugins | PSR-4 via Composer autoload for plugins beyond a few files; avoid giant single-file plugins. |
WordPress's attack surface is dominated by plugins/themes, not core. Apply these on every piece of code touching user input, output, or the database.
| Vulnerability class | Rule |
|---|---|
| SQL Injection | Never concatenate variables into SQL. Use $wpdb->prepare() for every query with a variable, always with placeholders (%s, %d, %f) — never manual string interpolation. |
| XSS (stored/reflected) | Escape ALL output at the point of echo: esc_html(), esc_attr(), esc_url(), esc_js(), wp_kses_post() for rich content. Never trust $_GET/$_POST/$_REQUEST directly in HTML. |
| CSRF | Every state-changing action (form, AJAX, admin-post) must verify a nonce: wp_nonce_field() / wp_verify_nonce() or check_admin_referer(). Never rely on is_admin() alone as protection. |
| Broken access control | Gate every privileged action with current_user_can( 'capability' ) — never trust is_admin(), role names, or hidden UI as the only barrier. Check capability on every AJAX/REST callback too, not just page load. |
| Unauthenticated AJAX/REST exposure | wp_ajax_nopriv_* hooks and public REST routes (permission_callback) must independently validate input and, if privileged, must not exist — don't assume "no menu link" is protection. |
| File upload / arbitrary file write | Validate MIME type and extension against an allowlist (wp_check_filetype), never trust the client Content-Type. Disable PHP execution in the uploads directory when possible. Never let user input build a filesystem path unsanitized (path traversal via ../). |
| Insecure deserialization | Never unserialize() user-controlled data — use maybe_unserialize() only on trusted stored data, prefer json_decode() for anything from the client. |
SSRF via wp_remote_* | Validate/allowlist destination hosts before calling with user-supplied URLs. |
Review checklist to run before shipping any plugin/theme code:
$wpdb->prepare()esc_*() function for its contexteval(), create_function(), unserialize() on untrusted input, or dynamic include/require built from user inputwp-content/plugins/my-plugin/
├── my-plugin.php ← main file with Plugin Name header, minimal bootstrap only
├── includes/ ← classes, hooks, business logic
├── admin/ ← admin-only screens, enqueued only on admin
├── assets/ ← css/js/images, enqueued via wp_enqueue_*
├── languages/ ← .pot/.po/.mo for i18n
└── uninstall.php ← cleans up options/tables on deletion (not deactivation)
set_transient()/get_transient()) to cache expensive queries/API calls, not custom cron-based caching unless transients don't fit.WP_Query with posts_per_page => -1 on large sites — paginate.is_page(), is_singular()) — don't enqueue plugin assets site-wide.admin-ajax.php with proper caching headers over polling.If is_multisite() is relevant: use switch_to_blog()/restore_current_blog() correctly (always paired), site-specific options via get_blog_option(), and never assume a single wp_options table.
If the project only borrows WordPress data (headless via REST/GraphQL, e.g. WPGraphQL) and the actual application is a separate frontend, apply this skill only to the WordPress backend/plugin code — the frontend consuming the API follows its own framework's skill (e.g. skills/ui-libraries/*).
wp_remote_get/post()| Hardcoded secrets | API keys, DB credentials, salts belong in wp-config.php (outside webroot when possible) or environment variables — never committed in plugin/theme code. |
| Object injection via magic methods | Avoid __wakeup()/__destruct() gadget chains — audit any class that could be unserialized from user input. |
| Directory listing / info disclosure | Ensure index.php stub files exist in plugin/theme subdirectories; never expose debug.log, .env, or wp-config.php.bak in the webroot. |
| User enumeration | Don't build custom endpoints that leak usernames/emails via ID iteration (?author=1) beyond what core already restricts. |
| Outdated dependencies | Flag plugins/themes with no updates in 2+ years or below the "tested up to" WP version — these are the top real-world compromise vector, not custom code. |