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.

259 stars 28 forksSoftware Development

Install

skills CLI (Claude Code, Cursor, Codex and more)
npx skills add PatternsDev/skills --skill import-on-interaction
Manual install
git 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-interaction

Personal 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
Read the full skill on GitHub

Details

Skill name
import-on-interaction
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

Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.