From harness-claude
Guides on using static ES module imports with tree-shaking for optimal bundling performance. Covers when to use static vs dynamic import and avoiding barrel files.
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:react-static-importThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Bundle all dependencies at build time for predictable loading performance
Bundle all dependencies at build time for predictable loading performance
import syntax at the top of the file.index.ts re-exporting everything) when tree-shaking matters.// Good: named import, tree-shakeable
import { formatDate } from 'date-fns';
// Good: specific internal module
import { Button } from '@/components/Button';
// Avoid for large libraries when only one function is needed
import _ from 'lodash'; // pulls entire lodash into bundle
import { debounce } from 'lodash'; // only debounce
Static imports are resolved at build time by the bundler (Webpack, Vite, esbuild). The bundler builds a dependency graph and includes all statically imported modules in the bundle.
Tree-shaking: Dead code elimination — if you import a named export but never use it, the bundler can eliminate it (with sideEffects: false in package.json and named imports). Side-effecting imports (CSS, polyfills) should not be tree-shaken.
When to switch to dynamic import:
https://patterns.dev/react/static-import
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeProvides guidance on using static import declarations for tree-shaking, bundler optimizations, and static analysis, including trade-offs vs dynamic import.
Applies Vercel Engineering's 57 React/Next.js performance rules to eliminate waterfalls, reduce bundle size, fix re-renders, and optimize data fetching when writing, reviewing, or refactoring code.
Provides 40+ React and Next.js performance rules for eliminating waterfalls, optimizing bundles, rendering, and data fetching. Use for app optimization, code reviews, refactoring components.