webiny-v5-to-v6-migration
Skill này làm gì
Skill này chỉ cho AI của bạn cách chuyển mã từ kiểu plugin cũ của Webiny sang thiết kế theo feature hiện tại. Skill dành cho lập trình viên nâng cấp dự án v5 lên v6.
Khi nào nên dùng
- ✓Khi bạn đang chuyển một plugin v5 sang feature v6.
- ✓Khi một context plugin cũ cần trở thành service được inject.
- ✓Khi các event subscription v5 cần chuyển thành event handler v6.
Liên kết skill
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/api/v5-to-v6-migration/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Chuyển context plugin v5 cung cấp dịch vụ dịch thuật này thành service v6 được inject.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill đưa ra các mẫu so sánh song song giữa v5 và v6, chẳng hạn biến context plugin thành một abstraction có implementation, và biến event subscription thành event handler.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
v5 → v6 Migration Patterns
Overview
v6 replaces v5's plugin-based architecture with feature-based DI. The key shifts:
| v5 Concept | v6 Equivalent |
|---|---|
ContextPlugin |
createAbstraction + createImplementation (Service) |
| Plugin array | createFeature + container.register() |
context.myService |
DI injection via constructor |
onEntryAfterCreate.subscribe() |
EventHandler feature |
new GraphQLSchemaPlugin() |
GraphQLSchemaFactory.createImplementation() |
Pattern 1: Context Plugin → DI Service
v5
new ContextPlugin(async context => {
context.lingotekService = {
translate: async (docId, locale) => {
/* ... */
},
getStatus: async docId => {
/* ... */
},
deleteProject: async projectId => {
/* ... */
}
};
});
v6
// features/lingotekService/abstractions.ts
import { createAbstraction } from "webiny/api";
export interface ILingotekService {
translate(docId: string, locale: string): Promise<Result<void, Error>>;
getStatus(docId: string): Promise<Result<TranslationStatus, Error>>;
deleteProject(projectId: string): Promise<Result<void, Error>>;
}
export const LingotekService = createAbstraction<ILingotekService>("MyExt/LingotekService");
export namespace LingotekService {
export type Interface = ILingotekService;
}
// features/lingotekService/LingotekService.ts
class LingotekServiceImpl implements LingotekService.Interface {
constructor(private buildParams: BuildParams.Interface) {}
async translate(docId: string, locale: string) {
/* ... */
}
async getStatus(docId: string) {
/* ... */
}
async deleteProject(projectId: string) {
/* ... */
}
}
export default LingotekService.createImplementation({
implementation: LingotekServiceImpl,
dependencies: [BuildParams]
});
// features/lingotekService/feature.ts
export const LingotekServiceFeature = createFeature({
name: "LingotekService",
register(container) {
container.register(LingotekServiceImpl).inSingletonScope();
}
});
Key difference: v5 attaches to context object. v6 uses DI — consumers declare the service as a constructor dependency.
Pattern 2: Event Subscription → EventHandler Feature
v5
context.cms.onEntryAfterCreate.subscribe(async params => {
if (params.model.modelId !== "myModel") return;
await doSomething(params.entry);
});
v6
// features/syncOnCreate/EntryAfterCreateHandler.ts
import { EntryAfterCreateEventHandler } from "webiny/api/cms/entry";
import { LingotekService } from "../lingotekService/abstractions.js";
import { MY_MODEL_ID } from "~/shared/constants.js";
class SyncOnCreateHandler implements EntryAfterCreateEventHandler.Interface {
constructor(private lingotekService: LingotekService.Interface) {}
async handle(event: EntryAfterCreateEventHandler.Event) {
const { entry, model } = event.payload;
if (model.modelId !== MY_MODEL_ID) return;
await this.lingotekService.translate(entry.entryId, "en");
}
}
export default EntryAfterCreateEventHandler.createImplementation({
implementation: SyncOnCreateHandler,
dependencies: [LingotekService]
});
// features/syncOnCreate/feature.ts
export const SyncOnCreateFeature = createFeature({
name: "SyncOnCreate",
register(container) {
container.register(SyncOnCreateHandler);
}
});
Key differences:
- Feature directory is named by business capability (
syncOnCreate), not by event name - Handler is a thin orchestrator — business logic lives in the injected service
- Must filter by
model.modelId— handler fires for ALL models
Pattern 3: Plugin Array → Feature Registration
v5
export default () => [
new GraphQLSchemaPlugin({ ... }),
new ContextPlugin(async ctx => { ... }),
myModelPlugin,
eventSubscriptionPlugin
];
v6
// api/Extension.ts
import { createFeature } from "webiny/api";
export const Extension = createFeature({
name: "MyExtension",
register(container) {
container.register(MyModel);
container.register(MyGraphQLSchema);
SyncOnCreateFeature.register(container);
Câu hỏi thường gặp
Cái gì thay thế context plugin?
Một abstraction có implementation, được inject qua dependency injection.
Cái gì thay thế GraphQL schema plugin?
Một GraphQL schema factory implementation, theo bảng trong skill.
Skill này chỉ dành cho AI agent thôi sao?
Skill được viết cho AI agent khi làm việc chuyển đổi, nhưng con người cũng có thể làm theo cùng các mẫu này.
Chi tiết
Mô tả gốc của tác giả
Migration patterns for converting v5 Webiny code to v6 architecture. Use this skill when migrating existing v5 plugins to v6 features, converting context plugins to DI services, adapting v5 event subscriptions to v6 EventHandlers, or understanding how v5 patterns translate to v6. Targeted at AI agents performing migrations.
repo: webiny/webiny-js
Độ phổ biến
- Sao GitHub
- 8.1k
- Vị trí xếp hạng
- #12591
- Giấy phép
- —
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
prd-to-plan
8.1kGiúp agent của bạn biến tài liệu yêu cầu sản phẩm thành kế hoạch theo giai đoạn gồm các lát cắt đầu-cuối nhỏ, lưu thành file Markdown.
webiny-admin-architect
8.1kDạy agent của bạn cách xây dựng màn hình quản trị cho nền tảng Webiny, dùng các tầng logic nghiệp vụ và mẫu presenter.
webiny-admin-permissions
8.1kDạy agent của bạn thêm kiểm soát quyền vào màn hình quản trị Webiny, gồm form quyền tự sinh và kiểm tra ẩn hoặc hiện.
webiny-form-model
8.1kDạy agent của bạn xây dựng form trong Webiny bằng trình tạo trường khai báo, bố cục, kiểm tra hợp lệ và quy tắc có điều kiện.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.