Logo Architecture Micro Frontends

Architecture Micro Frontends

Cộng đồng
j4flmao
architecture-micro-frontends

Use this skill when the user says 'micro-frontends', 'MFE', 'Module Federation', 'split the frontend monolith', 'independent frontend deploys', 'single-spa', 'import maps', 'app shell with remotes'. Decides whether micro-frontends are justified and designs the split, composition technique (build-time, Module Federation, Web Components, server/edge composition, iframes), shared dependencies, routing, communication, and styling isolation. Do NOT use for: component library/design system work (frontend/universal/design-system), framework-specific architecture (frontend/<framework>), or bundler tuning unrelated to federation (frontend/universal/bundler-tools).

Tổng quan

Nhà phát hànhj4flmao
Kho mãagent-skills
Tên kỹ năngarchitecture-micro-frontends
Sao
41
Bản fork
6
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được j4flmao công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Architecture Micro Frontends trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/j4flmao/agent-skills/tree/main/skills/architecture/micro-frontends
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/j4flmao/agent-skills.git /tmp/agent-skills
mkdir -p .claude/skills
cp -r /tmp/agent-skills/skills/architecture/micro-frontends .claude/skills/architecture-micro-frontends
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Architecture Micro Frontends trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Architecture Micro Frontends ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Architecture Micro Frontends với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Micro-Frontends

Purpose

Micro-frontends let independent teams build, test, and deploy parts of one web UI separately. They solve an organizational scaling problem (many teams blocking each other on one release), not a technical performance problem, and they add runtime complexity, duplication risk, and consistency work. Use them when team autonomy is the bottleneck; otherwise a well-structured modular monolith is cheaper.

Agent Protocol

Trigger

"micro-frontends", "MFE", "Module Federation", "remoteEntry", "single-spa", "import maps", "app shell", "independent UI deployments".

Input Context

  • Number of teams and how they map to product areas.
  • Current frontend stack(s), build tooling (webpack, Rspack, Vite), deployment pipeline.
  • Pain points: release coordination, build times, ownership conflicts.
  • SEO/SSR requirements and performance budgets.

Output Artifact

Go/no-go decision, domain split, composition approach, shared-dependency policy, contracts (routes, events), and governance rules.

Response Format

Decision: {MFE|modular monolith} because {reason}
Split: {MFE: owning team, routes}
Composition: {build-time|module federation|web components|server/edge|iframe}
Shared: {react@x singleton, design-system@y} policy={versions}
Comms: {URL/state params|CustomEvent|shared minimal store}
Styling isolation: {CSS Modules|Shadow DOM|prefix}
Perf budget: {JS KB per route}

Completion Criteria

  • MFEs split by business domain/route, not by technical layer.
  • One framework major version enforced for shared singletons.
  • Contracts between host and remotes versioned and tested.
  • Remote failures degrade gracefully (error boundary/fallback).
  • Performance budget measured per route.

Should You?

SignalPoints to
1-3 teams, one product areaModular monolith (monorepo packages, enforced boundaries)
Many teams blocked on one release trainMicro-frontends
Need to embed legacy app during migrationMFE (strangler pattern)
Mixed frameworks as a goal in itselfRed flag: cost without benefit

Composition Techniques

