install
source · Clone the upstream repo
git clone https://github.com/Intense-Visions/harness-engineering
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/Intense-Visions/harness-engineering "$T" && mkdir -p ~/.claude/skills && cp -r "$T/agents/skills/claude-code/vue-async-components" ~/.claude/skills/intense-visions-harness-engineering-vue-async-components-a02828 && rm -rf "$T"
manifest:
agents/skills/claude-code/vue-async-components/SKILL.mdsource content
Vue Async Components
Load Vue components lazily to reduce initial bundle size using defineAsyncComponent
When to Use
- A component is heavy (charts, editors, maps) and not needed on initial render
- Implementing route-based code splitting in a Vue Router application
- Conditionally loading components behind feature flags or user interactions
Instructions
- Use
to lazy-load.defineAsyncComponent(() => import('./HeavyComponent.vue')) - Provide
andloadingComponent
options for UX during loading.errorComponent - Set a
(ms) before showing the loading component to avoid flicker.delay - Wrap async components in
for coordinated loading states.<Suspense>
import { defineAsyncComponent } from 'vue'; const AsyncChart = defineAsyncComponent({ loader: () => import('./Chart.vue'), loadingComponent: LoadingSpinner, errorComponent: ErrorDisplay, delay: 200, timeout: 10000, });
- For Vue Router, use
directly in route definitions.() => import('./views/Page.vue')
Details
Async components in Vue 3 use
defineAsyncComponent to wrap a dynamic import(). The bundler splits the component into a separate chunk that is loaded only when the component is first rendered. This reduces the initial JavaScript payload.
Trade-offs:
- Loading delay — users see a spinner or blank space while the component loads
- Error handling is required — network failures must be caught and displayed gracefully
- Too many async components can cause a "waterfall" of sequential network requests
- SSR requires special handling — the server must await all async components before sending HTML
When NOT to use:
- For small, frequently used components — the overhead of a separate chunk is not worth it
- For above-the-fold content that must render immediately
- When the component is always needed — static import is simpler
Source
https://patterns.dev/vue/async-components
Process
- Read the instructions and examples in this document.
- Apply the patterns to your implementation, adapting to your specific context.
- Verify your implementation against the details and edge cases listed above.
Harness Integration
- Type: knowledge — this skill is a reference document, not a procedural workflow.
- No tools or state — consumed as context by other skills and agents.
Success Criteria
- The patterns described in this document are applied correctly in the implementation.
- Edge cases and anti-patterns listed in this document are avoided.