diff --git a/docs/guides/netlify-mcp-continuous-deployment.mdx b/docs/guides/netlify-mcp-continuous-deployment.mdx index aa1ee46d5..c94a44267 100644 --- a/docs/guides/netlify-mcp-continuous-deployment.mdx +++ b/docs/guides/netlify-mcp-continuous-deployment.mdx @@ -20,12 +20,14 @@ sidebarTitle: "Using Netlify MCP for Performance Optimization" - [Identity](https://docs.netlify.com/visitor-access/identity/) for user authentication - [Large Media](https://docs.netlify.com/large-media/overview/) for Git LFS support - This guide shows you how to leverage these features through natural language with Continue CLI! +This guide shows you how to leverage these features through natural language with Continue CLI! + ## What You'll Learn This cookbook teaches you to: + - Run [A/B tests](https://docs.netlify.com/site-deploys/split-testing/) between branches to measure performance impact - Monitor [Core Web Vitals](https://docs.netlify.com/analytics/get-started/#core-web-vitals) and build performance metrics - Automatically block deploys that degrade performance using [Deploy Contexts](https://docs.netlify.com/site-deploys/overview/#deploy-contexts) @@ -49,12 +51,12 @@ This cookbook teaches you to: ``` - - 1. Install Netlify CLI: `npm i -g netlify-cli` - 2. Authenticate with Netlify: `netlify login` - 3. Visit [Netlify MCP on Continue Hub](https://hub.continue.dev/netlify/netlify-mcp) - 4. Follow the configuration instructions for your editor - + + 1. Install Netlify CLI: `npm i -g netlify-cli` 2. Authenticate with Netlify: + `netlify login` 3. Visit [Netlify MCP on Continue + Hub](https://hub.continue.dev/netlify/netlify-mcp) 4. Follow the configuration + instructions for your editor + Install the [Netlify Development Rules](https://hub.continue.dev/netlify/netlify-development) bundle for best practices: @@ -62,6 +64,7 @@ This cookbook teaches you to: 1. Visit the bundle page on Continue Hub 2. Click **"Install Rules"** 3. Rules automatically apply to your agent + @@ -72,15 +75,14 @@ This cookbook teaches you to: # Then in TUI mode: "Check my Netlify auth and list sites" ``` + - The Netlify Development Rules bundle includes guardrails for: - - Proper `.gitignore` configuration - - Function structure and placement - - Edge function constraints - - Local development best practices + The Netlify Development Rules bundle includes guardrails for: - Proper + `.gitignore` configuration - Function structure and placement - Edge function + constraints - Local development best practices ## Performance Optimization Steps @@ -98,17 +100,17 @@ cn ``` - **Test in Plan Mode First**: Before making performance optimizations that might affect your site, - test your prompts in plan mode (see the [Plan Mode Guide](/guides/plan-mode-guide); press **Shift+Tab** to switch modes). This shows you - what the agent will do without executing it. For example: - `"Set up A/B testing between main and feature branch with performance monitoring"` + **Test in Plan Mode First**: Before making performance optimizations that + might affect your site, test your prompts in plan mode (see the [Plan Mode + Guide](/guides/plan-mode-guide); press **Shift+Tab** to switch modes). This + shows you what the agent will do without executing it. For example: `"Set up + A/B testing between main and feature branch with performance monitoring"` - Netlify automatically tracks: - - **Build Performance**: Compile times, cache hits - - **Runtime Performance**: Core Web Vitals, Time to Interactive - - **Resource Usage**: Bandwidth, function execution times + Netlify automatically tracks: - **Build Performance**: Compile times, cache + hits - **Runtime Performance**: Core Web Vitals, Time to Interactive - + **Resource Usage**: Bandwidth, function execution times ### Step 2: A/B Test Branch Performance @@ -129,10 +131,11 @@ Report winner based on performance + conversion metrics" ``` - **Enhanced Analytics**: Combine Netlify's A/B testing with PostHog session recordings - to understand not just which variant performs better, but why users behave differently. - See our [PostHog session analysis guide](/guides/posthog-github-continuous-ai) to set up - session tracking and create a complete continuous AI analytics workflow. + **Enhanced Analytics**: Combine Netlify's A/B testing with PostHog session + recordings to understand not just which variant performs better, but why users + behave differently. See our [PostHog session analysis + guide](/guides/posthog-github-continuous-ai) to set up session tracking and + create a complete continuous AI analytics workflow. ### Step 3: Advanced Build Optimization with Netlify @@ -172,7 +175,8 @@ Show me the netlify.toml configuration and explain each optimization" - [Conditional Builds](https://docs.netlify.com/configure-builds/ignore-builds/) - Skip unnecessary builds - [Monorepo Support](https://docs.netlify.com/configure-builds/monorepos/) - Optimize multi-package repos - These features can reduce build times by 50-70% for most projects! +These features can reduce build times by 50-70% for most projects! + ### Step 4: Bundle Analysis with Netlify's Built-in Tools @@ -209,11 +213,15 @@ Generate a full report with before/after bundle sizes" ``` - **Features Available Through Netlify MCP**: - - [Bundle Analyzer](https://docs.netlify.com/configure-builds/build-plugins/bundle-analyzer/) - Visualize your JavaScript bundles - - [Asset Optimization](https://docs.netlify.com/configure-builds/post-processing/) - Automatic minification and compression - - [Edge Network](https://docs.netlify.com/platform/edge-network/) - Global CDN with smart caching - - [Deploy Previews](https://docs.netlify.com/site-deploys/deploy-previews/) - Test optimizations before production + **Features Available Through Netlify MCP**: - [Bundle + Analyzer](https://docs.netlify.com/configure-builds/build-plugins/bundle-analyzer/) + - Visualize your JavaScript bundles - [Asset + Optimization](https://docs.netlify.com/configure-builds/post-processing/) - + Automatic minification and compression - [Edge + Network](https://docs.netlify.com/platform/edge-network/) - Global CDN with + smart caching - [Deploy + Previews](https://docs.netlify.com/site-deploys/deploy-previews/) - Test + optimizations before production ### Step 5: Image Optimization @@ -243,7 +251,7 @@ Set and enforce performance budgets with automated testing: "Set up Lighthouse CI with performance budgets for my Netlify site: Requirements: -- LCP must be < 2.5 seconds +- LCP must be < 2.5 seconds - JavaScript bundle must be < 200KB - Total size < 500KB - Performance score >= 90 @@ -259,8 +267,9 @@ Please configure the complete Lighthouse CI setup with these budgets." ``` - This comprehensive setup will automatically test every deploy preview and - production deployment, blocking any changes that violate your performance budgets. + This comprehensive setup will automatically test every deploy preview and + production deployment, blocking any changes that violate your performance + budgets. ### Step 7: Real User Monitoring with Netlify Analytics @@ -307,9 +316,10 @@ Show me the complete implementation with all code and configurations" ``` - **Note**: Netlify Analytics Pro requires a paid Netlify Pro account ($19/month per site). - The prompt above assumes you have this plan. For free tier users, focus on steps 2-5 which - use Netlify Functions and Edge Functions to build custom analytics. + **Note**: Netlify Analytics Pro requires a paid Netlify Pro account ($19/month + per site). The prompt above assumes you have this plan. For free tier users, + focus on steps 2-5 which use Netlify Functions and Edge Functions to build + custom analytics. @@ -320,23 +330,21 @@ Show me the complete implementation with all code and configurations" - [Edge Insights](https://docs.netlify.com/edge-functions/overview/#geolocation) - Geographic performance data - [No Cookie Banner Required](https://docs.netlify.com/analytics/get-started/#privacy) - GDPR compliant by default - Unlike Google Analytics, Netlify Analytics: - - Doesn't slow down your site (server-side) - - Captures 100% of traffic (no ad blockers) - - Respects user privacy (no cookies) - - Shows bot traffic separately +Unlike Google Analytics, Netlify Analytics: + +- Doesn't slow down your site (server-side) +- Captures 100% of traffic (no ad blockers) +- Respects user privacy (no cookies) +- Shows bot traffic separately - **Pro Tip**: Combine Netlify Analytics with Edge Functions to create a powerful RUM solution that: - - Tracks performance by user segment - - A/B tests performance optimizations - - Personalizes content based on connection speed - - Automatically serves lighter assets to slow connections + **Pro Tip**: Combine Netlify Analytics with Edge Functions to create a + powerful RUM solution that: - Tracks performance by user segment - A/B tests + performance optimizations - Personalizes content based on connection speed - + Automatically serves lighter assets to slow connections - - ## Automated Performance Checks ### GitHub Actions Performance Guard @@ -356,7 +364,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: '22' + node-version: "22" - name: Deploy and Test Performance id: perf @@ -406,10 +414,9 @@ jobs: ``` - This workflow will: - - **Block merge** if performance score drops >10 points - - **Warn** on any performance regression - - **Celebrate** improvements with green indicators + This workflow will: - **Block merge** if performance score drops >10 points - + **Warn** on any performance regression - **Celebrate** improvements with green + indicators ## Performance Testing Locally @@ -445,22 +452,21 @@ Identify and fix performance bottlenecks: ### Performance Issue Quick Fixes -| Issue | Quick Fix Command (in cn TUI) | -|-------|--------------------------------| -| Slow LCP | `"Preload critical resources"` | -| High CLS | `"Add size attributes to images"` | -| Large bundles | `"Implement code splitting"` | -| Slow builds | `"Enable build caching"` | -| Poor caching | `"Configure cache headers"` | +| Issue | Quick Fix Command (in cn TUI) | +| ------------- | --------------------------------- | +| Slow LCP | `"Preload critical resources"` | +| High CLS | `"Add size attributes to images"` | +| Large bundles | `"Implement code splitting"` | +| Slow builds | `"Enable build caching"` | +| Poor caching | `"Configure cache headers"` | ## What You've Accomplished - You've built an AI-powered performance optimization system that: - - Automatically monitors Core Web Vitals - - Runs A/B tests between branches - - Blocks deployments that degrade performance - - Provides actionable optimization suggestions + You've built an AI-powered performance optimization system that: - + Automatically monitors Core Web Vitals - Runs A/B tests between branches - + Blocks deployments that degrade performance - Provides actionable optimization + suggestions ## Discover Netlify's Hidden Performance Gems @@ -476,21 +482,18 @@ Features many developers don't know Netlify offers: - Personalize content without client-side JS - - **[Netlify Graph](https://docs.netlify.com/graph/overview/)** - - Unified GraphQL gateway for all your APIs - - Automatic TypeScript generation - - Built-in authentication handling - - Zero client-side API keys needed - + + **[Netlify Graph](https://docs.netlify.com/graph/overview/)** - Unified + GraphQL gateway for all your APIs - Automatic TypeScript generation - Built-in + authentication handling - Zero client-side API keys needed + - - **[On-Demand Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)** - - Generate pages only when requested - - Cache dynamically generated content - - Perfect for large sites (10k+ pages) - - Reduce build times dramatically - + + **[On-Demand + Builders](https://docs.netlify.com/configure-builds/on-demand-builders/)** - + Generate pages only when requested - Cache dynamically generated content - + Perfect for large sites (10k+ pages) - Reduce build times dramatically + **[Background Functions](https://docs.netlify.com/functions/background-functions/)** @@ -512,39 +515,47 @@ Features many developers don't know Netlify offers: The Netlify Performance Rules enforce: -✅ **Build Optimization** -- Dependency caching enabled -- Parallel builds when possible -- Incremental compilation -- Smart cache invalidation + + + - Dependency caching enabled + - Parallel builds when possible + - Incremental compilation + - Smart cache invalidation + -✅ **Runtime Performance** -- Automatic image optimization -- Efficient resource hints (preload, prefetch) -- Optimal cache headers -- CDN configuration + + - Automatic image optimization + - Efficient resource hints (preload, prefetch) + - Optimal cache headers + - CDN configuration + -✅ **Monitoring Standards** -- Performance budgets enforced -- Core Web Vitals tracking -- Real user monitoring -- Automated alerts + + - Performance budgets enforced + - Core Web Vitals tracking + - Real user monitoring + - Automated alerts + + ## Advanced Performance Strategies ### Progressive Enhancement + ```bash # In cn TUI mode: "Implement progressive enhancement with basic HTML first" ``` ### Multi-variant Testing + ```bash # In cn TUI mode: "Test 3 bundle strategies and auto-select winner" ``` ### Predictive Prefetching + ```bash # In cn TUI mode: "Analyze navigation patterns and prefetch next pages" @@ -562,4 +573,4 @@ The Netlify Performance Rules enforce: - [Netlify MCP on Continue Hub](https://hub.continue.dev/netlify/netlify-mcp) - [Core Web Vitals Guide](https://web.dev/vitals/) - [Netlify Analytics Documentation](https://docs.netlify.com/analytics/) -- [Continue Performance Guides](https://docs.continue.dev/guides) \ No newline at end of file +- [Continue Performance Guides](https://docs.continue.dev/guides)