Skip to main content
skill CX Codex

performance-optimization · mindrally — Claude Code skill: web perf rules

A rule set for web performance: server-side rendering, CSS, JavaScript, assets and caching. Useful when your agent writes frontend code and you want a bar to hold it to.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add Mindrally/skills --skill performance-optimization -a claude-code
Open on GitHub

What performance-optimization does

The skill hands your agent a set of principles for reviewing and rewriting frontend work. Server-side rendering comes first, ahead of client-side JavaScript, along with smaller bundles and attention to Core Web Vitals: LCP, FID, CLS. Measurement is meant to run continuously, with baselines kept as a reference point.

Inside are sections on CSS, JavaScript, assets and caching. CSS: classes instead of IDs, specificity held at 0 1 0, nesting no deeper than three levels, variables for colors and spacing, animation through transform and opacity. JavaScript: const over let, no var, deferred loading for non-critical scripts, code splitting, debounce and throttle on handlers, requestAnimationFrame for visual updates. Images get WebP and AVIF with fallbacks, srcset, subset fonts and font-display: swap.

There are also blocks on theme and component architecture, internationalization, monitoring and database queries. Worth knowing: this is guidance, not a script that fixes anything on its own. The agent applies it only when you point it at a file or a page — otherwise the rules just sit in context.

What it helps with

  • strip unused client-side JavaScript from a bundle
  • find out why Core Web Vitals dropped
  • rewrite CSS without ID selectors or deep nesting
  • set up caching and versioned filenames for static assets
  • speed up font and image loading

Example prompts for the agent

  • go through this page and tell me what to drop from the client-side JavaScript
  • check styles/main.css for deep nesting and ID selectors
  • which images on the homepage should move to WebP and get srcset

How to install performance-optimization

1Skills CLI (Vercel)

npx skills add Mindrally/skills --skill performance-optimization -a claude-code

2Manually: put the files in place

~/.claude/skills/performance-optimization/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/performance-optimization/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about performance-optimization

How do I install performance-optimization in Claude?

Run npx skills add Mindrally/skills --skill performance-optimization -a claude-code. The skill lands in ~/.claude/skills/performance-optimization/SKILL.md.

What does performance-optimization do?

It gives the agent web performance rules: server-side rendering, less client-side JavaScript, Core Web Vitals, CSS, assets, caching and database queries.

Does it require server-side rendering?

The skill makes it the first principle and advises rendering content on the server wherever possible, with streaming and caching of the rendered output.

Source text

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

Similar skills

Everything for Frontend and UI →

performance-optimization by other authors comes first.

performance-optimization addyosmani An agent skill that measures before it changes code: Core Web Vitals budgets, N+1 queries, missing indexes and slow endpoints. CX Codex +1 65,200installs performance-optimization gamedev-skills A skill that turns “the game runs slow” into a measured bottleneck and a specific fix: profile first, then pool objects, batch draw calls, cut allocations. CX Codex +1 7,400installs web-performance-audit secondsky A skill that audits page speed: pulls Core Web Vitals, finds bottlenecks and points at what to fix. Useful when LCP or CLS drifts out of range. CX Codex +1 526installs web-performance-optimization aj-geddes A skill for speeding up web apps: code splitting, lazy loading, caching, compression and monitoring. Useful when pages load slowly. CX Codex +1 482installs react-performance-optimization davila7 A subagent that tracks down React performance problems: wasted re-renders, bloated bundles, memory leaks. Useful when a page drags or Core Web Vitals slip. 3,935installs performance-and-web-vitals dembrandt This skill guides Lighthouse audits and Core Web Vitals fixes across LCP, CLS, and INP. It provides rules to optimize images, fonts, scripts, and layout shifts. CX Codex +1 975installs performance-budget-guard davila7 A Claude hook that measures your Next.js JS bundle after a build and blocks the deploy when it goes over the performance budget. 393installs preload patterns.dev Guides the AI agent on preloading critical web assets. Useful when hero images, web fonts, or key bundles are discovered late in the loading waterfall. CX Codex +1 1,500installs

From the same set168

jest A skill that tells your agent how to write Jest tests: structure, mocks, assertions, async. Useful when AI writes the tests in your repo. CX Codex +1 864installs ruby-rails This skill hands your agent Rails conventions: generators over boilerplate, ActiveRecord patterns, Hotwire, background jobs and tests. Useful on a fresh app or an existing one. CX Codex +1 862installs seo-best-practices Provides search optimization guidelines for web apps. Helps configure metadata, JSON-LD schemas, rendering modes, and Core Web Vitals. CX Codex +1 858installs fastify-typescript Gives the agent a rulebook for Fastify and TypeScript: validation schemas, plugins, Prisma access and Jest tests. Useful when you build a typed REST API. CX Codex +1 856installs sass-best-practices A skill that hands your agent a rulebook for indented-syntax Sass: file layout, variables, mixins, BEM. Useful when the project stylesheets are .sass, not SCSS. CX Codex +1 845installs elixir A skill that tells your coding agent how to write Elixir and Phoenix: functional patterns, Ecto, LiveView, OTP. Useful when the project actually runs on BEAM. CX Codex +1 836installs spring-boot A skill that gives your agent Spring Boot conventions: REST controllers, JUnit tests, security, build and deploy. Useful when the project is Java. CX Codex +1 832installs responsive-design A skill that hands your coding agent a set of responsive design rules: mobile-first CSS, flexible layouts, media queries, adaptive images and type. CX Codex +1 830installs

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor