Import on Interaction
Teaches interaction-based lazy loading for non-critical resources. Use when you have heavy components or libraries that are only needed after user interaction like clicks, hovers, or form input.
Install
npx skills add PatternsDev/skills --skill import-on-interactiongit clone --depth 1 https://github.com/PatternsDev/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/javascript/import-on-interaction ~/.claude/skills/import-on-interactionPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Import On Interaction ## Table of Contents - [When to Use](#when-to-use) - [When NOT to Use](#when-not-to-use) - [Instructions](#instructions) - [Details](#details) - [Source](#source) Your page may contain code or data for a component or resource that isn't immediately necessary. For example, part of the user-interface a user doesn't see unless they click or scroll on parts of the page. This can apply to many kinds of first-party code you author, but this also applies to third-party widgets such as video players or chat widgets where you typically need to click a button to display the main interface. ## When to Use - Use this when you have third-party widgets (video players, chat widgets) that are costly to load eagerly - This is helpful for deferring non-critical code until the user actually needs it - Use this to improve First Input Delay (FID) and Time to Interactive (TTI) ## When NOT to Use - When the resource is needed immediately on page load and isn't gated behind a user interaction - When the loading delay after interaction creates a noticeably poor user experience (consider prefetch/preload instead) - For small modules where the dynamic import overhead exceeds the savings from deferring ## Instructions - Use dynamic `import()` to load modules on user interaction (click, hover, etc.) - Implement facades (lightweight placeholders) for heavy third-party embeds - For first-party code, prefer prefetching over import-on-interaction when possible
Details
- Skill name
import-on-interaction- Repository
- PatternsDev/skills
- Path
javascript/import-on-interaction/SKILL.md- Repo updated
- 15 April 2026
FAQ
What does the Import on Interaction skill do?
Teaches interaction-based lazy loading for non-critical resources. Use when you have heavy components or libraries that are only needed after user interaction like clicks, hovers, or form input.
How do I install the Import on Interaction skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add PatternsDev/skills --skill import-on-interaction. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Import on Interaction popular?
It lives in PatternsDev/skills, which has 259 GitHub stars and 28 forks.
Related skills
AI UI Patterns
259PatternsDev/skills
Teaches design patterns for building AI-powered React interfaces. Use when creating chatbots, intelligent assistants, streaming UIs, or any AI-driven user experience in React.
Async Components
259PatternsDev/skills
Teaches async component loading in Vue for performance optimization. Use when you have heavy components that aren't needed on initial render and can be loaded on demand.
Bundle Splitting
259PatternsDev/skills
Teaches bundle splitting techniques for web performance. Use when your application has a large JavaScript bundle that affects load times or when you need to reduce FCP/LCP.
Import on Visibility
259PatternsDev/skills
Teaches visibility-based lazy loading using Intersection Observer. Use when you have below-the-fold components or images that don't need to load until the user scrolls to them.
Flyweight Pattern
259PatternsDev/skills
Teaches the flyweight pattern for memory optimization. Use when your application creates large numbers of similar objects and memory consumption is a concern.
Islands Architecture
259PatternsDev/skills
Teaches the islands architecture pattern for partial hydration. Use when building content-heavy sites where most of the page is static and only small regions need interactivity.
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.