performance-optimization · mindrally — скилл для Claude Code: правила оптимизации
Набор правил для веб-производительности: серверный рендеринг, CSS, JavaScript, ассеты и кэш. Полезен, когда агент пишет фронтенд и вы хотите задать ему планку.
npx skills add Mindrally/skills --skill performance-optimization -a claude-codeЧто делает performance-optimization
Скилл задаёт агенту свод принципов, по которым тот разбирает и переписывает фронтенд. Главный приоритет — серверный рендеринг вместо клиентского JavaScript, плюс сокращение бандла и работа над Core Web Vitals: LCP, FID, CLS. Измерения предлагается вести постоянно и держать базовые значения как ориентир.
Внутри — разделы по CSS, JavaScript, ассетам и кэшированию. По CSS: классы вместо ID, специфичность на уровне 0 1 0, вложенность не глубже трёх уровней, переменные для цветов и отступов, анимации через transform и opacity. По JavaScript: const вместо let, отказ от var, отложенная загрузка некритичных скриптов, разбиение на чанки, debounce и throttle для обработчиков, requestAnimationFrame для визуальных обновлений. Отдельно идут изображения в WebP и AVIF с fallback, srcset, подмножества шрифтов и font-display: swap.
Есть блоки про архитектуру тем и компонентов, интернационализацию, мониторинг и запросы к базе. Учтите: это свод рекомендаций, а не скрипт, который что-то чинит сам. Агент применит их, только если вы поставите задачу по конкретному файлу или странице — иначе правила просто лежат в контексте.
Какие задачи решает
- убрать лишний клиентский JavaScript из бандла
- разобрать причины просевших Core Web Vitals
- переписать CSS без ID-селекторов и глубокой вложенности
- настроить кэш и версионирование статики
- ускорить загрузку шрифтов и изображений
Примеры запросов агенту
- пройдись по этой странице и предложи, что убрать из клиентского JavaScript
- проверь CSS в
styles/main.cssна глубокую вложенность и ID-селекторы - какие изображения на главной стоит перевести в WebP и добавить
srcset
Как установить performance-optimization
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill performance-optimization -a claude-code2Вручную: положить файлы
~/.claude/skills/performance-optimization/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/performance-optimization/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill performance-optimization -a codex2Вручную: положить файлы
.agents/skills/performance-optimization/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill performance-optimization -a cursor2Вручную: положить файлы
.cursor/skills/performance-optimization/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install Mindrally/skills performance-optimization2Вручную: положить файлы
.github/skills/performance-optimization/SKILL.md1Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill performance-optimization -a gemini-cli2Командой платформы
gemini skills install https://github.com/Mindrally/skills --path performance-optimizationВручную: положить файлы
.devin/skills/performance-optimization/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add Mindrally/skills --skill performance-optimization -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Из того же набора168
Другие версии performance-optimization
Похожие
Рядом в теме «Фронтенд и UI»
Всё по теме «Фронтенд и UI» →Вопросы о performance-optimization
Как установить performance-optimization в Claude?
Выполните npx skills add Mindrally/skills --skill performance-optimization -a claude-code. Скилл окажется в ~/.claude/skills/performance-optimization/SKILL.md.
Что делает performance-optimization?
Даёт агенту правила оптимизации веба: серверный рендеринг, экономия клиентского JavaScript, работа с Core Web Vitals, CSS, ассеты, кэш и запросы к базе.
Нужен ли серверный рендеринг обязательно?
Скилл ставит его первым принципом и советует рендерить контент на сервере везде, где это возможно, с потоковой отдачей и кэшированием готового результата.
Исходный текст
SKILL.md · Apache-2.0
--- name: performance-optimization description: Performance optimization guidelines for web development including server-side rendering, CSS best practices, and JavaScript optimization metadata: maintainer: Mindrally source: https://github.com/Mindrally/skills --- # Performance Optimization Apply these performance optimization principles when developing web applications, themes, and frontend interfaces. ## Core Performance Principles - Prioritize server-side rendering as a first principle, as opposed to client-side JavaScript - Minimize client-side JavaScript to reduce bundle size and improve Time to Interactive - Optimize for Core Web Vitals: LCP, FID, and CLS - Measure performance continuously and establish baselines - Consider performance impact of every architectural decision ## Server-Side Rendering - Render content server-side whenever possible - Use streaming rendering for faster Time to First Byte - Implement proper caching strategies for rendered content - Avoid blocking resources that delay rendering - Pre-render static content where applicable ## CSS Best Practices ### Selector Efficiency - Avoid ID selectors for styling; use classes instead - Maintain specificity at 0 1 0 where possible - Avoid deep nesting of selectors (max 3 levels) - Use BEM or similar naming conventions for clarity - Prefer class selectors over element selectors ### CSS Organization - Use CSS variables for colors, spacing, and repeated values - Group related styles logically - Remove unused CSS to reduce payload - Consider critical CSS inlining for above-the-fold content - Use CSS containment for complex layouts ### Layout Performance - Avoid layout thrashing (forced synchronous layouts) - Use transform and opacity for animations (GPU accelerated) - Minimize paint and composite operations - Use will-change sparingly and intentionally - Prefer flexbox and grid over floats and positioning ## JavaScript Optimization ### Code Organization - Use the module pattern for code organization - Prefix private methods with appropriate indicators - Prefer const over let; avoid var - Avoid external dependencies when native APIs suffice - Split code into logical, loadable chunks ### Loading Strategies - Defer non-critical JavaScript - Use async loading for independent scripts - Implement code splitting for large applications - Lazy load components and routes - Preload critical resources ### Runtime Performance - Debounce and throttle event handlers appropriately - Use requestAnimationFrame for visual updates - Avoid long-running synchronous operations - Implement efficient DOM manipulation patterns - Use Web Workers for CPU-intensive tasks ## Asset Optimization ### Images - Use modern formats (WebP, AVIF) with fallbacks - Implement responsive images with srcset - Lazy load below-the-fold images - Optimize and compress all images - Use appropriate image dimensions ### Fonts - Subset fonts to include only needed characters - Use font-display: swap for better perceived performance - Preload critical fonts - Limit the number of font variations - Consider system fonts for non-branded text ## Caching Strategies - Implement appropriate cache headers for static assets - Use versioned filenames for cache busting - Configure CDN caching effectively - Implement service workers for offline support - Cache API responses where appropriate ## Architecture Patterns ### Theme and Component Architecture - Organize code into logical sections and blocks - Use proper folder structure for maintainability - Implement clear separation of concerns - Create reusable, composable components - Document component APIs and usage ### Configuration and Settings - Organize settings logically with clear groupings - Use clear, descriptive naming conventions - Implement conditional logic to reduce complexity - Provide sensible defaults - Validate configuration at build time ## Internationalization Performance - Ensure all text is translatable - Load translations efficiently (split by locale) - Use proper locale detection - Cache translated content appropriately - Consider right-to-left (RTL) layout implications ## Measurement and Monitoring - Use Real User Monitoring (RUM) for production insights - Set up synthetic monitoring for baseline tracking - Monitor Core Web Vitals continuously - Track performance budgets in CI/CD - Analyze and act on performance regressions ## Database Performance - Optimize queries and use proper indexing - Implement connection pooling - Use caching for frequently accessed data - Paginate large result sets - Monitor slow queries and optimize regularly
© Mindrally · Apache-2.0 · Mindrally/skills