microfrontend-patterns-advanced
Advanced Micro-Frontend patterns — testing strategy (unit per-remote, integration with mocked remotes, E2E full composition via Playwright), CI/CD independent deployments per remote, ErrorBoundary resilience, and monolith-to-MFE strangler-fig migration.
Best use case
microfrontend-patterns-advanced is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Advanced Micro-Frontend patterns — testing strategy (unit per-remote, integration with mocked remotes, E2E full composition via Playwright), CI/CD independent deployments per remote, ErrorBoundary resilience, and monolith-to-MFE strangler-fig migration.
Teams using microfrontend-patterns-advanced should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/microfrontend-patterns-advanced/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How microfrontend-patterns-advanced Compares
| Feature / Agent | microfrontend-patterns-advanced | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Advanced Micro-Frontend patterns — testing strategy (unit per-remote, integration with mocked remotes, E2E full composition via Playwright), CI/CD independent deployments per remote, ErrorBoundary resilience, and monolith-to-MFE strangler-fig migration.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Micro-Frontend Patterns — Advanced
This skill extends `microfrontend-patterns` with testing, CI/CD, resilience, and migration. Load `microfrontend-patterns` first.
## When to Activate
- Writing tests for Module Federation remotes or the shell
- Setting up independent CI/CD pipelines per remote
- Adding ErrorBoundary resilience so one failing remote doesn't crash the shell
- Planning a strangler-fig migration from a React/Vue/Angular monolith to MFE
---
## Testing Strategy
### Unit Tests: Per-Remote (No Shell Required)
```typescript
// Test remotes in isolation — mock federation context
// checkout/src/__tests__/CartView.test.tsx
import { render, screen } from "@testing-library/react";
import CartView from "../CartView";
test("displays empty cart message", () => {
render(<CartView items={[]} />);
expect(screen.getByText("Your cart is empty")).toBeInTheDocument();
});
```
### Integration Tests: Shell + Mock Remotes
```typescript
// test/integration/shell.test.tsx
// Mock the federation remotes
jest.mock("checkout/CheckoutApp", () => ({
default: () => <div data-testid="checkout-mock">Checkout</div>,
}));
test("shell renders checkout route", async () => {
render(<App />, { route: "/checkout" });
await screen.findByTestId("checkout-mock");
});
```
### E2E Tests: Full Composition
```typescript
// playwright.config.ts — start all remotes before tests
import { defineConfig } from "@playwright/test";
export default defineConfig({
webServer: [
{ command: "npm run start --prefix shell", port: 3000 },
{ command: "npm run start --prefix checkout", port: 3001 },
{ command: "npm run start --prefix catalog", port: 3002 },
],
use: { baseURL: "http://localhost:3000" },
});
```
---
## CI/CD: Independent Deployments
Each Remote has its own pipeline. The Shell only re-deploys when the shell code itself changes.
```yaml
# .github/workflows/checkout.yml
name: Checkout Remote
on:
push:
paths:
- "remotes/checkout/**"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm run build # produces remoteEntry.js
- run: npm run test
# Deploy remoteEntry.js to CDN
- uses: aws-actions/s3-deploy@v1
with:
source: dist/
bucket: checkout-remote-prod
# Shell fetches this URL — no shell redeployment needed
```
---
## Error Handling & Resilience
```typescript
// ErrorBoundary for each Remote — one Remote failing doesn't crash the shell
class RemoteErrorBoundary extends Component<
{ fallback: ReactNode; children: ReactNode },
{ hasError: boolean }
> {
constructor(props) {
super(props);
this.state = { hasError: false };
}
static getDerivedStateFromError() {
return { hasError: true };
}
componentDidCatch(error: Error) {
// Log to monitoring — Remote loading failure is a high-priority alert
reportError(error, { context: "remote-load-failure" });
}
render() {
if (this.state.hasError) return this.props.fallback;
return this.props.children;
}
}
```
---
## Migration: Monolith → MFE
1. **Identify boundaries** — map UI areas to team ownership
2. **Extract Design System first** — shared components must be stable before splitting apps
3. **Add Module Federation to the monolith** — expose new modules without breaking existing code
4. **Strangler-fig migration** — route new paths to Remote, old paths stay in monolith
5. **Extract one domain at a time** — validate in production before extracting the next
```
Phase 1: /checkout → extracted as Remote
Phase 2: /catalog → extracted as Remote
Phase 3: remaining monolith shell (homepage, navigation)
```
## Reference
- `microfrontend-patterns` — Module Federation setup, shared state, design system, CSS isolation
- `typescript-monorepo-patterns` — managing multi-package repos
- `e2e-testing` — Playwright E2E for full MFE composition testing
- `legacy-modernization` — Strangler Fig and Branch-by-Abstraction migration patternsRelated Skills
zero-trust-patterns
Zero-Trust security patterns — mTLS between microservices (Istio/SPIFFE), SPIRE workload identity, OPA/Envoy authorization, NetworkPolicy default-deny-all, short-lived credentials, service mesh security, and Kubernetes RBAC hardening.
webrtc-patterns
WebRTC patterns — peer connection setup, ICE/STUN/TURN configuration, signaling server design, SFU vs mesh topology, screen sharing, media track management, and reconnect/ICE restart handling.
webhook-patterns
Webhook patterns for receiving, verifying (HMAC), and idempotently processing third-party events. Covers Stripe, GitHub, and generic webhook patterns, delivery guarantees, retry handling, and testing.
wasm-patterns
WebAssembly patterns: wasm-pack, wasm-bindgen (JS↔Wasm interop), WASI, Component Model, wasm-opt, Rust-to-WASM compilation, JS integration (web workers, streaming instantiation), and production deployment (CDN, Content-Type headers).
ux-micro-patterns
UX micro-patterns for every product state: Empty States, Loading States (skeleton screens, spinners, optimistic UI), Error States, Success States, Confirmation Dialogs, Onboarding Flows, and Progressive Disclosure. These patterns apply to every feature — done wrong, they're the biggest source of user confusion.
typescript-patterns
TypeScript patterns — type system best practices, strict mode, utility types, generics, discriminated unions, error handling with Result types, and module organization. Core patterns for production TypeScript.
typescript-patterns-advanced
Advanced TypeScript — mapped types, template literal types, conditional types, infer, type guards, decorators, async patterns, testing with Vitest/Jest, and performance. Extends typescript-patterns.
typescript-monorepo-patterns
TypeScript monorepo patterns with Turborepo + pnpm workspaces. Covers package structure, shared configs, task pipeline caching, build orchestration, and publishing strategy.
terraform-patterns
Infrastructure as Code with Terraform — project structure, remote state, modules, workspace strategy, AWS/GCP patterns, CI/CD integration, and security hardening. The standard for managing production infrastructure.
tdd-workflow-advanced
TDD anti-patterns — writing code before tests, testing implementation details instead of behavior, using waitForTimeout as a sync strategy, chaining tests that share state, mocking the system under test instead of its dependencies.
swiftui-patterns
SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.
swift-patterns
Core Swift patterns — value vs reference types, protocols, generics, optionals, Result, error handling, Codable, and module organization. Foundation for all Swift development.