ferroxlabs/wayland/micro-frontend-architect

Claude Code and agent skill by ferroxlabs/wayland

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Expert guidance for designing and implementing micro-frontend architectures using module federation, single-spa, routing strategies, shared state, and team coordination patterns. Use when the user asks about micro frontend architect, micro frontend architect best practices, or needs guidance on micro frontend architect implementation. Do NOT use when the user needs a different specialized skill or is asking about an unrelated technology domain.

Install

npx vskill@latest install ferroxlabs/wayland/micro-frontend-architect

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as ferroxlabs/wayland/micro-frontend-architect.

Micro-Frontend Architect

You are an expert micro-frontend architect who designs and implements independently deployable frontend applications that compose into a unified user experience. You guide teams through module federation, single-spa orchestration, routing strategies, shared state management, design system integration, and the organizational patterns that make micro-frontends successful. You balance technical sophistication with pragmatic decisions about when the complexity is justified.

When to Use Micro-Frontends

Decision Matrix
FactorMicro-Frontends JustifiedMonolith Preferred
Team count3+ independent teams1-2 teams
Deploy cadenceTeams need independent deploysCoordinated releases acceptable
Tech diversityDifferent frameworks per domainSingle framework across app
Codebase ageLegacy + new coexistingGreenfield or recent
Domain boundariesClear, stable domain boundariesHighly interconnected features
OrganizationConway's law alignment neededSingle product team
Anti-Patterns to Avoid
  • Splitting a single team's work into micro-frontends (adds complexity with no organizational benefit)
  • Sharing too much state between micro-frontends (indicates wrong boundary choice)
  • Using micro-frontends for code reuse (use libraries instead)
  • Letting each team pick a different framework without strong justification

Module Federation (Webpack 5 / Rspack)

Host Application Configuration
javascript
// host/webpack.config.js
const { ModuleFederationPlugin } = require('webpack').container;
module.exports = {
plugins: [
new ModuleFederationPlugin({
name: 'host',
remotes: {
catalog: 'catalog@[catalogUrl]/remoteEntry.js',
checkout: 'checkout@[checkoutUrl]/remoteEntry.js',
account: 'account@[accountUrl]/remoteEntry.js',
},
shared: {
react: { singleton: true, requiredVersion: '^18.0.0', eager: true },
'react-dom': { singleton: true, requiredVersion: '^18.0.0', eager: true },
'react-router-dom': { singleton: true, requiredVersion: '^6.0.0' },
'@company/design-system': { singleton: true, requiredVersion: '^3.0.0' },
},
}),
],
};
Remote Application Configuration
javascript
// catalog/webpack.config.js
const { ModuleFederationPlugin } = require('webpack').container;
module.exports = {
plugins: [
new ModuleFederationPlugin({
name: 'catalog',
filename: 'remoteEntry.js',
exposes: {
'./CatalogApp': './src/bootstrap',
'./ProductCard': './src/components/ProductCard',
'./SearchWidget': './src/components/SearchWidget',
},
shared: {
react: { singleton: true, requiredVersion: '^18.0.0' },
'react-dom': { singleton: true, requiredVersion: '^18.0.0' },
'react-router-dom': { singleton: true, requiredVersion: '^6.0.0' },
'@company/design-system': { singleton: true, requiredVersion: '^3.0.0' },
},
}),
],
};
Dynamic Remote Loading
typescript
// host/src/utils/loadRemote.ts
type RemoteConfig = {
url: string;
scope: string;
module: string;
};
const remoteCache = new Map<string, any>();
export async function loadRemote({ url, scope, module }: RemoteConfig): Promise<any> {
const key = `${scope}/${module}`;
if (remoteCache.has(key)) return remoteCache.get(key);
await new Promise<void>((resolve, reject) => {
const existing = document.querySelector(`script[data-remote="${scope}"]`);
if (existing) { resolve(); return; }
const script = document.createElement('script');
script.src = url;
script.dataset.remote = scope;
script.onload = () => resolve();
script.onerror = () => reject(new Error(`Failed to load remote: ${scope}`));
document.head.appendChild(script);
});
// Initialize sharing scope and get module
const container = (window as any)[scope];
await container.init(__webpack_share_scopes__.default);
const factory = await container.get(module);
const Module = factory();
remoteCache.set(key, Module);
return Module;
}
Error Boundary for Remote Components
tsx
// host/src/components/RemoteBoundary.tsx
import React, { Suspense, lazy } from 'react';
class RemoteErrorBoundary extends React.Component<
{ fallback: React.ReactNode; children: React.ReactNode },
{ hasError: boolean; error?: Error }
> {
state = { hasError: false, error: undefined };
static getDerivedStateFromError(error: Error) {
return { hasError: true, error };
}
componentDidCatch(error: Error, info: React.ErrorInfo) {
console.error('Remote component error:', error, info);
}
render() {
if (this.state.hasError) return this.props.fallback;
return this.props.children;
}
}
interface RemoteBoundaryProps {
remoteName: string;
modulePath: string;
fallback?: React.ReactNode;
errorFallback?: React.ReactNode;
}
export function RemoteBoundary({
remoteName,
modulePath,
fallback = <div>Loading...</div>,
errorFallback = <div>This section is temporarily unavailable.</div>,
}: RemoteBoundaryProps) {
const RemoteComponent = lazy(() =>
import(`${remoteName}/${modulePath}`).catch(() => ({
default: () => errorFallback as JSX.Element
}))
);
return (
<RemoteErrorBoundary fallback={errorFallback}>
<Suspense fallback={fallback}>
<RemoteComponent />
</Suspense>
</RemoteErrorBoundary>
);
}

Single-SPA Orchestration

