Vercel React Best Practices helps developers to create high-performance React applications using industry-leading techniques. By following these best practices, teams can optimize their workflows, improve code quality, and enhance user experience, leading to faster deployment and increased customer satisfaction.
claude install vercel-labs/agent-skills/vercel-react-best-practicesUnlock the full potential of your React applications with Vercel React Best Practices. This skill offers essential guidelines that help developers streamline their coding processes, ensuring that they adhere to modern standards while maximizing application performance. Whether you're looking to improve load times or implement effective SEO techniques, this skill is designed to elevate your development game. Sales, Marketing, and RevOps teams can benefit immensely from these best practices by ensuring that applications not only meet user expectations but also drive engagement and conversions. By integrating these methodologies, organizations can achieve a faster go-to-market strategy, reduce operational costs, and ultimately enhance customer satisfaction, positioning themselves as leaders in the competitive digital landscape.
[{"step":"Identify Your Project's Focus Area","action":"Determine whether your project needs optimization in bundling, hydration, images, server components, or caching. Use Vercel's [Analytics Dashboard](https://vercel.com/docs/analytics) to identify the slowest pages or components.","tip":"Focus on the top 3 performance metrics in Vercel Analytics: Largest Contentful Paint (LCP), First Input Delay (FID), and Cumulative Layout Shift (CLS)."},{"step":"Run the Performance Audit","action":"Use the prompt template to generate a detailed review of your React application. Replace [PROJECT_NAME] with your Vercel project name and [SPECIFIC_AREA] with your focus area (e.g., 'bundling' or 'server components').","tip":"For large projects, break the audit into smaller modules (e.g., 'authentication flow' or 'dashboard components') to avoid overwhelming the AI."},{"step":"Implement the Recommendations","action":"Apply the fixes provided in the audit output. For Vercel-specific optimizations (e.g., Edge Caching or ISR), update your `next.config.js` or deploy the changes to Vercel.","tip":"Use Vercel's [Preview Deployments](https://vercel.com/docs/deployments/preview-deployments) to test changes before merging to production. Enable the [Vercel Toolbar](https://vercel.com/docs/vercel-toolbar) to inspect performance in real-time."},{"step":"Validate Improvements","action":"Deploy the changes to Vercel and use the [Performance Insights](https://vercel.com/docs/analytics/performance-insights) tool to compare metrics before and after. Run Vercel's [Lighthouse Audit](https://vercel.com/docs/analytics/lighthouse-audit) for each deployment.","tip":"Set up automated performance monitoring in Vercel Analytics to track improvements over time. Use the `vercel-toolbar` to simulate slow network conditions (e.g., 3G) and verify the experience for users with slower connections."},{"step":"Iterate and Optimize","action":"Re-run the audit after implementing fixes to identify remaining bottlenecks. Prioritize fixes based on their impact on Core Web Vitals and user experience.","tip":"Leverage Vercel's [Speed Insights](https://vercel.com/docs/analytics/speed-insights) to track real-world performance data from your users. Share the results with your team to align on performance goals."}]
Optimize React applications for faster load times by implementing code-splitting and lazy loading.
Implement responsive design techniques to enhance user experience across various devices and screen sizes.
Utilize server-side rendering to improve SEO performance and ensure faster initial page loads.
Streamline development workflows by integrating CI/CD practices for quicker deployment cycles.
claude install vercel-labs/agent-skills/vercel-react-best-practicesgit clone https://github.com/vercel-labs/agent-skillsCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Review the React application codebase for [PROJECT_NAME] hosted on Vercel. Identify 5 critical performance bottlenecks using Vercel's best practices for React development. For each bottleneck, provide: (1) the specific issue, (2) the recommended fix with code examples, (3) the expected performance improvement, and (4) the Vercel-specific optimization to apply. Focus on [SPECIFIC_AREA] such as [bundling, hydration, images, server components, or caching]. Prioritize fixes that can be implemented within 1 week. Include a Vercel deployment checklist to validate improvements.
### Performance Audit for Acme Corp's Dashboard (v2.1.3)
**1. Client-Side Bundle Size (Issue: 4.2MB → Target: < 1.5MB)**
- **Problem**: The main bundle includes unused libraries (`lodash`, `moment`) and unoptimized SVG icons.
- **Fix**: Implement dynamic imports for heavy libraries and convert SVG icons to React components with SVGR.
```javascript
// Before
import { debounce } from 'lodash';
import moment from 'moment';
// After
const debounce = await import('lodash/debounce');
const moment = await import('moment');
```
- **Expected Improvement**: 65% reduction in bundle size (down to 1.4MB).
- **Vercel Optimization**: Enable `next.config.js` `transpilePackages` for shared libraries and leverage Vercel's automatic code-splitting.
**2. Server Component Hydration Mismatch (Issue: 18% hydration errors)**
- **Problem**: Mismatch between server-rendered HTML and client-side React hydration due to dynamic imports in server components.
- **Fix**: Move all dynamic imports to client components and use `loading.js` for suspense boundaries.
```javascript
// Before (Server Component)
import dynamic from 'next/dynamic';
const Chart = dynamic(() => import('../components/Chart'), { ssr: false });
// After (Client Component)
'use client';
import dynamic from 'next/dynamic';
```
- **Expected Improvement**: 0% hydration errors, 15% faster Time to Interactive (TTI).
- **Vercel Optimization**: Leverage Vercel's Edge Runtime for static parts of the page while keeping dynamic parts on the client.
**3. Unoptimized Image Delivery (Issue: 12MB total image weight)**
- **Problem**: Images are served in original resolution (e.g., 4K hero image) without compression or modern formats.
- **Fix**: Use Vercel's `next/image` with `priority` for above-the-fold images and `placeholder` for lazy-loaded images.
```javascript
// Before
<img src="/hero.jpg" alt="Hero" />
// After
import Image from 'next/image';
<Image
src="/hero.jpg"
alt="Hero"
width={1920}
height={1080}
priority
placeholder="blur"
blurDataURL="data:image/jpeg;base64,..."
/>
```
- **Expected Improvement**: 70% reduction in image weight (down to 3.6MB), 40% faster Largest Contentful Paint (LCP).
- **Vercel Optimization**: Enable Vercel Image Optimization (powered by Akamai) in `next.config.js`:
```javascript
images: {
loader: 'vercel',
formats: ['image/avif', 'image/webp'],
}
```
**4. Missing Edge Caching for API Routes (Issue: 800ms avg API response time)**
- **Problem**: API routes are not cached, causing repeated database queries for static data.
- **Fix**: Implement Vercel's Edge Caching for API routes returning static data.
```javascript
// Before
export async function GET() {
const data = await fetchData(); // Hits database every time
return Response.json(data);
}
// After
export async function GET() {
const cacheKey = `api-data-${JSON.stringify(params)}`;
const cached = await caches.default.match(cacheKey);
if (cached) return cached;
const data = await fetchData();
const response = Response.json(data);
await caches.default.put(cacheKey, response.clone());
return response;
}
```
- **Expected Improvement**: 90% reduction in API response time (down to 80ms), 50% reduction in database load.
- **Vercel Optimization**: Use Vercel's Edge Network by deploying the API route to the Edge Runtime:
```javascript
export const runtime = 'edge';
```
**5. Lack of Incremental Static Regeneration (ISR) (Issue: 100% rebuilds on content updates)**
- **Problem**: The blog section rebuilds the entire site when a single post is updated.
- **Fix**: Implement ISR with a revalidation interval of 3600 seconds (1 hour) for blog posts.
```javascript
// Before
export async function getStaticProps() {
const posts = await getPosts();
return { props: { posts } };
}
// After
export async function getStaticProps() {
const posts = await getPosts();
return {
props: { posts },
revalidate: 3600 // Revalidate every hour
};
}
```
- **Expected Improvement**: 95% reduction in build times for content updates, 30% faster deployments.
- **Vercel Optimization**: Use Vercel's automatic ISR fallback for pages not accessed in 30 days.
### Vercel Deployment Checklist
1. **Bundle Analysis**: Run `npm run build` and analyze the output with `npm install -g @next/bundle-analyzer` to verify bundle size reductions.
2. **Hydration Test**: Use Vercel's [Interactions Timeline Tool](https://vercel.com/docs/vercel-toolbar/interaction-timing-tool) to confirm 0% hydration errors.
3. **Image Optimization**: Verify that images are served in AVIF/WebP format and lazy-loaded correctly.
4. **Edge Caching**: Test API responses with `curl -I` to confirm caching headers (`x-vercel-cache: HIT`).
5. **ISR Validation**: Update a blog post and verify that the change appears within 1 hour without a full rebuild.
**Next Steps**:
- Implement the 3 highest-impact fixes (Bundle Size, Image Optimization, Edge Caching) in the next sprint.
- Schedule a performance review after deployment to measure improvements against Vercel's Core Web Vitals benchmarks.We create engaging workshops for companies and private events centred around plants, flowers and all things botanical.
Orchestrate workloads with multi-cloud support, job scheduling, and integrated service discovery features.
Serverless MySQL database platform
Design, document, and generate code for APIs with interactive tools for developers.
CI/CD automation with build configuration as code
Enhance performance monitoring and root cause analysis with real-time distributed tracing.
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan