用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-php --skill php-wordpress命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
正在显示 SKILL.md
PHP API development mastery - REST, GraphQL, JWT/OAuth, OpenAPI documentation
PHP database mastery - PDO, Eloquent, Doctrine, query optimization, and migrations
Modern PHP programming skill - master PHP 8.x syntax, OOP, type system, and Composer
基于 SOC 职业分类
| name | php-wordpress |
| version | 2.0.0 |
| description | WordPress development mastery - themes, plugins, Gutenberg blocks, and REST API |
| sasmp_version | 1.3.0 |
| bonded_agent | 04-php-wordpress |
| bond_type | PRIMARY_BOND |
| atomic | true |
| category | cms |
Atomic skill for mastering WordPress theme and plugin development
Comprehensive skill for building WordPress themes, plugins, and Gutenberg blocks. Covers WordPress 6.x with focus on modern development practices and security.
interface SkillParams {
topic:
| "themes" // Classic, block, FSE
| "plugins" // Architecture, hooks, settings
| "gutenberg" // Blocks, patterns, InnerBlocks
| "rest-api" // Custom endpoints, authentication
| "security" // Nonces, sanitization, escaping
| "woocommerce"; // Store extensions
level: "beginner" | "intermediate" | "advanced";
wp_version?: "6.4" | "6.5" | "6.6" | "6.7";
theme_type?: "classic" | "block" | "hybrid";
}
validation:
topic:
required: true
allowed: [themes, plugins, gutenberg, rest-api, security, woocommerce]
level:
required: true
wp_version:
default: "6.6"
beginner:
- Theme structure and files
- Template hierarchy
- Enqueuing styles/scripts
intermediate:
- Custom post types
- Theme customizer
- Block theme basics
advanced:
- Full Site Editing
- theme.json deep dive
- Performance optimization
beginner:
- Plugin structure
- Actions and filters
- Shortcodes
intermediate:
- Settings API
- Custom database tables
- AJAX handling
advanced:
- Plugin architecture patterns
- WP-CLI commands
- Multisite support
beginner:
- Block basics and block.json
- Edit and save functions
- Block attributes
intermediate:
- InnerBlocks
- Block variations
- Server-side rendering
advanced:
- Interactivity API
- Block Bindings
- Custom block categories
errors:
HOOK_ERROR:
code: "WP_001"
recovery: "Check hook name and timing"
SECURITY_ERROR:
code: "WP_002"
recovery: "Add proper escaping/sanitization"
retry:
max_attempts: 3
backoff:
type: exponential
initial_delay_ms: 100
<?php
/**
* Plugin Name: My Custom Plugin
* Description: A custom WordPress plugin
* Version: 1.0.0
* Requires PHP: 8.0
* Author: Developer
*/
declare(strict_types=1);
defined('ABSPATH') || exit;
final class MyCustomPlugin
{
public function __construct()
{
add_action('init', [$this, 'registerPostType']);
add_action('rest_api_init', [$this, 'registerRoutes']);
}
public function registerPostType(): void
{
register_post_type('portfolio', [
'labels' => ['name' => __('Portfolio')],
'public' => true,
'show_in_rest' => true,
'supports' => ['title', 'editor', 'thumbnail'],
]);
}
public function registerRoutes(): void
{
register_rest_route(, , [
=> ,
=> [, ],
=> ,
]);
}
{
= ([ => ]);
(, );
}
}
();
{
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "myplugin/testimonial",
"title": "Testimonial",
"category": "widgets",
"icon": "format-quote",
"description": "Display a testimonial",
"supports": {
"html": false,
"align": ["wide", "full"]
},
"attributes": {
"content": { "type": "string" },
"author"
<?php
// Input sanitization
$title = sanitize_text_field($_POST['title'] ?? '');
$content = wp_kses_post($_POST['content'] ?? '');
$id = absint($_POST['id'] ?? 0);
// Output escaping
echo esc_html($title);
echo esc_attr($attribute);
echo esc_url($url);
echo wp_kses_post($content);
// Nonce verification
if (!wp_verify_nonce($_POST['_wpnonce'], 'my_action')) {
wp_die('Security check failed');
}
// Capability check
if (!current_user_can('edit_posts')) {
wp_die('Unauthorized');
}
// Database queries
global $wpdb;
$results = $wpdb->get_results(
->(
,
)
);
| Problem | Solution |
|---|---|
| Hook not firing | Check hook name spelling and timing |
| Block not appearing | Verify block.json, run npm build |
| REST API 403 | Check permission_callback |
| White screen | Enable WP_DEBUG, check error.log |
// wp-config.php
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
define('SCRIPT_DEBUG', true);
| Metric | Target |
|---|---|
| Security compliance | 100% |
| Hook correctness | 100% |
| WPCS compliance | 100% |
Skill("php-wordpress", {topic: "gutenberg", level: "intermediate"})