wordpress-performance-best-practices — скилл для Claude Code: правила
Скилл для Claude и других ИИ-редакторов: 34 правила производительности WordPress, разбитые по приоритету. Пригодится при написании и ревью PHP-кода плагинов и тем.
npx skills add bartekmis/wordpress-performance-best-practices --skill wordpress-performance-best-practices -a claude-codeЧто делает wordpress-performance-best-practices
Скилл подключается к агенту как набор правил и срабатывает, когда в задаче появляются WP_Query, запросы к базе, кэширование, хуки, REST API или разработка темы и плагина. Всего 34 правила в 8 категориях, отсортированных по влиянию на скорость: от критичных до второстепенных.
Внутри — отдельные файлы правил с префиксами db-, cache-, asset-, theme-, plugin-, media-, api- и advanced-. В каждом разобрано, почему это важно, показан неправильный пример кода с пояснением и правильный. Есть сводный документ AGENTS.md со всеми правилами сразу.
Самое важное в первых двух категориях. Например, db-prepared-statements требует всегда оборачивать запросы в $wpdb->prepare(), а db-limit-query-results запрещает posts_per_page => -1. Если в проекте уже есть код с прямыми запросами к базе, скилл на ревью это подсветит — повод проверить, сколько таких мест накопилось. Лицензия MIT, зависимостей и ключей API не требует.
Какие задачи решает
- найти медленные запросы в коде плагина
- заменить прямые обращения к базе на
WP_Query - настроить кэширование ответов внешних API
- убрать лишние скрипты и стили со страниц
- проверить тему на запросы внутри шаблонов
Примеры запросов агенту
- Проверь мой плагин на правила из wordpress-performance-best-practices, начни с категории базы данных
- Отрефактори этот цикл
WP_Queryпо правилам скилла - Покажи правило
cache-transients-proper-useи перепиши мой код по нему
Как установить wordpress-performance-best-practices
1Через Skills CLI (Vercel)
npx skills add bartekmis/wordpress-performance-best-practices --skill wordpress-performance-best-practices -a claude-code2Вручную: положить файлы
~/.claude/skills/wordpress-performance-best-practices/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/wordpress-performance-best-practices/
1Через Skills CLI (Vercel)
npx skills add bartekmis/wordpress-performance-best-practices --skill wordpress-performance-best-practices -a codex2Вручную: положить файлы
.agents/skills/wordpress-performance-best-practices/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add bartekmis/wordpress-performance-best-practices --skill wordpress-performance-best-practices -a cursor2Вручную: положить файлы
.cursor/skills/wordpress-performance-best-practices/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install bartekmis/wordpress-performance-best-practices wordpress-performance-best-practices2Вручную: положить файлы
.github/skills/wordpress-performance-best-practices/SKILL.md1Через Skills CLI (Vercel)
npx skills add bartekmis/wordpress-performance-best-practices --skill wordpress-performance-best-practices -a gemini-cli2Командой платформы
gemini skills install https://github.com/bartekmis/wordpress-performance-best-practicesВручную: положить файлы
.devin/skills/wordpress-performance-best-practices/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add bartekmis/wordpress-performance-best-practices --skill wordpress-performance-best-practices -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Похожие
Рядом в теме «Бэкенд и API»
Всё по теме «Бэкенд и API» →Вопросы о wordpress-performance-best-practices
Как установить wordpress-performance-best-practices в Claude?
Выполните npx skills add bartekmis/wordpress-performance-best-practices --skill wordpress-performance-best-practices -a claude-code. Скилл окажется в ~/.claude/skills/wordpress-performance-best-practices/SKILL.md.
Что делает этот скилл?
Даёт агенту 34 правила производительности WordPress в 8 категориях с примерами кода. Агент применяет их, когда пишет, проверяет или переписывает PHP-код плагинов и тем.
Для каких платформ он подходит?
Claude, Codex, Cursor, GitHub Copilot, Gemini CLI и OpenCode. Для каждой платформы своя команда установки и свой путь к файлу скилла.
Исходный текст
SKILL.md · MIT
--- name: wordpress-performance-best-practices description: WordPress performance optimization guidelines for plugin, theme, and custom code development. This skill should be used when writing, reviewing, or refactoring WordPress PHP code to ensure optimal performance patterns. Triggers on tasks involving WP_Query, database queries, caching, hooks, REST API, or WordPress theme/plugin development. license: MIT metadata: author: bartekmis version: "1.0.0" --- # WordPress Performance Best Practices 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. ## When to Apply Reference these guidelines when: - Writing WordPress plugins or themes - Working with WP_Query or database operations - Implementing caching (transients, object cache) - Optimizing asset loading (scripts, styles) - Reviewing WordPress code for performance issues - Working with REST API or AJAX handlers ## Rule Categories by Priority | 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-` | ## Quick Reference ### 1. Database Optimization (CRITICAL) - `db-prepared-statements` - Always use $wpdb->prepare() for queries - `db-avoid-post-not-in` - Avoid post__not_in, filter in PHP instead - `db-use-wp-query` - Use WP_Query/get_posts instead of direct DB queries - `db-limit-query-results` - Never use posts_per_page => -1 - `db-meta-query-indexing` - Optimize meta queries, consider taxonomies - `db-fields-optimization` - Use fields => 'ids' when only IDs needed ### 2. Caching Strategies (CRITICAL) - `cache-transients-proper-use` - Use transients for external API calls - `cache-object-cache` - Use wp_cache_* with cache groups - `cache-remote-requests` - Always cache wp_remote_get responses - `cache-invalidation` - Implement precise, event-driven invalidation - `cache-fragment-caching` - Cache expensive template fragments ### 3. Asset Management (HIGH) - `asset-proper-enqueue` - Use wp_enqueue_script/style, never hardcode - `asset-conditional-loading` - Only load assets where needed - `asset-defer-async` - Use defer/async for non-critical scripts - `asset-dequeue-unused` - Remove unused plugin assets - `asset-minification` - Minify assets, use critical CSS ### 4. Theme Performance (HIGH) - `theme-avoid-queries-in-templates` - Keep queries out of template files - `theme-template-parts` - Use get_template_part with data passing - `theme-loop-optimization` - Optimize loops, use meta/term cache priming - `theme-hooks-placement` - Use appropriate hook priorities ### 5. Plugin Architecture (MEDIUM-HIGH) - `plugin-conditional-loading` - Load code only when needed - `plugin-autoloading` - Use PSR-4 autoloading - `plugin-activation-hooks` - Use activation hooks for setup tasks - `plugin-hook-removal` - Remove hooks properly with matching priority ### 6. Media Optimization (MEDIUM) - `media-responsive-images` - Use srcset and sizes attributes - `media-lazy-loading` - Lazy load below-fold, eager load LCP - `media-image-sizes` - Define appropriate custom image sizes ### 7. API and AJAX (MEDIUM) - `api-rest-optimization` - Optimize REST endpoints, add caching headers - `api-admin-ajax` - Use REST API for frontend, avoid admin-ajax - `api-nonce-validation` - Implement proper nonce validation ### 8. Advanced Patterns (LOW-MEDIUM) - `advanced-autoload-optimization` - Keep autoloaded options under 800KB - `advanced-cron-optimization` - Use system cron, batch long tasks - `advanced-memory-management` - Process in batches, clean up memory - `advanced-query-monitor` - Profile before optimizing ## How to Use Read 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: - Brief explanation of why it matters - Incorrect code example with explanation - Correct code example with explanation - Additional context and references ## Full Compiled Document For the complete guide with all rules expanded: `AGENTS.md`
© bartekmis · MIT · bartekmis/wordpress-performance-best-practices