TechniqueWhen composedProsCons
Build-time packages (npm)BuildSimple, type-safeNot independently deployable (host must rebuild)
Module Federation (webpack 5, Rspack, @module-federation/* incl. Vite plugin)Runtime (JS)Independent deploys, shared singletonsTooling coupling, version skew at runtime
single-spa / import mapsRuntimeFramework-agnostic lifecycleMore glue code
Web ComponentsRuntime (DOM)Framework-agnostic, Shadow DOM isolationPassing rich data/callbacks is clunky; SSR limited
Server/edge composition (SSI/ESI, fragments)RequestGood for SEO and first paintInfra complexity, interactivity wiring
iframesRuntimeStrong isolationPoor UX for layout, routing, overlays, a11y

Module Federation Example (webpack 5)

js
// checkout/webpack.config.js  (remote)
const { ModuleFederationPlugin } = require("webpack").container;
const deps = require("./package.json").dependencies;

module.exports = {
  output: { publicPath: "auto", uniqueName: "checkout" },
  plugins: [
    new ModuleFederationPlugin({
      name: "checkout",
      filename: "remoteEntry.js",
      exposes: { "./CheckoutPage": "./src/CheckoutPage" },
      shared: {
        react: { singleton: true, requiredVersion: deps.react },
        "react-dom": { singleton: true, requiredVersion: deps["react-dom"] },
      },
    }),
  ],
};
js
// shell/webpack.config.js  (host)
new ModuleFederationPlugin({
  name: "shell",
  remotes: { checkout: "checkout@https://cdn.example.com/checkout/remoteEntry.js" },
  shared: { react: { singleton: true, requiredVersion: deps.react },
            "react-dom": { singleton: true, requiredVersion: deps["react-dom"] } },
});
tsx
// shell/src/routes.tsx
import { lazy, Suspense } from "react";
import { ErrorBoundary } from "react-error-boundary";

const CheckoutPage = lazy(() => import("checkout/CheckoutPage"));

export function CheckoutRoute() {
  return (
    <ErrorBoundary fallback={<p>Checkout is temporarily unavailable.</p>}>
      <Suspense fallback={<p>Loading checkout…</p>}>
        <CheckoutPage />
      </Suspense>
    </ErrorBoundary>
  );
}

For dynamic remote URLs per environment, load a manifest at runtime (Module Federation 2 runtime APIs or your own config endpoint) instead of hardcoding CDN paths.

Contracts and Communication

  • Routing: the shell owns top-level routes; each MFE owns its sub-routes.
  • Data: pass via URL/route params and props at the mount point; share auth/session via the shell, not via each MFE's own login.
  • Events: window.dispatchEvent(new CustomEvent("cart:item-added", { detail: { sku, qty } })) with a documented, versioned event catalog.
  • Shared state: keep it minimal (user, locale, feature flags), exposed through a small typed API from the shell; never a shared global Redux store whose shape other teams depend on.

Styling and Design Consistency

  • Scope styles: CSS Modules, CSS-in-JS with unique prefixes, or Shadow DOM for Web Components.
  • Share a design system as a versioned package (tokens + components); it is the main lever for consistent UX.
  • Avoid global resets inside remotes.

Performance

  • Share framework singletons; audit bundles per route for duplicated libraries.
  • Preload remoteEntry for likely-next routes; lazy-load the rest.
  • Set a JS budget per route and enforce it in CI.

Governance

  • Compatibility rules: host and remotes agree on React/Vue major version and design-system major version; upgrades are coordinated platform work.
  • Contract tests: shell smoke tests against each remote's deployed remoteEntry before promotion.
  • Independent rollback per remote (versioned remote URLs).

Anti-Patterns

  • Splitting by technical layer (header team, button team).
  • Multiple framework majors loaded on one page.
  • Shared mutable global store across teams.
  • Remote failure crashes the whole shell (no error boundary).
  • MFEs for a single team "for the future".

Checklist

  • Organizational justification recorded.
  • Domain-aligned split with route ownership.
  • Composition technique chosen per SEO/SSR needs.
  • Shared singleton and version policy enforced.
  • Event/prop contracts versioned and tested.
  • Style isolation + shared design system.
  • Per-route performance budget and fallback UI.

References

  • Geers, "Micro Frontends in Action" (Manning, 2020); martinfowler.com, "Micro Frontends" (Cam Jackson, 2019).
  • webpack Module Federation docs; module-federation.io (Module Federation 2, Rspack/Vite plugins); single-spa docs.

Câu hỏi thường gặp

Kỹ năng AI Architecture Micro Frontends làm được gì?

Use this skill when the user says 'micro-frontends', 'MFE', 'Module Federation', 'split the frontend monolith', 'independent frontend deploys', 'single-spa', 'import maps', 'app shell with remotes'. Decides whether micro-frontends are justified and designs the split, composition technique (build-time, Module Federation, Web Components, server/edge composition, iframes), shared dependencies, routing, communication, and styling isolation. Do NOT use for: component library/design system work (frontend/universal/design-system), framework-specific architecture (frontend/<framework>), or bundler...

Vì sao nên dùng Architecture Micro Frontends trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Architecture Micro Frontends là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Architecture Micro Frontends trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/j4flmao/agent-skills/tree/main/skills/architecture/micro-frontends. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Architecture Micro Frontends?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Architecture Micro Frontends với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Architecture Micro Frontends với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Architecture Micro Frontends có miễn phí không?

Có. Kỹ năng này được j4flmao phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