[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-8bd2c5dd-b3c5-444e-97ac-7b72ce26fcf5":3,"$fWKp3oxxh-yFxaYCBl236jtVYYBvrkfKOC4MXMmJD_Ew":42},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":33},"8bd2c5dd-b3c5-444e-97ac-7b72ce26fcf5","wordpress-plugin-development","WordPress插件开发工作流程，涵盖插件架构、钩子、管理界面、REST API、安全最佳实践和WordPress 7.0特性：实时协作、AI连接器、能力API、DataViews和仅PHP的块。","cat_coding_backend","mod_coding","sickn33,coding","---\nname: wordpress-plugin-development\ndescription: \"WordPress plugin development workflow covering plugin architecture, hooks, admin interfaces, REST API, security best practices, and WordPress 7.0 features: Real-Time Collaboration, AI Connectors, Abilities API, DataViews, and PHP-only blocks.\"\ncategory: granular-workflow-bundle\nrisk: safe\nsource: personal\ndate_added: \"2026-02-27\"\n---\n\n# WordPress Plugin Development Workflow\n\n## Overview\n\nSpecialized workflow for creating WordPress plugins with proper architecture, hooks system, admin interfaces, REST API endpoints, and security practices. Now includes WordPress 7.0 features for modern plugin development.\n\n## WordPress 7.0 Plugin Development\n\n### Key Features for Plugin Developers\n\n1. **Real-Time Collaboration (RTC) Compatibility**\n   - Yjs-based CRDT for simultaneous editing\n   - Custom transport via `sync.providers` filter\n   - **Requirement**: Register post meta with `show_in_rest => true`\n\n2. **AI Connector Integration**\n   - Provider-agnostic AI via `wp_ai_client_prompt()`\n   - Settings > Connectors admin screen\n   - Works with OpenAI, Claude, Gemini, Ollama\n\n3. **Abilities API**\n   - Declare plugin capabilities for AI agents\n   - REST API: `\u002Fwp-json\u002Fabilities\u002Fv1\u002Fmanifest`\n   - MCP adapter support\n\n4. **DataViews & DataForm**\n   - Modern admin interfaces\n   - Replaces WP_List_Table patterns\n   - Built-in validation\n\n5. **PHP-Only Blocks**\n   - Register blocks without JavaScript\n   - Auto-generated Inspector controls\n\n## When to Use This Workflow\n\nUse this workflow when:\n- Creating custom WordPress plugins\n- Extending WordPress functionality\n- Building admin interfaces\n- Adding REST API endpoints\n- Integrating third-party services\n- Implementing WordPress 7.0 AI\u002FCollaboration features\n\n## Workflow Phases\n\n### Phase 1: Plugin Setup\n\n#### Skills to Invoke\n- `app-builder` - Project scaffolding\n- `backend-dev-guidelines` - Backend patterns\n\n#### Actions\n1. Create plugin directory structure\n2. Set up main plugin file with header\n3. Implement activation\u002Fdeactivation hooks\n4. Set up autoloading\n5. Configure text domain\n\n#### WordPress 7.0 Plugin Header\n```php\n\u002F*\nPlugin Name: My Plugin\nPlugin URI: https:\u002F\u002Fexample.com\u002Fmy-plugin\nDescription: A WordPress 7.0 compatible plugin with AI and RTC support\nVersion: 1.0.0\nRequires at least: 6.0\nRequires PHP: 7.4\nAuthor: Developer Name\nLicense: GPL2+\n*\u002F\n```\n\n#### Copy-Paste Prompts\n```\nUse @app-builder to scaffold a new WordPress plugin\n```\n\n### Phase 2: Plugin Architecture\n\n#### Skills to Invoke\n- `backend-dev-guidelines` - Architecture patterns\n\n#### Actions\n1. Design plugin class structure\n2. Implement singleton pattern\n3. Create loader class\n4. Set up dependency injection\n5. Configure plugin lifecycle\n\n#### WordPress 7.0 Architecture Considerations\n- Prepare for iframed editor compatibility\n- Design for collaboration-aware data flows\n- Consider Abilities API for AI integration\n\n#### Copy-Paste Prompts\n```\nUse @backend-dev-guidelines to design plugin architecture\n```\n\n### Phase 3: Hooks Implementation\n\n#### Skills to Invoke\n- `wordpress-penetration-testing` - WordPress patterns\n\n#### Actions\n1. Register action hooks\n2. Create filter hooks\n3. Implement callback functions\n4. Set up hook priorities\n5. Add conditional hooks\n\n#### Copy-Paste Prompts\n```\nUse @wordpress-penetration-testing to understand WordPress hooks\n```\n\n### Phase 4: Admin Interface\n\n#### Skills to Invoke\n- `frontend-developer` - Admin UI\n\n#### Actions\n1. Create admin menu\n2. Build settings pages\n3. Implement options registration\n4. Add settings sections\u002Ffields\n5. Create admin notices\n\n#### WordPress 7.0 Admin Considerations\n- Test with new admin color scheme\n- Consider DataViews for data displays\n- Implement view transitions\n- Use new validation patterns\n\n#### DataViews Example\n```javascript\nimport { DataViews } from '@wordpress\u002Fdataviews';\n\nconst MyPluginDataView = () => {\n    const data = [\u002F* records *\u002F];\n    const fields = [\n        { id: 'title', label: 'Title', sortable: true },\n        { id: 'status', label: 'Status', filterBy: true }\n    ];\n    const view = {\n        type: 'table',\n        perPage: 10,\n        sort: { field: 'title', direction: 'asc' }\n    };\n\n    return (\n        \u003CDataViews\n            data={data}\n            fields={fields}\n            view={view}\n            onChangeView={handleViewChange}\n        \u002F>\n    );\n};\n```\n\n#### Copy-Paste Prompts\n```\nUse @frontend-developer to create WordPress admin interface\n```\n\n### Phase 5: Database Operations\n\n#### Skills to Invoke\n- `database-design` - Database design\n- `postgresql` - Database patterns\n\n#### Actions\n1. Create custom tables\n2. Implement CRUD operations\n3. Add data validation\n4. Set up data sanitization\n5. Create data upgrade routines\n\n#### RTC-Compatible Post Meta\n```php\n\u002F\u002F Register meta for Real-Time Collaboration\nregister_post_meta('post', 'my_custom_field', [\n    'type' => 'string',\n    'single' => true,\n    'show_in_rest' => true,  \u002F\u002F Required for RTC\n    'sanitize_callback' => 'sanitize_text_field',\n]);\n\n\u002F\u002F For WP 7.0, also consider:\nregister_term_meta('category', 'my_term_field', [\n    'type' => 'string',\n    'show_in_rest' => true,\n]);\n```\n\n#### Copy-Paste Prompts\n```\nUse @database-design to design plugin database schema\n```\n\n### Phase 6: REST API\n\n#### Skills to Invoke\n- `api-design-principles` - API design\n- `api-patterns` - API patterns\n\n#### Actions\n1. Register REST routes\n2. Create endpoint callbacks\n3. Implement permission callbacks\n4. Add request validation\n5. Document API endpoints\n\n#### WordPress 7.0 REST API Enhancements\n- Abilities API integration\n- AI Connector endpoints\n- Enhanced validation\n\n#### Copy-Paste Prompts\n```\nUse @api-design-principles to create WordPress REST API endpoints\n```\n\n### Phase 7: Security\n\n#### Skills to Invoke\n- `wordpress-penetration-testing` - WordPress security\n- `security-scanning-security-sast` - Security scanning\n\n#### Actions\n1. Implement nonce verification\n2. Add capability checks\n3. Sanitize all inputs\n4. Escape all outputs\n5. Secure database queries\n\n#### WordPress 7.0 Security Considerations\n- Test Abilities API permission boundaries\n- Validate AI connector credential handling\n- Review collaboration data isolation\n- PHP 7.4+ requirement compliance\n\n#### Copy-Paste Prompts\n```\nUse @wordpress-penetration-testing to audit plugin security\n```\n\n### Phase 8: WordPress 7.0 Features\n\n#### Skills to Invoke\n- `api-design-principles` - AI integration\n- `backend-dev-guidelines` - Block development\n\n#### AI Connector Implementation\n```php\n\u002F\u002F Using WordPress 7.0 AI Connector\nadd_action('save_post', 'my_plugin_generate_ai_summary', 10, 2);\n\nfunction my_plugin_generate_ai_summary($post_id, $post) {\n    if (wp_is_post_autosave($post_id) || wp_is_post_revision($post_id)) {\n        return;\n    }\n    \n    \u002F\u002F Check if AI client is available\n    if (!function_exists('wp_ai_client_prompt')) {\n        return;\n    }\n    \n    $content = strip_tags($post->post_content);\n    if (empty($content)) {\n        return;\n    }\n    \n    \u002F\u002F Build prompt - direct string concatenation for input\n    $result = wp_ai_client_prompt(\n        'Create a compelling 2-sentence summary for social media: ' . substr($content, 0, 1000)\n    );\n    \n    if (is_wp_error($result)) {\n        return;\n    }\n    \n    \u002F\u002F Set temperature for consistent output\n    $result->using_temperature(0.3);\n    $summary = $result->generate_text();\n    \n    if ($summary && !is_wp_error($summary)) {\n        update_post_meta($post_id, '_ai_summary', sanitize_textarea_field($summary));\n    }\n}\n```\n\n#### Abilities API Registration\n```php\n\u002F\u002F Register ability categories on their own hook\nadd_action('wp_abilities_api_categories_init', function() {\n    wp_register_ability_category('content-creation', [\n        'label' => __('Content Creation', 'my-plugin'),\n        'description' => __('Abilities for generating and managing content', 'my-plugin'),\n    ]);\n});\n\n\u002F\u002F Register abilities on their own hook\nadd_action('wp_abilities_api_init', function() {\n    wp_register_ability('my-plugin\u002Fgenerate-summary', [\n        'label' => __('Generate Summary', 'my-plugin'),\n        'description' => __('Creates an AI-powered summary of content', 'my-plugin'),\n        'category' => 'content-creation',\n        'input_schema' => [\n            'type' => 'object',\n            'properties' => [\n                'content' => ['type' => 'string'],\n                'length' => ['type' => 'integer', 'default' => 2]\n            ],\n            'required' => ['content']\n        ],\n        'output_schema' => [\n            'type' => 'object',\n            'properties' => [\n                'summary' => ['type' => 'string']\n            ]\n        ],\n        'execute_callback' => 'my_plugin_generate_summary_cb',\n        'permission_callback' => function() {\n            return current_user_can('edit_posts');\n        }\n    ]);\n});\n\n\u002F\u002F Handler callback\nfunction my_plugin_generate_summary_cb($input) {\n    $content = isset($input['content']) ? $input['content'] : '';\n    $length = isset($input['length']) ? absint($input['length']) : 2;\n    \n    if (empty($content)) {\n        return new WP_Error('empty_content', 'No content provided');\n    }\n    \n    if (!function_exists('wp_ai_client_prompt')) {\n        return new WP_Error('ai_unavailable', 'AI not available');\n    }\n    \n    $prompt = sprintf('Create a %d-sentence summary of: %s', $length, substr($content, 0, 2000));\n    \n    $result = wp_ai_client_prompt($prompt)\n        ->using_temperature(0.3)\n        ->generate_text();\n    \n    if (is_wp_error($result)) {\n        return $result;\n    }\n    \n    return ['summary' => sanitize_textarea_field($result)];\n}\n```\n\n#### PHP-Only Block Registration\n```php\n\u002F\u002F Register block entirely in PHP (WordPress 7.0)\n\u002F\u002F Note: For full PHP-only blocks, use block.json with PHP render_callback\n\n\u002F\u002F First, create a block.json file in build\u002F or includes\u002Fblocks\u002F\n\u002F\u002F Then register in PHP:\n\n\u002F\u002F Simple PHP-only block registration (WordPress 7.0+)\nif (function_exists('register_block_type')) {\n    register_block_type('my-plugin\u002Ffeatured-post', [\n        'render_callback' => function($attributes, $content, $block) {\n            $post_id = isset($attributes['postId']) ? absint($attributes['postId']) : 0;\n            \n            if (!$post_id) {\n                $post_id = get_the_ID();\n            }\n            \n            $post = get_post($post_id);\n            \n            if (!$post) {\n                return '';\n            }\n            \n            $title = esc_html($post->post_title);\n            $excerpt = esc_html(get_the_excerpt($post));\n            \n            return sprintf(\n                '\u003Cdiv class=\"featured-post\">\u003Ch2>%s\u003C\u002Fh2>\u003Cp>%s\u003C\u002Fp>\u003C\u002Fdiv>',\n                $title,\n                $excerpt\n            );\n        },\n        'attributes' => [\n            'postId' => ['type' => 'integer', 'default' => 0],\n            'showExcerpt' => ['type' => 'boolean', 'default' => true]\n        ],\n    ]);\n}\n```\n\n#### Disable Collaboration (if needed)\n```javascript\n\u002F\u002F Disable RTC for specific post types\nimport { addFilter } from '@wordpress\u002Fhooks';\n\naddFilter(\n    'sync.providers',\n    'my-plugin\u002Fdisable-collab',\n    () => []\n);\n```\n\n### Phase 9: Testing\n\n#### Skills to Invoke\n- `test-automator` - Test automation\n- `php-pro` - PHP testing\n\n#### Actions\n1. Set up PHPUnit\n2. Create unit tests\n3. Write integration tests\n4. Test with WordPress test suite\n5. Configure CI\n\n#### WordPress 7.0 Testing Priorities\n- Test RTC compatibility\n- Verify AI connector functionality\n- Validate DataViews integration\n- Test Interactivity API with watch()\n\n#### Copy-Paste Prompts\n```\nUse @test-automator to set up plugin testing\n```\n\n## Plugin Structure\n\n```\nplugin-name\u002F\n├── plugin-name.php\n├── includes\u002F\n│   ├── class-plugin.php\n│   ├── class-loader.php\n│   ├── class-activator.php\n│   └── class-deactivator.php\n├── admin\u002F\n│   ├── class-plugin-admin.php\n│   ├── css\u002F\n│   └── js\u002F\n├── public\u002F\n│   ├── class-plugin-public.php\n│   ├── css\u002F\n│   └── js\u002F\n├── blocks\u002F           # PHP-only blocks (WP 7.0)\n├── abilities\u002F        # Abilities API\n├── ai\u002F               # AI Connector integration\n├── languages\u002F\n└── vendor\u002F\n```\n\n## WordPress 7.0 Compatibility Checklist\n\n- [ ] PHP 7.4+ requirement documented\n- [ ] Post meta registered with `show_in_rest => true` for RTC\n- [ ] Meta boxes migrated to block-based UIs\n- [ ] AI Connector integration tested\n- [ ] Abilities API registered (if applicable)\n- [ ] DataViews integration tested (if applicable)\n- [ ] Interactivity API uses `watch()` not `effect`\n- [ ] Tested with iframed editor\n- [ ] Collaboration fallback works (post locking)\n\n## Quality Gates\n\n- [ ] Plugin activates without errors\n- [ ] All hooks working\n- [ ] Admin interface functional\n- [ ] Security measures implemented\n- [ ] Tests passing\n- [ ] Documentation complete\n- [ ] WordPress 7.0 compatibility verified\n\n## Related Workflow Bundles\n\n- `wordpress` - WordPress development\n- `wordpress-theme-development` - Theme development\n- `wordpress-woocommerce` - WooCommerce\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,99,504,"2026-05-16 13:47:30",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":25,"skillCount":32,"createdAt":26},"后端开发","backend","mdi-server","API、数据库、服务端架构",296,[34],{"id":35,"skillId":4,"version":36,"fileName":37,"fileSize":38,"filePath":39,"fileHash":40,"manifest":41,"createdAt":19},"4b26fc1a-974d-4326-8ba1-b0d8c39dde46","1.0.0","wordpress-plugin-development.zip",4632,"uploads\u002Fskills\u002F8bd2c5dd-b3c5-444e-97ac-7b72ce26fcf5\u002Fwordpress-plugin-development.zip","77a9681ee8ef7e8dd2cbf202b2a5bd705c1cd0ee9df839798cc29ff638dac0bd","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":13451}]",{"code":43,"message":44,"data":45},200,"success",{"items":46,"stats":47,"page":50},[],{"averageRating":48,"totalRatings":48,"ratingCounts":49},0,[48,48,48,48,48],{"limit":51,"offset":48,"hasMore":52,"nextOffset":51,"ratedOnly":16},15,false]