webiny-new-entry-wizard
它能做什么
这项技能在你的 AI 构建一个显示在 Webiny 无头 CMS 条目编辑器之前的向导时提供指导。适合希望新条目在一开始就已填好几个字段的开发者。
适用场景
- ✓当你希望在创建新的 CMS 条目之前出现一个简短表单,例如用于标题或 slug 的时候。
- ✓当你需要特定内容模型在创建时显示自定义向导的时候。
- ✓当你希望根据向导的回答预填条目表单的时候。
技能链接
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/admin/new-entry-wizard/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请为我们的博客内容模型添加一个向导,在条目打开之前询问标题、slug 和分类。”
每周 5 个新技能,1 分钟读完。
工作原理
技能会设置一个向导扩展,包括共享接口、功能、拥有表单的呈现器、视图和注册步骤。向导的回答会传给条目表单,表单打开时会显示为有未保存的更改。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
New Entry Wizard
TL;DR
A New Entry Wizard intercepts the "create new entry" flow in the Headless CMS and shows a custom form before the full entry editor. The wizard collects initial values (title, slug, category, etc.), then calls formPresenter.newEntry(initialValues) to pre-fill the entry form and transition to the editor. The form is automatically marked as dirty so the user sees unsaved changes.
A wizard extension has five files:
abstractions.ts-- DI token and presenter interface (ALWAYS a standalone file)feature.ts--createFeaturewiring (ALWAYS a standalone file)- Presenter -- owns the wizard form (fields, layout, validation) via
FormModelFactory - View -- renders the wizard UI using
FormViewandFormErrors - Registration -- plugs the wizard into specific content models via
ContentEntryEditorConfig.NewEntryWizard
Registration
// extensions/myWizard/index.tsx
import React from "react";
import { RegisterFeature } from "webiny/admin";
import { ContentEntryEditorConfig } from "webiny/admin/cms/entry/editor";
import { MyWizardFeature } from "./feature.js";
import { MyWizardForm } from "./MyWizardForm.js";
const MyWizardExtension = () => {
return (
<>
<RegisterFeature feature={MyWizardFeature} />
<ContentEntryEditorConfig>
<ContentEntryEditorConfig.NewEntryWizard
element={<MyWizardForm />}
modelIds={["article", "blogPost"]}
/>
</ContentEntryEditorConfig>
</>
);
};
export default MyWizardExtension;
Props
| Prop | Type | Description |
|---|---|---|
element |
React.ReactElement |
The wizard component to render |
modelIds |
string[] |
Content model IDs this wizard applies to. Omit or pass [] to apply to all models. |
Enabling the extension
// webiny.config.tsx
<Admin.Extension src={"@/extensions/myWizard/index.tsx"} />
Abstractions
Abstractions MUST live in a dedicated abstractions.ts file. This file defines the DI token for the presenter. It is imported by both the feature and the view.
// extensions/myWizard/abstractions.ts
import { createAbstraction } from "webiny/admin";
import type { FormModel } from "webiny/admin/form";
export interface MyWizardVM {
form: FormModel.FormVM;
data: Record<string, unknown>;
}
export interface IMyWizardPresenter {
vm: MyWizardVM;
submit(): Promise<Record<string, unknown> | false>;
reset(): void;
}
export const MyWizardPresenter = createAbstraction<IMyWizardPresenter>("MyWizardPresenter");
Feature
The feature MUST live in a dedicated feature.ts file. It wires the presenter implementation to the abstraction and defines how the feature is resolved from the DI container.
// extensions/myWizard/feature.ts
import { createFeature, FormModelFactory } from "webiny/admin";
import { MyWizardPresenter } from "./abstractions.js";
import { MyWizardPresenterImpl } from "./MyWizardPresenter.js";
export const MyWizardFeature = createFeature({
name: "MyWizard",
register(container) {
container.register(
MyWizardPresenter.createImplementation({
implementation: MyWizardPresenterImpl,
dependencies: [FormModelFactory]
})
);
},
resolve(container) {
return { presenter: container.resolve(MyWizardPresenter) };
}
});
Presenter
The presenter owns a FormModel for the wizard's own fields. It is a plain class -- the DI token lives in abstractions.ts and the feature wiring lives in feature.ts.
// extensions/myWizard/MyWizardPresenter.ts
import type { FormModel } from "webiny/admin/form";
import { makeAutoObservable, toJS } from "mobx";
import { FormModelFactory } from "webiny/admin";
import type { IMyWizardPresenter, MyWizardVM } from "./abstractions.js";
export class MyWizardPresenterImpl implements IMyWizardPresenter {
private form: FormModel.Interface;
constructor(formFactory: FormModelFactory.Interface) {
this.form = formFactory.create({
fields: fields => ({
title: fields.text().label("Title").required("Title is required"),
slug: fields.text().label("Slug").required("Slug is required"),
category: f
常见问题
向导会替我保存条目吗?
不会。向导只填充条目表单,之后由用户看到未保存的更改并自行保存。
向导如何绑定到内容模型?
它通过条目编辑器配置,为特定内容模型注册。
一个向导需要哪些文件?
技能列出五个部分:抽象定义、功能、呈现器、视图和注册。
详情
作者的原始描述
Building a New Entry Wizard for the Headless CMS. Use this skill when the developer wants to show a custom wizard UI before the entry form when creating new CMS entries -- collecting fields like title, slug, or category upfront, then pre-filling the entry form. Covers ContentEntryEditorConfig.NewEntryWizard, createFeature, FormModelFactory, createReactiveComponent, useContentEntryFormPresenter, and the dirty-flag on setData.
repo: webiny/webiny-js
热度
- GitHub 星标
- 8.1k
- 排名
- #12577
- 许可证
- —
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
prd-to-plan
8.1k帮你的智能体把产品需求文档转化为分阶段的计划,由许多小的端到端切片组成,并保存为 Markdown 文件。
webiny-admin-architect
8.1k教你的智能体如何为 Webiny 平台构建管理界面,使用其业务逻辑层和呈现器模式。
webiny-admin-permissions
8.1k教你的智能体为 Webiny 管理界面添加权限控制,包括自动生成的权限表单以及显示或隐藏检查。
webiny-form-model
8.1k教你的智能体使用声明式字段构建器、布局、校验和条件规则,在 Webiny 中构建表单。