Skip to content
Skillpedia
Websites & UI (frontend)75k · #2774

code-splitting

What it does

This skill checks whether heavy scripts load on every page even when they are needed only sometimes. It is for developers building single page apps who want faster first loads.

When to use it

  • ✓When a web app's JavaScript bundle is large and slow to start.
  • ✓When a chart, editor or other heavy library loads on pages that never use it.
  • ✓When you add a new dependency that could be loaded later.

Skill link

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/code-splitting/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/code-splitting/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“My app loads a big chart library on every page. Split it so it loads only where charts appear.”

5 new skills a week. 1 minute to read.

How it works

The agent converts heavy static imports into dynamic import calls, splits code by route, and adds loading states so the page stays usable while the code arrives.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Split large JavaScript bundles

A 500 KB JavaScript bundle blocks page interactivity for 3–5 seconds on a mid-range mobile device even after the bytes arrive — JS must be parsed and compiled before execution. Code splitting means users only download and parse the code they actually need for the current page, dramatically improving Time to Interactive.

Quick Reference

  • Use dynamic import() to load code only when it's actually needed
  • Split routes in SPAs so each page loads only its own code
  • Lazy-load heavy third-party libraries (chart libraries, rich text editors)
  • Analyze your bundle with a visualizer to find what to split

Check

Identify any large third-party imports or feature modules in this file that could be loaded lazily with dynamic import() instead of statically.

Fix

Convert the identified static imports to dynamic imports using import() and add appropriate loading states.

Explain

Explain JavaScript code splitting, how dynamic import() works, and how to implement route-based splitting in a SPA.

Code Review

Inspect route modules, heavy feature imports, and third-party libraries loaded on initial render. Flag dependencies that can move behind import(), route boundaries, or user-triggered flows without breaking the first meaningful paint.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/javascript/code-splitting

FAQ

What does a dynamic import do?

The skill says it loads code only when it is actually needed, instead of at the start.

What should be split first?

Route-based pieces and heavy third-party libraries, such as chart libraries or rich text editors.

How can I see what to split?

The skill suggests analyzing the bundle with a visualizer tool.

Details

Original description by the author

Use when reviewing large SPA bundles, new dependency additions, or routes that feel slow to hydrate. Focus on code that is not required for the initial view and can move behind route transitions, user interaction, or viewport-based loading.

repo: thedaviddias/Front-End-Checklist

Popularity

GitHub stars
75k
Ranking position
#2774
License
MIT
Updated
10/31/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills