webiny-admin-architect
它能做什么
这项技能在你的 AI 为 Webiny 管理界面开发功能时提供指导。适合为 Webiny 平台编写扩展的开发者。
适用场景
- ✓当你要在 Webiny 管理面板中构建包含业务逻辑和界面的功能的时候。
- ✓当你需要把管理端代码组织为功能、呈现器和组件的时候。
- ✓当你为 Webiny 扩展注册功能或设置管理端构建参数的时候。
技能链接
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/admin-architect/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请在 Webiny 中构建一个列出订单的新管理页面,遵循平台的功能与呈现器模式。”
每周 5 个新技能,1 分钟读完。
工作原理
技能讲解分层结构。业务逻辑位于无界面的 headless 功能中,界面则使用呈现器和 hooks,每个功能都提供 resolve 函数,供界面调用。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Admin Architecture Patterns
TL;DR
Admin extensions are React components that register headless features (business logic with no UI) and presentation features (MobX presenters, React hooks, components). Headless features live in admin/features/ and follow UseCase → Repository → Gateway layering. Presentation features live in admin/presentation/ and add a Presenter (MobX view model) layer on top. Both use createFeature and createAbstraction from webiny/admin.
All features — both headless and presentation — MUST provide a resolve function in createFeature. This is how the useFeature hook accesses resolved instances from the DI container. Without resolve, the feature cannot be consumed from React.
Working Context
This skill applies to both extension developers (working in extensions/) and core developers (working in packages/). The architecture patterns are identical — only imports differ.
Extensions (extensions/) |
Core (packages/) |
|
|---|---|---|
| Imports | webiny/admin, webiny/admin/ui, webiny/admin/cms/entry/editor |
@webiny/app, @webiny/admin-ui, @webiny/app-headless-cms/... |
| Catalog paths | Use the Import: path |
Use the Source: path |
| MobX wrapper | createReactiveComponent from webiny/admin |
createReactiveComponent from @webiny/app-admin (never import observer from mobx-react-lite directly — the only exception is @webiny/app-admin itself, which is the source of the re-export) |
| Entry point | React component as export default in a file targeted by <Admin.Extension src={...}> |
React component registered by the package initializer |
Detect which context you're in by checking the file path: extensions/ → extension mode, packages/ → core mode.
Admin Directory Structure
admin/
├── Extension.tsx # Admin entry point (React component)
├── features/ # Headless features (business logic, no UI)
│ └── EnableThing/
│ ├── abstractions.ts
│ ├── EnableThingUseCase.ts
│ ├── EnableThingRepository.ts
│ ├── EnableThingGateway.ts
│ └── feature.ts
└── presentation/ # Presentation layer (hooks, components, presenters)
└── CurrentThing/
├── abstractions.ts # Presenter + ViewModel interfaces
├── CurrentThingPresenter.ts # MobX-based view model
├── useCurrentThing.ts # React hook for consumers
├── feature.ts # createFeature registration
└── components/ # React UI components
Admin Extension Entry Point
The Admin entry point is a React component that registers features, providers, UI decorators, and config:
// src/admin/Extension.tsx
import React from "react";
import { AdminConfig, RegisterFeature } from "webiny/admin";
import { CurrentThingFeature } from "./presentation/CurrentThing/feature.js";
import { EnableThingFeature } from "./features/EnableThing/index.js";
import { CurrentThingProvider } from "./presentation/CurrentThing/CurrentThingProvider.js";
import { ThingListView } from "./presentation/ThingListView/ThingListView.js";
export const Extension = () => {
return (
<>
{/* Register headless features (use cases, repositories, gateways) */}
<RegisterFeature feature={EnableThingFeature} />
常见问题
每个功能都需要 resolve 函数吗?
需要。技能说明,所有功能都必须提供它,以便界面访问它们。
headless 功能与展示功能有何区别?
headless 功能只承载业务逻辑而无界面,展示功能则增加呈现器、hooks 和组件。
这也适用于外部扩展吗?
适用。扩展开发者与核心开发者使用的模式相同,只是导入路径不同。
详情
作者的原始描述
Admin-side architecture patterns for Webiny extensions. Use this skill when building frontend features with headless features (UseCase/Repository/Gateway), presentation features (Presenter/ViewModel/hooks/components), MobX-based presenters, RegisterFeature, and Admin BuildParams. Covers the admin/ directory structure for both features/ and presentation/ layers.
repo: webiny/webiny-js
热度
- GitHub 星标
- 8.1k
- 排名
- #12574
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
prd-to-plan
8.1k帮你的智能体把产品需求文档转化为分阶段的计划,由许多小的端到端切片组成,并保存为 Markdown 文件。
webiny-admin-permissions
8.1k教你的智能体为 Webiny 管理界面添加权限控制,包括自动生成的权限表单以及显示或隐藏检查。
webiny-form-model
8.1k教你的智能体使用声明式字段构建器、布局、校验和条件规则,在 Webiny 中构建表单。
webiny-new-entry-wizard
8.1k教你的智能体为 Webiny CMS 的新条目添加自定义设置向导,先收集几个字段,再预填条目表单。