commit ec3986470d93cd5e2a83ab21a9ec30659373acf4 Author: Zhongwei Li Date: Sat Nov 29 18:25:33 2025 +0800 Initial commit diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..96c5960 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,15 @@ +{ + "name": "claude-wordpress-skills", + "description": "Professional WordPress engineering skills for Claude Code — performance optimization, security auditing, Gutenberg block development, and theme/plugin best practices", + "version": "1.3.0", + "author": { + "name": "Elvis Morales", + "url": "https://github.com/elvismdev" + }, + "skills": [ + "./skills" + ], + "commands": [ + "./commands" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..b77b902 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# claude-wordpress-skills + +Professional WordPress engineering skills for Claude Code — performance optimization, security auditing, Gutenberg block development, and theme/plugin best practices diff --git a/commands/wp-perf-review.md b/commands/wp-perf-review.md new file mode 100644 index 0000000..6b8f712 --- /dev/null +++ b/commands/wp-perf-review.md @@ -0,0 +1,10 @@ +--- +description: WordPress performance code review - detects database anti-patterns, caching issues, hook problems, and scalability concerns +argument-hint: [file-or-directory] +--- + +Use and follow the **wp-performance-review** skill to perform a comprehensive WordPress performance code review. + +**Target**: $ARGUMENTS (if empty, use current working directory) + +Execute the full Code Review Workflow from the skill, load reference files as needed for deeper analysis, and format output using the skill's Output Format section with severity levels (Critical/Warning/Info). \ No newline at end of file diff --git a/commands/wp-perf.md b/commands/wp-perf.md new file mode 100644 index 0000000..dd04b45 --- /dev/null +++ b/commands/wp-perf.md @@ -0,0 +1,12 @@ +--- +description: Quick WordPress performance scan - fast triage using critical pattern detection +argument-hint: [path] +--- + +Use the **wp-performance-review** skill to perform a quick triage scan. + +**Target**: $ARGUMENTS (if empty, use current working directory) + +Focus only on the "Search Patterns for Quick Detection" section—run the grep commands to find critical issues fast. Report matches with file:line references and severity levels. Skip deep analysis. + +If critical issues are found, suggest running `/wp-perf-review` for comprehensive analysis with fixes. \ No newline at end of file diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..7514b6a --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,69 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:elvismdev/claude-wordpress-skills:", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "dbedf97474919869900c1e9b230f5c5cfde060d3", + "treeHash": "7ad5a5dedea7a1a6bfa8921ac7cce75bc2f15b623ab1286d9df2d2f6a20a22b7", + "generatedAt": "2025-11-28T10:16:46.558593Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "claude-wordpress-skills", + "description": "Professional WordPress engineering skills for Claude Code — performance optimization, security auditing, Gutenberg block development, and theme/plugin best practices", + "version": "1.3.0" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "8a847370c2883acd2420a9ab999255e50e8c361abcf326063019829efab274ee" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "37d365a1063c96b47510a10750d1002535b7882121614cc32a4fa69241992036" + }, + { + "path": "commands/wp-perf.md", + "sha256": "6cc0947f472dc34d3271bc92d0398dda20a4fc8baa8ce97531d00d8a6af236d2" + }, + { + "path": "commands/wp-perf-review.md", + "sha256": "fc4794fb42009cfa741b651c287923694bacbccad6de55e9be8f7c267bd8c77f" + }, + { + "path": "skills/wp-performance-review/SKILL.md", + "sha256": "b6f975daa6d21abcc8a780c32f60e225979fbcd91a614c8588080a532fa8a616" + }, + { + "path": "skills/wp-performance-review/references/wp-query-guide.md", + "sha256": "4c293902a19c43527d9067cc6edcc8a8fc0c52a4a649c1990a67e5aa6799faca" + }, + { + "path": "skills/wp-performance-review/references/caching-guide.md", + "sha256": "fac5821ae4fcace1286473b4b500ab094ce35377ba66a50783794589e93ba297" + }, + { + "path": "skills/wp-performance-review/references/anti-patterns.md", + "sha256": "c1ca2b34eeda0540cdf638be326e44e9d8324f804e52f8ddff0b6b54294f8478" + }, + { + "path": "skills/wp-performance-review/references/measurement-guide.md", + "sha256": "c6973ac29340563ceeffb3f1bd79547898959577f462ded0c368e6c91e237e24" + } + ], + "dirSha256": "7ad5a5dedea7a1a6bfa8921ac7cce75bc2f15b623ab1286d9df2d2f6a20a22b7" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/wp-performance-review/SKILL.md b/skills/wp-performance-review/SKILL.md new file mode 100644 index 0000000..df5abeb --- /dev/null +++ b/skills/wp-performance-review/SKILL.md @@ -0,0 +1,506 @@ +--- +name: wp-performance-review +description: Use when reviewing WordPress PHP code for performance issues, auditing themes/plugins for scalability, optimizing WP_Query, analyzing caching strategies, or when user mentions "slow WordPress", "high-traffic", "performance review", "timeout", "500 error", "out of memory", or "site won't load". Detects anti-patterns in database queries, hooks, object caching, AJAX, and template loading that cause failures at scale. +--- + +# WordPress Performance Review Skill + +## Overview + +Systematic performance code review for WordPress themes, plugins, and custom code. **Core principle:** Scan critical issues first (OOM, unbounded queries, cache bypass), then warnings, then optimizations. Report with line numbers and severity levels. + +## When to Use + +**Use when:** +- Reviewing PR/code for WordPress theme or plugin +- User reports slow page loads, timeouts, or 500 errors +- Auditing before high-traffic event (launch, sale, viral moment) +- Optimizing WP_Query or database operations +- Investigating memory exhaustion or DB locks + +**Don't use for:** +- Security-only audits (use wp-security-review when available) +- Gutenberg block development patterns (use wp-gutenberg-blocks when available) +- General PHP code review not specific to WordPress + +## Code Review Workflow + +1. **Identify file type** and apply relevant checks below +2. **Scan for critical patterns first** (OOM, unbounded queries, cache bypass) +3. **Check warnings** (inefficient but not catastrophic) +4. **Note optimizations** (nice-to-have improvements) +5. **Report with line numbers** using output format below + +## File-Type Specific Checks + +### Plugin/Theme PHP Files (`functions.php`, `plugin.php`, `*.php`) +Scan for: +- `query_posts()` → CRITICAL: Never use - breaks main query +- `posts_per_page.*-1` or `numberposts.*-1` → CRITICAL: Unbounded query +- `session_start()` → CRITICAL: Bypasses page cache +- `add_action.*init.*` or `add_action.*wp_loaded` → Check if expensive code runs every request +- `update_option` or `add_option` in non-admin context → WARNING: DB writes on page load +- `wp_remote_get` or `wp_remote_post` without caching → WARNING: Blocking HTTP + +### WP_Query / Database Code +Scan for: +- Missing `posts_per_page` argument → WARNING: Defaults to blog setting +- `'meta_query'` with `'value'` comparisons → WARNING: Unindexed column scan +- `post__not_in` with large arrays → WARNING: Slow exclusion +- `LIKE '%term%'` (leading wildcard) → WARNING: Full table scan +- Missing `no_found_rows => true` when not paginating → INFO: Unnecessary count + +### AJAX Handlers (`wp_ajax_*`, REST endpoints) +Scan for: +- `admin-ajax.php` usage → INFO: Consider REST API instead +- POST method for read operations → WARNING: Bypasses cache +- `setInterval` or polling patterns → CRITICAL: Self-DDoS risk +- Missing nonce verification → Security issue (not performance, but flag it) + +### Template Files (`*.php` in theme) +Scan for: +- `get_template_part` in loops → WARNING: Consider caching output +- Database queries inside loops (N+1) → CRITICAL: Query multiplication +- `wp_remote_get` in templates → WARNING: Blocks rendering + +### JavaScript Files +Scan for: +- `$.post(` for read operations → WARNING: Use GET for cacheability +- `setInterval.*fetch\|ajax` → CRITICAL: Polling pattern +- `import _ from 'lodash'` → WARNING: Full library import bloats bundle +- Inline `