/kavo-skills:dto-slotsfrom Kavo Developer Skills
Reference for Kavo's six optional schema slots (create/update/patch/query/item/list) — entity-derived defaults, the schemaShapeKeys narrowing rule, and serialization order. Use when configuring a DTO class or validator on @Kavo's schema option.
Ships in Kavo Developer Skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Every REST verb has an independent, optional data contract. Zero config
means entity-derived defaults; configuring a schema slot narrows exactly
one slot. The single config key is schema (ADR-0055; the old dto key is
gone), split into schema.input.<slot> and schema.output.<slot>. A slot
takes either a plain class (a shape for typing, serialization and docs,
never validated) or a validator — any object satisfying the structural
KavoSchema<Output> contract, which a Zod schema qualifies for natively.
A validator actually validates an incoming body
(SchemaValidationException, KAVO_SCHEMA_INVALID); a failing
schema.output validator falls back to the projected value, so it shapes
but is not a security boundary. Full detail:
docs/internals/architecture/04-schema-system.md and docs/core/schemas.md.
Config-side wiring (@Kavo(Entity, { schema: {...} })) is in the
kavo-decorator skill.
| Slot | Verb / context | Default when omitted |
|---|---|---|
create | POST body | Entity minus generated + relation fields |
update | PUT body | Same default as create |
patch | PATCH body | Partial<update> if update registered, else Partial<Entity> |
query | GET list input | Generic QueryContext<Entity> |
item | Any single-resource response | Entity, subject to field selection |
list | Element type in ListResultDto.items | Same as item's resolved type |
restoreOne reuses the item slot — there is no seventh slot for it.
Naming convention (CLAUDE.md): request bodies are <Verb><Entity>Dto
(CreateUserDto); query/response shapes are <Entity><Slot>Dto
(UserItemDto, UserListDto).
Each slot resolves independently at bootstrap and is cached on the
resolved config — never re-derived per request. patch → update and
list → item are the only fallback chains; nothing else falls back.
item/list default): every scalar column.
Relation properties are excluded unless the request includes them
deliberately; getters/methods never appear (not columns).create/update/patch default): every scalar
column with generated: false. Generated columns (auto ids,
@CreateDateColumn, versions) can never be written from a request body —
the default deserializer silently strips them.json-kind column and travel as one opaque
value; they are not flattened into sub-fields.schemaShapeKeys ruleA registered class projects by its runtime key set: the own enumerable
properties of new Schema(). TypeScript field declarations only exist at
runtime once initialized:
class UserListDto {
id = 0;
name = "";
} // projects [id, name]
class BadDto {
id!: number; // declared, never initialized
} // no runtime keys → silently falls back to the entity-derived default
This is a common gotcha: a DTO class with only !:-declared fields and no
constructor/initializer narrows nothing — the response is still correct,
just not narrowed the way you expected. Always give DTO fields a default
value if you want them to actually constrain the projection.
Schema mapping happens first, then field selection.
fields=id,name can only narrow what the resolved DTO already exposes —
selection never widens a projection. If a field isn't on the item/list
DTO, fields= can't bring it back. (Implemented as
projection ∩ selection in DefaultSerializer.serializeItem.)
When a response embeds an included relation (include=pets), the node's
shape comes from the target entity's own configured schema.output.item/list (class-shaped only; a validator there does not narrow nested rows)
(falling back to that entity's own derived default) — never a DTO
registered on the parent. The relation is a full resource in its own right;
see the kavo-decorator skill's "relations" section for how inclusion
itself is allowlisted.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub kavo-labs/kavo --plugin kavo-skills15 skills in this plugin
/composite-primary-keysReference for composite primary key support in @kavo/typeorm — the compositeIdFields metadata field, the ~-delimited route-id encoding, the creatable/updatable split, and every place composite keys don't yet work (other ORM adapters, many-to-many array-mutation, @kavo/graphql). Use when an entity has more than one @PrimaryColumn, or when a route id, association, or array-mutation write on such an entity behaves unexpectedly./error-handlingReference for Kavo's exception hierarchy, KAVO_* error-code catalog, and the RFC 9457 problem-details wire shape every generated route returns on failure. Use when handling/mapping a Kavo error, deciding which exception to throw from a custom handler/@Override, or answering "what does the error response look like" questions./global-configReference for Kavo's global configuration — the KavoSettings precedence chain, built-in defaults table, KavoModule.forRoot/forRootAsync options, and the operations.<id> global-default caveat (ADR-0015). Use when wiring createKavo/KavoModule.forRoot, setting app-wide defaults, or answering "what can I configure globally" questions./graphql-bindingReference for @kavo/graphql and its Nest binding — building a schema over an existing createCrud service, the raw-AST filter/sort args, multi-entity merging, the process-wide type registry, and the zero-code KavoModule graphql option. Use when exposing an entity over GraphQL, or answering "how do I add GraphQL to this entity" questions./kavo-decoratorReference for what @Kavo(Entity, config?) generates and how to configure/override it — routes table, EntityConfig shape (schema/allowed/operations), manual-method-wins, @Override, and fully custom routes. Use when writing or reviewing a @Kavo-decorated controller, or answering "how do I configure/override this route" questions./mcp-bindingReference for @kavo/mcp and its Nest binding — the standard per-entity toolset, findMany's raw-AST filter/sort args, flat update/patch args, isError result mapping, the zero-config KavoModule mcp option, and the fact that the default MCP route carries no auth guard. Use when exposing entities to an MCP client, or answering "how do I add MCP tools to this entity" questions.Other plugins' skills for the same job