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/js-static-import" ~/.claude/skills/intense-visions-harness-engineering-js-static-import && rm -rf "$T"
manifest:
agents/skills/claude-code/js-static-import/SKILL.mdsource content
JS Static Import
Use static import declarations to load ES modules at parse time for tree-shaking and static analysis
When to Use
- You need to import functions, classes, or constants that are always required at startup
- You want bundlers (webpack, Vite, Rollup) to tree-shake unused exports
- You need static analysis support for IDE auto-imports, type checking, and refactoring
Instructions
- Use
at the top of the file for all compile-time dependencies.import { name } from './module.js' - Prefer named exports over default exports — they enable tree-shaking and IDE auto-imports.
- Group imports: external packages first, then internal modules, then relative paths.
- Never use
in ESM files — staticrequire()
enables bundler dead-code elimination.import
// Named exports — tree-shakeable import { useState, useEffect } from 'react'; import { formatDate, parseDate } from '../utils/date.js'; // Default export — avoid when possible import MyComponent from './MyComponent.js';
- Use
sparingly — it imports everything and can defeat tree-shaking.import * as ns from './module.js'
Details
Static
import declarations are resolved at parse time, before any code executes. This enables bundlers to analyze the dependency graph and eliminate unused exports (tree-shaking). Static imports are hoisted — they run before the module body regardless of where they appear in the file.
Trade-offs:
- Static imports cannot be conditional — they always load, even if the imported value is rarely used
- Circular dependencies between static imports can cause initialization issues (temporal dead zone)
- Large static import trees increase initial bundle size and startup time
When NOT to use:
- For heavy libraries used only in rare code paths — use dynamic
insteadimport() - For feature-flagged code that should not be loaded unless the flag is enabled
- For route-specific code in SPAs — use code splitting with dynamic import
Source
https://patterns.dev/javascript/static-import
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.