AI编码代理的微前端边界治理技能
概览
AI代码助手的微前端架构治理。 两项技能能让你的代码助手深入了解微前端边界设计,分别是《构建微前端(O'Reilly)》中的八条边界规则、违规检测和修复模式。涵盖模块联邦v1/v2、原生联邦(Angular)和单一SPA。 - 在采用决策、边界设计和组合模式时激活(与Canvas辅助的独立技能配合)- 在代码审查、shell生成、违规检测和跨MFE通信时激活 AI助手擅长快速搭建模块联盟的支架。没有治理,它们往往能很好地编译和演示,但随着时间推移会削弱团队自主权。 我们做了一个对照实验:两个代理,任务相同(React 19,模块联合,电子商务壳+主页+目录MFE)。一个构建了这些技能;一个构建 AGENTS.md 并审查MFE边界。
概述(AI 翻译)
AI代码助手的微前端架构治理。
两项技能能让你的代码助手深入掌握微前端边界设计,分别是构建微前端(O’Reilly)中的八条边界规则、违规检测和修复模式。涵盖模块联邦v1/v2、原生联邦(Angular)和单一SPA。
包含技能:
- 理解-MFE-架构在采纳决策、边界设计和组合模式时激活(与单独的微前端-画布技能配合,用于Canvas促进)
- 审查MFE边界在代码审查、壳生成、违规检测和跨MFE通信时激活
为什么要用这些技能?
AI助手擅长快速搭建模块联合的脚手架。没有治理,它们常常生成教程式的微前端,虽然编译和演示表现良好,但随着时间推移会削弱团队自主权。
我们进行了对照实验:两位代理,任务相同(React 19、模块联合、电子商务shell + home + catalog MFE)。一个构建时没有这些技能;一个构建时包含了AGENTS.md和reviewing-mfe-boundaries。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
MFE Skills
Micro-frontend architecture governance for AI code assistants.
Two skills that give your code assistant deep knowledge of micro-frontend boundary design, the eight boundary rules from Building Micro-Frontends (O’Reilly), violation detection, and remediation patterns. Covers Module Federation v1/v2, Native Federation (Angular), and Single SPA.
Skills included:
- understanding-mfe-architecture activates on adoption decisions, boundary design, and composition patterns (pairs with the separate micro-frontend-canvas skill for Canvas facilitation)
- reviewing-mfe-boundaries activates on code review, shell generation, violation detection, and cross-MFE communication
Why use these skills?
AI assistants are good at scaffolding Module Federation quickly. Without governance, they often produce tutorial-style micro-frontends that compile and demo well but erode team autonomy over time.
We ran a controlled experiment: two agents, same brief (React 19, Module Federation, ecommerce shell + home + catalog MFEs). One built without these skills; one built with AGENTS.md and reviewing-mfe-boundaries.
Reference implementation (with skills): lucamezzalira/mfe-with-skills — ThreadTales (Module Federation 2.0, runtime discovery, vendored skills + AGENTS.md).
| Branch | Purpose |
|---|---|
main |
Starting point: AGENTS.md, docs/SPEC.md, skills — no app code |
ecommerce-init-implementation |
Runnable app — AppShell + five remotes, discovery service (pnpm install / pnpm start) |
Use ecommerce-init-implementation for Start Here and code review; use main to bootstrap a new project from spec only.
Before vs after (experiment)
| Area | Without skills | With skills |
|---|---|---|
| Cross-MFE imports | Shell imports catalogMfe/productUtils |
No imports across remotes; each MFE exposes only its app entry |
| Mount contract | shellUser, cart, formatPrice, onNavigate |
userId + platformBus (chrome only) |
| Shared state | window.__SHOP_CART__ global singleton |
No shared store; URL + platform events |
| Routing | Shell knows home + catalog pages | Shell loads first URL segment only (manifest/discovery); MFE owns deeper paths like /catalog/product/:id |
| Adding a route/MFE | Edit shell App.tsx |
Add entry in manifest/discovery config (no shell domain-page code changes) |
| Remote URLs | Hard-coded in webpack config | Runtime discovery (remotes.json or frontend-discovery.json) |
| Failure handling | Suspense only |
Shell ErrorBoundary + fallback per remote |
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add lucamezzalira/mfe-skills