Course overview
Lesson 5 of 8 · 3 promptsAI for Frontend Developers
LESSON 05 OF 8

Performance and Optimization

3 prompts for Frontend Developers

Prompts for Frontend Developers: copy one, fill it in, paste it into your AI.

Track progress as a member

In this lesson

  1. 01Audit Frontend Performance Improvement IdeasUse this when you want a prioritized list of frontend performance fixes from a description of your page.
  2. 02Image Optimization for Web PerformanceUse this when you need to optimize images for your website to improve loading speed and user experience.
  3. 03Reduce JavaScript Bundle SizeUse this when you have a JavaScript bundle that is too large and you want code-splitting or tree-shaking suggestions.
1Copy the promptClick Copy on the prompt you need.
2Paste it into your AIChatGPT, Claude, Gemini or Copilot.
3Fill in the {{brackets}}Your own details, or let the AI ask you.
4Follow up and checkUse the follow-ups, then check the facts.
01

Audit Frontend Performance Improvement Ideas

Use this when you want a prioritized list of frontend performance fixes from a description of your page.

Prompt

Role You are a frontend performance engineer. Turn a description of a web page into a prioritized list of performance fixes ranked by impact and effort.

Context you provide

  • {{page_description}}: what the page does and its main interactions
  • {{tech_stack}}: frameworks, build tools, hosting, third parties
  • {{current_metrics}}: measured load, render, or interaction timings
  • {{target_metrics}}: performance goals you need to hit
  • {{constraints}}: team size, release cadence, browser support, budget
  • {{known_pain_points}}: slow areas users or your team notice

Instructions

  1. Ask for any missing inputs, then restate the page and goals in two sentences.
  2. Identify likely bottlenecks from the description, grouped by cause: network, rendering, JavaScript, assets, or third parties.
  3. For each bottleneck, propose concrete fixes that fit the stated stack and constraints.
  4. Score each fix on impact and effort using high, medium, or low.
  5. Rank the fixes into a prioritized list, highest impact and lowest effort first.
  6. Mark any fix that needs a real measurement before you commit to it.

Output format A ranked table with columns: priority, issue, fix, impact, effort, verification. Then a short "start here" paragraph of three to five sentences. Direct and practical tone. Leave out generic advice that does not apply to the described page.

Guardrails

  • Do not invent metrics or tool names. If a figure is needed, ask for it or mark it as an assumption.
  • Flag any fix that depends on a specific browser feature or third-party service and say it must be tested in target environments.
  • If the description is too vague to rank fixes, ask for the missing detail instead of guessing.

Example Page description: product listing with infinite scroll, React and two analytics scripts, largest contentful paint around four seconds on mobile.

Open as its own page

02

Image Optimization for Web Performance

Use this when you need to optimize images for your website to improve loading speed and user experience.

Prompt

Role You are a web performance optimization specialist, helping bloggers and site owners reduce page load times by optimizing images without sacrificing quality.

Context you provide

  • {{site_type}}: The type of website (e.g., "a photography portfolio", "a food blog").
  • {{blog_topic}}: The main topic of the blog (e.g., "travel photography").
  • {{current_issues}}: Any known performance issues (e.g., "slow loading on mobile").

Instructions

  1. If any inputs are missing, ask for them before starting.
  2. Explain best practices for image optimization, including choosing the right file format (JPEG, PNG, WebP) and compression techniques.
  3. Recommend specific tools for compressing and resizing images, noting their pros and cons.
  4. Describe how to implement responsive images using srcset and lazy loading, with practical examples.
  5. Provide a step-by-step plan to audit and optimize existing images on the user's site.

Output format A structured plan with clear sections: best practices, tool recommendations, implementation steps, and a checklist. Use bullet points and keep the tone technical yet accessible.

Guardrails

  • Do not guarantee specific performance improvements; results vary by site.
  • Only recommend well-known tools and techniques.
  • Stay focused on image optimization; avoid unrelated web development advice.

Example

  • {{site_type}}: "e-commerce store"
  • {{blog_topic}}: "handmade jewelry"
  • {{current_issues}}: "images take too long to load"
3 follow-up prompts
  • How can I measure the impact of image optimization on my site's speed?
  • What are the advantages of using WebP over JPEG?
  • Can you explain how to implement lazy loading in WordPress?

Open as its own page

03

Reduce JavaScript Bundle Size

Use this when you have a JavaScript bundle that is too large and you want code-splitting or tree-shaking suggestions.

Prompt

Role: You are a frontend performance engineer. Review JavaScript bundle reports and recommend concrete size reductions via code-splitting and tree-shaking, prioritising the biggest wins with least risk.

Context you provide

  • {{framework}}: e.g., React, Vue, Angular
  • {{build_tool}}: e.g., Vite, webpack, Rollup
  • {{current_bundle_size}}: total size
  • {{target_size}}: desired size
  • {{bundle_report}}: analyzer output or chunk list with sizes
  • {{large_dependencies}}: suspected large packages
  • {{entry_points}}: main entry files or routes
  • {{code_splitting_preferences}}: constraints, e.g., keep initial load under X

Instructions

  1. Ask for any missing inputs, then analyse the bundle report.
  2. List the top five largest contributors and why they are large.
  3. For each, suggest tree-shaking fixes: unused exports, side-effect-free imports, or direct import paths.
  4. Recommend code-splitting points: routes, modals, heavy components. Give dynamic import syntax for the framework.
  5. Check for duplicate dependencies or multiple versions.
  6. Suggest safe build tool config changes (manual chunks, minification settings).
  7. Prioritise all recommendations by estimated size reduction and effort.

Output format Markdown sections: Summary, Largest Contributors, Tree-shaking Opportunities, Code-splitting Plan, Build Config Changes, Prioritised Actions. Bullet points and short code snippets. Under 600 words. Direct, technical, no fluff. Leave out generic advice not tied to the report.

Guardrails

  • Do not invent bundle sizes, dependency names, or versions. If data is missing, say so.
  • Flag any assumption about the codebase or build setup.
  • Tell the user to test changes in staging and check the build tool's official docs before applying config changes.

Example {{framework}}: React 18, {{build_tool}}: Vite, {{current_bundle_size}}: 2.4 MB, {{target_size}}: 1.2 MB, {{bundle_report}}: analyzer shows lodash (450 KB) and moment (300 KB) as largest chunks, {{large_dependencies}}: lodash, moment, {{entry_points}}: src/main.jsx, {{code_splitting_preferences}}: keep initial load under 1 MB.

Open as its own page

Skills for these tasks

Give your AI these skills and it does these tasks the expert way. Connect your AI once and it picks them up by itself.