dtyq/magic/dual-edition-module-migration
Claude Code and agent skill by dtyq/magic
- community
Checking that the SKILL.md file is still in the repository.
Migrate modules between shared `src/opensource/` code and enterprise overlays under `enterprise/src/opensource/`, while preserving the `src/opensource` boundary and existing component override points.
Install
npx vskill@latest install dtyq/magic/dual-edition-module-migrationSKILL.md
The same SKILL.md was published earlier as dtyq/magic/dual-edition-module-migration.
Dual Edition Module Migration
When to apply
- A module must exist in both open-source and enterprise editions
- The user mentions
src/opensource,enterprise/, Vite overlay, or edition-specific behavior - A shared module needs to stay under
src/opensource/..., but enterprise behavior must override it - Old
src/variant/...orsrc/opensource/variant/...facades need to be removed - A migration must preserve the
src/opensourceimport boundary
Core invariants
1. src/opensource is the shared source of truth
- Code under
src/opensource/is the default implementation src/opensource/must not import commercial code- If open-source needs a dependency, migrate that dependency too or degrade the feature
- If a file under
src/opensource/orenterprise/src/opensource/imports a module outside theopensourcetree, move that dependency into the currentopensourceclosure instead of keeping a shim - Do not pull private infrastructure such as
keewoodClientorteamshareClientintosrc/opensource
2. enterprise/ is an overlay, not a second app
- Keep the same relative path under
enterprise/as the shared file undersrc/ - Runtime resolution priority is
enterprise/**first, thensrc/** - Enterprise files should be as thin as possible
- Prefer a re-export shim in
enterprise/...when it preserves behavior without duplication - Do not use re-export shims when the stable caller path is already
@/opensource/...and the shim would import from outside theopensourcetree - If a dependency chain is truly enterprise-only, keep the whole chain in
enterprise/... - Do not leave enterprise-only stores or services in
srcjust because enterprise files import them - Do not create an enterprise overlay file that re-imports the same logical
@/opensource/...path it overrides - If the stable caller path is
@/opensource/..., the enterprise implementation must live underenterprise/src/opensource/... - Do not move a dual-edition module into
enterprise/components/...or another non-mirrored path unless the user explicitly wants a commercial-only module
3. Open-source callers should import the real shared path
- Files under
src/opensource/should import@/opensource/...directly - Do not keep
@/variant/...in open-source code - If enterprise needs different behavior for that shared path, add an overlay file under
enterprise/src/opensource/...
4. Choose extension point by artifact type
Use this rule first:
| Artifact | Preferred mechanism | |
|---|---|---|
| React view/component rendered through factory | ComponentFactory default in src/opensource plus enterprise or premium override where still needed | |
| Hook / service / preload helper imported from open-source code | Direct @/opensource/... import plus enterprise/src/opensource/... overlay when behavior differs | |
| Shared implementation used by both editions | Move to src/opensource/...; if callers already target @/opensource/..., migrate the real code and delete the old file instead of leaving a compatibility shim | |
Legacy src/components/... module becoming dual-edition | Migrate to src/opensource/... plus mirrored enterprise/src/opensource/...; then switch callers to @/opensource/... | |
| Runtime-only indirection | src/runtime/<domain>/ only when direct imports and overlay cannot express the binding |
Architecture patterns
Pattern A: Shared baseline plus enterprise overlay
Use this for hooks, services, helpers, and other non-visual modules.
- Keep the default implementation in
src/opensource/... - Update callers to import that
@/opensource/...path directly - If enterprise behavior differs, add the same path under
enterprise/src/opensource/... - Let Vite resolve the enterprise file first at runtime
- Remove the old
variantfacade after callers are switched
Minimal example:
Pattern B: Component override
Use this when a UI component needs edition-specific rendering.
- Keep the default implementation in
src/opensource/... - Register it in
src/opensource/components/ComponentRender/config/defaultComponents.tsx - Keep commercial-only UI in
src/...only when it owns real delta - Register premium overrides only where the factory still needs explicit component replacement
- For helper imports such as preload code, prefer direct
@/opensource/...imports plus enterprise overlay
This keeps render-time switching and non-render imports aligned.
Pattern B.5: Shared facade plus enterprise child override
Use this when the only edition difference is a small injected block inside a much larger shared page or layout.
Rules:
- Extract the changing block into the smallest possible shared child component or hook under
src/opensource/... - Keep the shared baseline minimal:
null,false, no-op callback, or another tiny safe fallback - Mirror only that child component or hook under
enterprise/src/opensource/... - Update the large shared page or layout to import the stable
@/opensource/...facade instead of importing commercial modules directly - Do not override the whole page or layout when a banner, modal, slogan, model tag, or hook is the real variability point
Why:
- It minimizes duplicated page code
- It prevents accidental divergence between editions
- It makes review easier because the commercial delta is isolated to one extension point
Example use cases:
- Activity banner slot in
EmptyWorkspacePanel - Activity modal slot in
MainLayout - Login slogan slot in
SSOLayout - Enterprise-only hook such as
useFreePointsTrigger
Pattern C: Temporary enterprise shim over existing commercial file
Use this only as a short-lived transition when a large enterprise implementation already exists under src/... and the user has not required a hard opensource-only closure.
- Add
enterprise/src/opensource/<same-path>.ts(x) - Re-export from the existing commercial file under
src/... - Switch all shared callers to
@/opensource/... - Remove
variantfiles - Later, inline or fold the shim if the codebase is cleaned up further
Do not use this pattern when the user requires src/opensource/... and enterprise/src/opensource/... to avoid importing any dependency outside the opensource tree.
Pattern D: Enterprise-only dependency closure
Use this when a module and its dependencies only exist for enterprise or App-native behavior.
Rules:
- Move the whole closure into
enterprise/src/opensource/... - Do not add
src/opensourcestubs for enterprise-only stores or services unless the user explicitly wants a temporary bridge - Update enterprise callers to use the stable
@/opensource/...path, so overlay resolves the real file - Delete the old
src/...files once imports are switched
Example closure:
stores/recordingSummary/appNative.tsservices/recordSummaryAppNativeService/**services/AppAIRecordingService/**
Why:
- Leaving half the chain in
srcrecreates the old boundary violation - Enterprise-only dependencies should not look shared just because shared callers reference the logical path
Pattern E: Enterprise-only module with open-source stub
Use when a hook or component is moved entirely to enterprise/src/opensource/..., but src/opensource callers still import it (e.g. overlay disabled, or callers exist in both editions).
Rules:
- Keep a stub in
src/opensource/...at the same logical path - Stub returns no-op values: empty array for lists,
falsefor flags,() => {}for callbacks,nullfor ReactNode - Stub must match the enterprise interface exactly so all callers work without changes
- Enterprise overlay provides the full implementation when overlay is enabled
Stub minimization rules:
- Keep only the smallest surface that current open-source callers actually import
- Do not copy enterprise-only helper files, upload types, or private dependency adapters into
src/opensource/...if the stub does not use them - Prefer flattening a stub to one file when the open-source side only needs a no-op export plus one or two lightweight enums or helpers
- If a helper already exists globally, reuse it instead of creating a module-local duplicate in the stub
Example:
Pattern F: Optional runtime facade
Use only when direct imports plus overlay are still not enough.
Rules:
- Create
src/runtime/<domain>/ - Export a stable runtime API from that layer
- Keep
src/opensource/off that runtime facade unless the user explicitly wants the extra indirection - Justify the runtime layer with a real binding problem, not habit
Enterprise overlay import resolution
When creating an enterprise overlay file (e.g. enterprise/src/opensource/.../ProjectCardContainer), relative imports like ../ProjectCard may fail TypeScript resolution if the target has no enterprise overlay (only partial overlay like ProjectCardShareSection).
Rule: use @/opensource/... absolute paths for modules that exist only in src or have no full enterprise overlay, so resolution falls through to src correctly.
Migration workflow
0. Find all importers before migration
Before moving or stubbing a module, run rg "ModuleName|useModuleName" (or equivalent) to find every caller.
Rule: each importer must either (a) get the stub when overlay is disabled, or (b) be updated to conditionally use the feature. Missing an importer causes build failures such as EISDIR or "module not found".
0.5. Choose the final logical path first
Before creating files, decide which import path should survive after migration.
Ask:
- Should callers end up on
@/opensource/...? - Is this actually a commercial-only module that should stay under
@/components/...? - Does the enterprise implementation need to mirror
src/opensource/...underenterprise/src/opensource/...?
Rule: do not start by copying code into enterprise/components/... when the long-term target is a dual-edition @/opensource/... path.
0.6. Choose the smallest override surface
Before creating any overlay file, ask:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingfrontend/magic-web/.agents/skills/dual-edition-module-migration/SKILL.md
Popularity
- Repository stars
- 4,821
- Repository forks
- 525
- 7-day trend score
- 42
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 18 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dtyq/magic/dual-edition-module-migration)