Root Config
typescript
// root-config/src/index.ts
import { registerApplication, start, LifeCycles } from 'single-spa';
registerApplication({
name: '@company/navbar',
app: () => System.import<LifeCycles>('@company/navbar'),
activeWhen: '/',
});
registerApplication({
name: '@company/catalog',
app: () => System.import<LifeCycles>('@company/catalog'),
activeWhen: ['/products', '/categories'],
customProps: { domElement: document.getElementById('main-content') },
});
registerApplication({
name: '@company/checkout',
app: () => System.import<LifeCycles>('@company/checkout'),
activeWhen: '/checkout',
customProps: (name, location) => ({
domElement: document.getElementById('main-content'),
cartId: new URLSearchParams(location.search).get('cart'),
}),
});
registerApplication({
name: '@company/account',
app: () => System.import<LifeCycles>('@company/account'),
activeWhen: (location) => {
return location.pathname.startsWith('/account') && isAuthenticated();
},
});
start({ urlRerouteOnly: true });

Each MFE exports lifecycle hooks (bootstrap, mount, unmount) using framework adapters like single-spa-react, single-spa-vue, or single-spa-svelte.

Routing Strategies

Use route-based composition where each MFE owns a URL prefix. The host shell renders each MFE inside a <Route path="/section/*"> wrapped in an error boundary. Each MFE handles its own sub-routing internally.

Cross-MFE Navigation Events
typescript
// shared/navigation-bus.ts
export interface NavigationEvent {
type: 'navigate';
path: string;
replace?: boolean;
state?: Record<string, unknown>;
}
class NavigationBus {
#listeners = new Set<(event: NavigationEvent) => void>();
navigate(path: string, options?: { replace?: boolean; state?: Record<string, unknown> }) {
const event: NavigationEvent = { type: 'navigate', path, ...options };
this.#listeners.forEach(fn => fn(event));
}
subscribe(fn: (event: NavigationEvent) => void): () => void {
this.#listeners.add(fn);
return () => this.#listeners.delete(fn);
}
}
// Singleton on window for cross-bundle access
export const navigationBus: NavigationBus =
(window as any).__NAV_BUS__ ??= new NavigationBus();

Shared State Patterns

Event Bus for Cross-MFE Communication
typescript
// shared/event-bus.ts
type EventHandler<T = unknown> = (payload: T) => void;
class EventBus {
#handlers = new Map<string, Set<EventHandler>>();
on<T>(event: string, handler: EventHandler<T>): () => void {
if (!this.#handlers.has(event)) this.#handlers.set(event, new Set());
this.#handlers.get(event)!.add(handler as EventHandler);
return () => this.#handlers.get(event)?.delete(handler as EventHandler);
}
emit<T>(event: string, payload: T): void {
this.#handlers.get(event)?.forEach(fn => fn(payload));
}
}
export const eventBus: EventBus = (window as any).__EVENT_BUS__ ??= new EventBus();
export const Events = {
CART_UPDATED: 'cart:updated',
USER_LOGGED_IN: 'user:loggedIn',
USER_LOGGED_OUT: 'user:loggedOut',
NOTIFICATION: 'ui:notification',
} as const;
Shared Auth State

Use the same window-singleton pattern for auth state. The host shell owns authentication and exposes an AuthStore singleton with login(), logout(), subscribe() methods. Each MFE subscribes on mount and unsubscribes on unmount.

Design System and Shared Dependencies

Versioning Strategy
Shared dependency versioning rules:
1. Design system: singleton, strict major version match
2. React/framework: singleton, strict major version match
3. Router: singleton, strict major version match
4. Utility libraries (lodash, date-fns): NOT shared (each MFE bundles its own)
5. State stores: shared via window singletons (not npm dependency)

Publish design tokens (colors, spacing, typography) as an npm package. Each MFE imports the same token package to ensure visual consistency.

Build and Deploy Pipeline

Independent Deploy Pipeline (per micro-frontend)
yaml
# .github/workflows/deploy-catalog.yml
name: Deploy Catalog MFE
on:
push:
branches: [main]
paths: ['packages/catalog/**']
jobs:
build-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
working-directory: packages/catalog
run: |
npm ci
npm run build
npm run test
- name: Deploy to CDN
run: |
aws s3 sync packages/catalog/dist/ \
s3://mfe-assets/catalog/${{ github.sha }}/
aws cloudfront create-invalidation \
--distribution-id ${{ secrets.CF_DIST_ID }} \
--paths "/catalog/*"
- name: Update manifest
run: |
jq --arg url "[reference URL] github.sha }}/remoteEntry.js" \
'.catalog.url = $url' manifest.json > manifest-updated.json
aws s3 cp manifest-updated.json s3://mfe-config/manifest.json
Runtime Remote Resolution
typescript
// host/src/remoteConfig.ts
interface RemoteManifest {
[name: string]: { url: string; integrity?: string };
}
let manifest: RemoteManifest | null = null;
export async function getRemoteUrl(name: string): Promise<string> {
if (!manifest) {
const res = await get('/config/manifest.json', { cache: 'no-cache' });
manifest = await res.json();
}
const remote = manifest![name];
if (!remote) throw new Error(`Unknown remote: ${name}`);
return remote.url;
}

Testing Strategy

Test TypeScopeTool
Unit testsIndividual MFE componentsJest/Vitest + Testing Library
Integration testsMFE in isolationCypress component testing
Contract testsMFE-to-MFE interfacesPact or custom schema validation
E2E testsFull composed applicationPlaywright across all MFEs
Visual regressionDesign system consistencyChromatic / Percy

Architecture Checklist

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

Popularity

7-day trend score
5

Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/ferroxlabs/wayland/micro-frontend-architect/badge)](https://verified-skill.com/skills/ferroxlabs/wayland/micro-frontend-architect)

Something wrong with this skill or its page? Tell us.