一键导入
create-service
Creates a service layer with persistence for a Ybyra domain, implementing ServiceContract with optional custom methods.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Creates a service layer with persistence for a Ybyra domain, implementing ServiceContract with optional custom methods.
用 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 a complete domain structure for Ybyra — schema, events, handlers, and hooks — from a natural language description of the entity.
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.
| name | create-service |
| description | Creates a service layer with persistence for a Ybyra domain, implementing ServiceContract with optional custom methods. |
Generate the application service for a Ybyra domain entity.
src/application/{domain}/
{domain}Service.ts ← ServiceContract implementation
import { createService } from "@ybyra/core";
import type { PersistenceContract } from "@ybyra/core";
import { {Domain}Schema } from "../../domain/{domain}";
export function create{Domain}Service(driver: PersistenceContract) {
return {
...createService({Domain}Schema, driver),
// Custom methods beyond CRUD:
// async customMethod(param: string) { ... }
};
}
createService(Schema, driver) provides standard CRUD: list, find, create, update, removedriver parameter is a PersistenceContract — the actual storage backendcreateService() to inherit all CRUD, then add custom methodsimport { createWebDriver } from "@ybyra/persistence/web";
const driver = createWebDriver();
import { createLocalDriver } from "@ybyra/persistence";
const driver = createLocalDriver();
import type { PersistenceContract } from "@ybyra/core";
const driver: PersistenceContract = {
async list(domain, options) { /* fetch from API */ },
async find(domain, id) { /* GET /api/{domain}/{id} */ },
async create(domain, data) { /* POST /api/{domain} */ },
async update(domain, id, data) { /* PUT /api/{domain}/{id} */ },
async remove(domain, id) { /* DELETE /api/{domain}/{id} */ },
};
Each application creates a setup file that wires service → handlers → hooks:
// src/setup.ts or src/demo.ts
import { createWebDriver } from "@ybyra/persistence/web";
import { create{Domain}Service } from "./application/{domain}/{domain}Service";
import { create{Domain}Handlers } from "./domain/{domain}";
import { create{Domain}Hooks } from "./domain/{domain}";
const driver = createWebDriver();
export const {domain}Service = create{Domain}Service(driver);
export const {domain}Handlers = create{Domain}Handlers({domain}Service);
export const {domain}Hooks = create{Domain}Hooks({domain}Service);