webiny-cli-extensions
Skill này làm gì
Skill này giúp AI của bạn xây dựng lệnh mới cho công cụ dòng lệnh Webiny. Skill dành cho lập trình viên muốn script riêng chạy qua CLI của dự án.
Khi nào nên dùng
- ✓Khi bạn cần một lệnh tùy chỉnh cho việc migration dữ liệu hoặc xuất nội dung.
- ✓Khi bạn cần bộ sinh code hoặc công cụ hỗ trợ triển khai bên trong Webiny CLI.
- ✓Khi bạn muốn một lệnh kiểm tra sức khỏe in kết quả rõ ràng ra terminal.
Liên kết skill
https://github.com/webiny/webiny-js/blob/next/skills/user-skills/cli-extensions/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
“Thêm một lệnh Webiny CLI xuất toàn bộ mục blog ra một file JSON.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Skill giải thích một lớp lệnh có tên, mô tả, tham số có kiểu và một handler. Handler in thông báo qua một công cụ hỗ trợ terminal, và lệnh được đăng ký trong file cấu hình.
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.
CLI Extensions
TL;DR
Add custom commands to the Webiny CLI using the CliCommandFactory pattern. Define a class implementing CliCommandFactory.Interface<TParams>, specify command name, description, params, and handler, then export with CliCommandFactory.createImplementation(). Register in webiny.config.tsx via <Cli.Command>.
The CliCommandFactory Pattern
// extensions/MyCustomCommand.ts
import { Ui } from "webiny/cli";
import { CliCommandFactory } from "webiny/cli/command";
export interface IMyCustomCommandParams {
name: string;
}
class MyCustomCommandImpl implements CliCommandFactory.Interface<IMyCustomCommandParams> {
constructor(private ui: Ui.Interface) {}
execute(): CliCommandFactory.CommandDefinition<IMyCustomCommandParams> {
return {
name: "my-custom-command",
description: "This is my custom command",
examples: ["$0 my-custom-command test1", "$0 my-custom-command test2"],
params: [
{
name: "name",
description: "Your name",
type: "string"
}
],
handler: async params => {
this.ui.info("Starting my custom command...");
this.ui.emptyLine();
this.ui.success(`Hello, ${params.name}! This is my custom command.`);
}
};
}
}
export default CliCommandFactory.createImplementation({
implementation: MyCustomCommandImpl,
dependencies: [Ui]
});
Register in webiny.config.tsx (YOU MUST include the .ts file extension in the src prop — omitting it will cause a build failure):
<Cli.Command src={"/extensions/MyCustomCommand.ts"} />
Run it:
yarn webiny my-custom-command "World"
Command Definition Properties
| Property | Type | Description |
|---|---|---|
name |
string |
The command name used on the CLI (e.g., "my-custom-command") |
description |
string |
Help text shown when listing commands |
examples |
string[] |
Usage examples ($0 is replaced with the CLI binary name) |
params |
ParamDefinition[] |
Positional parameters and options |
handler |
(params: TParams) => Promise<void> |
The function that executes the command |
Parameter Definition
Each param in the params array:
| Property | Type | Description |
|---|---|---|
name |
string |
Parameter name (matches the key in your TParams interface) |
description |
string |
Help text for this parameter |
type |
"string" | "number" | "boolean" |
Parameter value type |
The Ui Service
Inject Ui for formatted terminal output:
import { Ui } from "webiny/cli";
| Method | Description |
|---|---|
this.ui.info("message") |
Print an info message (blue) |
this.ui.success("message") |
Print a success message (green) |
this.ui.warning("message") |
Print a warning message (yellow) |
this.ui.error("message") |
Print an error message (red) |
this.ui.emptyLine() |
Print a blank line for spacing |
Use Cases
- Data migrations -- Scripts to migrate or seed CMS data
- Code generators -- Generate boilerplate extension files
- Deployment scripts -- Custom deployment workflows
- Data exports -- Export CMS content to files
- Health checks -- Verify infrastructure or API status
Quick Reference
Import: import { CliCommandFactory } from "webiny/cli/command";
Ui import: import { Ui } from "webiny/cli";
Interface: CliCommandFactory.Interface<TParams>
Definition: CliCommandFactory.CommandDefinition<TParams>
Export: CliCommandFactory.createImplementation({ implementation, dependencies })
Registe
Câu hỏi thường gặp
Lệnh được đăng ký như thế nào?
Bằng một cài đặt command trong file cấu hình webiny.
Tham số được định nghĩa ra sao?
Mỗi tham số có tên, mô tả và kiểu.
Lệnh hiển thị kết quả như thế nào?
Qua một công cụ hỗ trợ terminal, dùng để in thông tin, thông báo thành công và dòng trống.
Chi tiết
Mô tả gốc của tác giả
Adding custom commands to the Webiny CLI using CliCommandFactory. Use this skill when the developer wants to create a custom CLI command, add a data migration script, build a code generator, create deployment scripts, export CMS content, or add health check commands. Covers CliCommandFactory.Interface, command definition, typed parameters, the Ui service for terminal output, and registration via <Cli.Command>.
repo: webiny/webiny-js
Độ phổ biến
- Sao GitHub
- 8.1k
- Vị trí xếp hạng
- #12593
- 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á.