用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/tomevault-io/skills-registry --skill ventyd命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
| Use when this capability is needed.
> Use when this capability is needed.
Review architecture and API design for the vfs-s3 project. Use when the user mentions @architect, asks to review an issue's design, discuss module boundaries, API shape, or architectural decisions for vfs-s3. Also trigger when the user wants to create an ADR (Architecture Decision Record) or evaluate a technical approach for the project. Intended for dispatch from Codex automation or Claude routines; GitHub trigger phrase: @vfs-s3-bot please prepare design doc Use when this capability is needed.
基于 SOC 职业分类
正在显示 SKILL.md
| name | ventyd |
| description | > Use when this capability is needed. |
Build event-sourced applications with Ventyd. This skill teaches you how to find current documentation and write correct ventyd code.
Everything you know about ventyd is likely outdated or wrong. Never rely on memory. Your training data may contain obsolete APIs. Always verify against the documentation referenced in this skill.
Before writing code, verify package installation:
ls node_modules/ventyd/
references/quick-start.md, or use remote docs| Question | Resource | Purpose |
|---|---|---|
| Project setup / installation | references/quick-start.md | Installation and first entity guide |
| API usage / type signatures | references/embedded-docs.md | Look up via installed package type declarations |
| Usage without packages | references/remote-docs.md | Fetch from https://ventyd.com/docs/ |
| Error resolution | references/common-errors.md | Troubleshooting solutions |
Embedded docs (if packages installed)
node_modules/ventyd/dist/types/*.d.mtsSource code (if packages installed)
node_modules/ventyd/dist/index.mjsRemote docs (if packages not installed)
https://ventyd.com/docs/Ventyd follows a four-building-block pattern:
Schema → Reducer → Entity → Repository
(events (state (business (persistence
+ state) from logic) + plugins)
events)
Data flow:
1. Entity.create() or mutation()
2. → dispatch(eventName, body)
3. → event validated against schema
4. → reducer computes new state
5. → repository.commit() persists events via adapter
6. → plugins run side effects (parallel, non-blocking)
import * as v from "valibot";
import { defineSchema, defineReducer, Entity, mutation, createRepository } from "ventyd";
import { valibot } from "ventyd/valibot";
import type { Adapter } from "ventyd";
// 1. Define schema
const userSchema = defineSchema("user", {
schema: valibot({
event: {
created: v.object({
nickname: v.string(),
email: v.pipe(v.string(), v.email()),
}),
profile_updated: v.object({
nickname: v.optional(v.string()),
bio: v.optional(v.string()),
}),
deleted: v.object({
reason: v.optional(v.string()),
}),
restored: v.object({}),
},
state: v.object({
nickname: v.string(),
: v.(v.(), v.()),
: v.(v.()),
: v.(v.(v.())),
}),
}),
: ,
});
userReducer = (userSchema, {
(event.) {
:
{
: event..,
: event..,
: ,
: ,
};
:
{
...prevState,
...(event.. && { : event.. }),
...(event.. !== && { : event.. }),
};
:
{ ...prevState, : event. };
:
{ ...prevState, : };
:
prevState;
}
});
(userSchema, userReducer) {
() { ..; }
() { ..; }
() { .. !== ; }
updateProfile = (
,
{
(.) {
();
}
(, updates);
},
);
= (, {
(.) ();
(, { reason });
});
restore = (, {
(!.) ();
(, {});
});
}
userRepository = (, {
: myAdapter,
: [],
});
user = .({
: { : , : },
});
user.({ : });
userRepository.(user);
loaded = userRepository.({ : user. });
.(loaded?..);
created, profile_updated, deletedcreated → user:createdinitialEventName must be fully qualified: "user:created" (not "created")default case returning prevStateprevState — return a new objectevent.body for event data, event.eventCreatedAt for timestampsdispatch()mutation(this, fn) helper — not raw $$dispatch()Entity.load() returns readonly entities — mutations are stripped at the type levelcreateRepository(Entity, { adapter, plugins?, onPluginError?, migrate?, snapshot? })findOne({ entityId }) returns mutable entity or nullcommit(entity) persists pending events// Core
import { defineSchema, defineReducer, Entity, mutation, createRepository } from "ventyd";
import type { Adapter, Plugin, Repository, Schema, ReadonlyEntity } from "ventyd";
// Validation libraries (pick one)
import { valibot, v } from "ventyd/valibot";
import { zod, z } from "ventyd/zod";
import { arktype, type } from "ventyd/arktype";
import { typebox, Type } from "ventyd/typebox";
import { standard } from "ventyd/standard"; // generic Standard Schema
// Adapters
import { prismaAdapter } from "ventyd/adapter/prisma";
Type errors often signal outdated knowledge. Common indicators include "Property X does not exist," module not found, and constructor parameter errors.
Response approach:
references/common-errors.mdSource: daangn/ventyd — distributed by TomeVault.