一键导入
create-domain
Creates a complete domain structure for Ybyra — schema, events, handlers, and hooks — from a natural language description of the entity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Creates a complete domain structure for Ybyra — schema, events, handlers, and hooks — from a natural language description of the entity.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Adds a custom action to a Ybyra schema with handler, positioning, variant, and scope configuration.
Adds a new field to an existing Ybyra schema with proper type, configuration, i18n keys, and event wiring.
Generate or update internationalization (i18n) locale files for an Ybyra domain. Use when the user asks to add translations, create locale files, or update labels for a domain's fields, groups, and actions.
Creates all CRUD pages (list, add, view, edit) with routing for a Ybyra domain in any supported framework — React Web, React Native, Vue/Quasar, or SvelteKit.
Creates a service layer with persistence for a Ybyra domain, implementing ServiceContract with optional custom methods.
| name | create-domain |
| description | Creates a complete domain structure for Ybyra — schema, events, handlers, and hooks — from a natural language description of the entity. |
Generate the full domain layer for a new entity in a Ybyra project.
src/domain/{domain}/
schema.ts ← Schema definition with fields, groups, actions
events.ts ← Field-level reactive events
handlers.ts ← Action handlers (CRUD + custom)
hooks.ts ← Bootstrap and fetch lifecycle hooks
index.ts ← Barrel export
schema.ts)import { action, date, group, text, Text, toggle, number, select, Position, Scope } from "@ybyra/core";
import { schema } from "@/settings/schema";
export const {Domain}Schema = schema.create("{domain}", {
groups: {
// Visual groupings — one per logical section
basic: group(),
},
fields: {
// Each field: type().width(N).required().column().group("groupName")
name: text().width(100).default("").required().column().filterable().group("basic"),
},
actions: {
// null removes inherited actions, .hidden() hides them
// Custom actions use action().order(N).variant().positions().scopes()
},
});
Rules:
schema.create(domain, ...) — domain is the i18n key prefixtext(), date(), number(), toggle(), select(), currency(), file(),
checkbox(), datetime().width(N) — percentage of row (100 = full width).column() — visible in table view.filterable() — searchable in table.required() — validates presence.group("name") — assigns to visual group.default(value) — initial value.scopes(Scope.add, Scope.edit) — whitelist scopes.excludeScopes(Scope.view) — blacklist scopes.kind(Text.Email) — specialization for text fieldsevents.ts)import { {Domain}Schema } from "@/domain/{domain}/schema";
export const {domain}Events = {Domain}Schema.events({
fieldName: {
change({ state, schema }) {
// state.fieldName — read/write field values
// schema.fieldName.hidden = true — toggle visibility
// schema.fieldName.disabled = true — toggle editability
// schema.fieldName.state = "error" — set visual state
// schema.fieldName.width = 50 — change layout
},
blur({ state, schema }) { },
focus({ state, schema }) { },
},
});
Rules:
state is a proxy — mutations are tracked automaticallyschema proxy allows dynamic overrides of field propertieschange, blur, focushandlers.ts)import type { ServiceContract } from "@ybyra/core";
import { {Domain}Schema } from "@/domain/{domain}/schema";
import { createDefault } from "@/settings/handlers";
export function create{Domain}Handlers(service: ServiceContract) {
return {Domain}Schema.handlers({
...createDefault(service),
// Custom action handlers:
// customAction({ state, component, form }) { ... }
});
}
Rules:
createDefault(service) for CRUD handlers (save, remove, back)HandlerContext with: state, component (navigator, dialog, toast, loading), form (
validate, reset), table (reload)hooks.ts)import type { ServiceContract } from "@ybyra/core";
import { {Domain}Schema } from "@/domain/{domain}/schema";
import { createDefault } from "@/settings/hooks";
export function create{Domain}Hooks(service: ServiceContract) {
return {Domain}Schema.hooks(createDefault(service));
}
Rules:
createDefault(service) provides bootstrap and fetch hooksbootstrap runs on form mount (load initial data, set defaults)fetch runs for table pagination (search, sort, paginate)index.ts)export { {Domain}Schema } from "@/domain/{domain}/schema";
export { {domain}Events } from "./events";
export { create{Domain}Handlers } from "./handlers";
export { create{Domain}Hooks } from "./hooks";
| Item | Pattern | Example |
|---|---|---|
| Schema | {Domain}Schema | ProductSchema |
| Events | {domain}Events | productEvents |
| Handlers factory | create{Domain}Handlers | createProductHandlers |
| Hooks factory | create{Domain}Hooks | createProductHooks |
| Service factory | create{Domain}Service | createProductService |
| Directory | src/domain/{domain}/ | src/domain/product/ |