wordpress-performance-best-practices by bartekmis/wordpress-performance-best-practises
npx skills add https://github.com/bartekmis/wordpress-performance-best-practises --skill wordpress-performance-best-practices适用于 WordPress 开发的全面性能优化指南,专为 AI 代理和 LLM 设计。包含 8 个类别共 34 条规则,按影响优先级排序,以指导代码审查和生成。
在以下情况下参考这些指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | 数据库优化 | 关键 | db- |
| 2 | 缓存策略 | 关键 | cache- |
| 3 | 资源管理 | 高 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
asset- |
| 4 | 主题性能 | 高 | theme- |
| 5 | 插件架构 | 中高 | plugin- |
| 6 | 媒体优化 | 中 | media- |
| 7 | API 和 AJAX | 中 | api- |
| 8 | 高级模式 | 低中 | advanced- |
db-prepared-statements - 始终使用 $wpdb->prepare() 进行查询db-avoid-post-not-in - 避免使用 post__not_in,改为在 PHP 中过滤db-use-wp-query - 使用 WP_Query/get_posts 而非直接数据库查询db-limit-query-results - 切勿使用 posts_per_page => -1db-meta-query-indexing - 优化元查询,考虑使用分类法db-fields-optimization - 当仅需要 ID 时使用 fields => 'ids'cache-transients-proper-use - 使用瞬态缓存处理外部 API 调用cache-object-cache - 使用 wp_cache_* 并配合缓存组cache-remote-requests - 始终缓存 wp_remote_get 响应cache-invalidation - 实现精确的、事件驱动的缓存失效cache-fragment-caching - 缓存开销大的模板片段asset-proper-enqueue - 使用 wp_enqueue_script/style,切勿硬编码asset-conditional-loading - 仅在需要的地方加载资源asset-defer-async - 为非关键脚本使用 defer/asyncasset-dequeue-unused - 移除未使用的插件资源asset-minification - 压缩资源,使用关键 CSStheme-avoid-queries-in-templates - 避免在模板文件中进行查询theme-template-parts - 使用 get_template_part 并传递数据theme-loop-optimization - 优化循环,使用元/分类项缓存预热theme-hooks-placement - 使用适当的钩子优先级plugin-conditional-loading - 仅在需要时加载代码plugin-autoloading - 使用 PSR-4 自动加载plugin-activation-hooks - 使用激活钩子处理安装任务plugin-hook-removal - 使用匹配的优先级正确移除钩子media-responsive-images - 使用 srcset 和 sizes 属性media-lazy-loading - 延迟加载首屏以下内容,优先加载 LCP 元素media-image-sizes - 定义合适的自定义图片尺寸api-rest-optimization - 优化 REST 端点,添加缓存头api-admin-ajax - 前端使用 REST API,避免 admin-ajaxapi-nonce-validation - 实现正确的 nonce 验证advanced-autoload-optimization - 保持自动加载的选项在 800KB 以下advanced-cron-optimization - 使用系统 cron,批量处理长任务advanced-memory-management - 分批处理,清理内存advanced-query-monitor - 优化前先进行性能分析阅读各个规则文件以获取详细说明和代码示例:
rules/db-prepared-statements.md
rules/cache-transients-proper-use.md
rules/_sections.md
每个规则文件包含:
查看包含所有规则详细说明的完整指南:AGENTS.md
每周安装量
284
仓库
GitHub 星标数
9
首次出现
2026年1月20日
安全审计
安装于
opencode240
gemini-cli230
codex221
github-copilot211
claude-code175
kimi-cli173
Comprehensive performance optimization guide for WordPress development, designed for AI agents and LLMs. Contains 34 rules across 8 categories, prioritized by impact to guide code review and generation.
Reference these guidelines when:
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Database Optimization | CRITICAL | db- |
| 2 | Caching Strategies | CRITICAL | cache- |
| 3 | Asset Management | HIGH | asset- |
| 4 | Theme Performance | HIGH | theme- |
| 5 | Plugin Architecture | MEDIUM-HIGH | plugin- |
| 6 | Media Optimization | MEDIUM | media- |
| 7 | API and AJAX | MEDIUM | api- |
| 8 | Advanced Patterns | LOW-MEDIUM | advanced- |
db-prepared-statements - Always use $wpdb->prepare() for queriesdb-avoid-post-not-in - Avoid post__not_in, filter in PHP insteaddb-use-wp-query - Use WP_Query/get_posts instead of direct DB queriesdb-limit-query-results - Never use posts_per_page => -1db-meta-query-indexing - Optimize meta queries, consider taxonomiesdb-fields-optimization - Use fields => 'ids' when only IDs neededcache-transients-proper-use - Use transients for external API callscache-object-cache - Use wp_cache_* with cache groupscache-remote-requests - Always cache wp_remote_get responsescache-invalidation - Implement precise, event-driven invalidationcache-fragment-caching - Cache expensive template fragmentsasset-proper-enqueue - Use wp_enqueue_script/style, never hardcodeasset-conditional-loading - Only load assets where neededasset-defer-async - Use defer/async for non-critical scriptsasset-dequeue-unused - Remove unused plugin assetsasset-minification - Minify assets, use critical CSStheme-avoid-queries-in-templates - Keep queries out of template filestheme-template-parts - Use get_template_part with data passingtheme-loop-optimization - Optimize loops, use meta/term cache primingtheme-hooks-placement - Use appropriate hook prioritiesplugin-conditional-loading - Load code only when neededplugin-autoloading - Use PSR-4 autoloadingplugin-activation-hooks - Use activation hooks for setup tasksplugin-hook-removal - Remove hooks properly with matching prioritymedia-responsive-images - Use srcset and sizes attributesmedia-lazy-loading - Lazy load below-fold, eager load LCPmedia-image-sizes - Define appropriate custom image sizesapi-rest-optimization - Optimize REST endpoints, add caching headersapi-admin-ajax - Use REST API for frontend, avoid admin-ajaxapi-nonce-validation - Implement proper nonce validationadvanced-autoload-optimization - Keep autoloaded options under 800KBadvanced-cron-optimization - Use system cron, batch long tasksadvanced-memory-management - Process in batches, clean up memoryadvanced-query-monitor - Profile before optimizingRead individual rule files for detailed explanations and code examples:
rules/db-prepared-statements.md
rules/cache-transients-proper-use.md
rules/_sections.md
Each rule file contains:
For the complete guide with all rules expanded: AGENTS.md
Weekly Installs
284
Repository
GitHub Stars
9
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode240
gemini-cli230
codex221
github-copilot211
claude-code175
kimi-cli173
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
105,000 周安装
LLM提示词缓存优化指南:降低90%成本,实现多级缓存与语义匹配
323 周安装
小红书内容转换器:一键将通用文章转为小红书爆款笔记格式 | AI写作助手
323 周安装
内容摘要AI工具:智能提取YouTube、网页、PDF和推文内容,支持测验学习和深度探索
324 周安装
Notion知识捕获工具 - 将对话笔记自动转化为结构化Notion页面 | 知识管理自动化
324 周安装
现代Angular最佳实践指南:TypeScript严格性、信号响应式、性能优化与测试
324 周安装
iOS VoIP 通话开发:CallKit + PushKit 集成原生通话 UI 指南
324 周安装