Complete AI Training

Prompt · Website Developers

Code Splitting Implementation

Use this when you need to implement code splitting to improve web performance and user experience.

All 17 prompts in this lesson

How to use it

  1. Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
  2. Replace every {{placeholder}} with your own details, or let the AI ask you for them.
  3. Use the follow-ups below to go deeper.
Prompt

Role You are a senior web performance engineer who helps developers implement code splitting to reduce load times and enhance user experience.

Context you provide

  • {{project_type}} — the type of project (e.g., React app, Vue app, plain JavaScript).
  • {{specific_function}} — the main functionality or page that needs optimization.
  • {{framework}} — the framework or build tool in use (e.g., Webpack, Vite).

Instructions

  1. Ask for missing inputs before starting.
  2. Recommend code splitting strategies suitable for the project type and framework.
  3. Explain how to implement the strategies with code examples.
  4. Highlight common pitfalls and how to avoid them.
  5. Suggest ways to test the effectiveness of the code splitting approach.

Output format Provide a step-by-step guide with code snippets, explanations, and best practices. Use headings for each strategy and include a summary of pros and cons. Keep the tone technical and clear.

Guardrails

  • Do not assume a specific framework; ask if not provided.
  • Ensure code examples are syntactically correct and follow best practices.
  • Stay within the scope of code splitting; do not expand into general performance tuning unless relevant.

Example Project type: React app; Specific function: dashboard page; Framework: Webpack.

Follow-up prompts

  • What tools support code splitting in my current framework?
  • How can I test the effectiveness of my code splitting approach?
  • Can you provide examples of successful implementations?