/kavo-skills:quick-startfrom Kavo Developer Skills
Scaffolds a new Kavo API project with NestJS, TypeORM, and SQLite. Covers project setup, package installation, and tsconfig configuration for decorator metadata.
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.
The fastest working slice: one entity, one controller, zero DTOs, an
on-disk SQLite file. No Postgres, no GraphQL, no bulk — add those later
from the other skills (kavo-decorator, global-config, dto-slots,
graphql-binding) once this runs. Swagger docs are one optional step,
covered at the end (§9).
This page is the TypeORM path. Steps 1–3 and 5–9 are the same whatever ORM you use, but the entity in §4 and the wiring in §6 are TypeORM-specific and do not carry over. On another ORM, read its skill for those two steps:
| ORM | Skill | The part that differs |
|---|---|---|
| Prisma | prisma-adapter | Needs a marker class per model — no runtime class |
| Mongoose | mongoose-adapter | The model is the entity; ids are hex strings |
| MikroORM | mikroorm-adapter | Pass the MikroORM instance, not an EntityManager |
mkdir my-kavo-app && cd my-kavo-app
npm init -y
Set "type": "module" in package.json — every @kavo/* package ships as
ESM only:
{
"name": "my-kavo-app",
"type": "module",
"scripts": {
"build": "tsc -b",
"start": "node dist/main.js"
}
}
Runtime dependencies — Nest, TypeORM, the SQLite driver, and the three
@kavo/* packages:
npm install @nestjs/common @nestjs/core @nestjs/platform-express \
reflect-metadata rxjs typeorm better-sqlite3 \
@kavo/core @kavo/nest @kavo/typeorm
Dev dependencies — TypeScript and Node types only (no test runner needed for this quick start):
npm install -D typescript @types/node
That's the whole install — no @nestjs/swagger (optional peer, skip it
until you want generated API docs) and no graphql (optional peer, only
needed for the graphql-binding skill).
tsconfig.jsonDecorator metadata (emitDecoratorMetadata) is load-bearing — both
TypeORM's entity columns and Nest's DI need it:
{
"compilerOptions": {
"target": "ES2022",
"module": "Node16",
"moduleResolution": "Node16",
"outDir": "dist",
"rootDir": "src",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"useDefineForClassFields": false,
"strict": true,
"skipLibCheck": true
},
"include": ["src"]
}
useDefineForClassFields: false matters here: with it on, every declared
field is emitted as a real class field, so a fresh entity carries an own key
for every column — set to undefined — whether the adapter hydrated it or
not. Partially-hydrated rows then serialize with those columns present as
undefined instead of absent.
src/cat/cat.entity.ts:
import { Column, Entity, PrimaryGeneratedColumn } from "typeorm";
@Entity()
export class Cat {
@PrimaryGeneratedColumn()
id!: number;
@Column("varchar")
name!: string;
@Column("int")
age!: number;
}
That's it — no CreateCatDto/UpdateCatDto/CatItemDto files. Left
unregistered, every DTO slot derives straight from the entity (see
dto-slots): the create/update body is every writable column, and the
response is every readable column. Add explicit DTO classes later, only
once you actually need to narrow a shape.
@Kavosrc/cat/cat.controller.ts:
import { Controller } from "@nestjs/common";
import { Kavo } from "@kavo/nest";
import { Cat } from "./cat.entity.js";
@Kavo(Cat)
@Controller("cats")
export class CatController {}
This one decorator generates the full REST surface:
| Method | Path | Status |
|---|---|---|
| POST | /cats | 201 |
| GET | /cats | 200 |
| GET | /cats/:id | 200 |
| PUT | /cats/:id | 200 |
| PATCH | /cats/:id | 200 |
| DELETE | /cats/:id | 204 |
GET /cats already supports filter[...], sort=, limit/offset, and
fields= out of the box — see query-grammar for the full grammar once
you're past this quick start.
src/app.module.tsimport { Module } from "@nestjs/common";
import { KavoModule } from "@kavo/nest";
import { createInfrastructure } from "@kavo/typeorm";
import { DataSource } from "typeorm";
import { Cat } from "./cat/cat.entity.js";
import { CatController } from "./cat/cat.controller.js";
@Module({
imports: [
KavoModule.forRootAsync({
useFactory: async () => {
const dataSource = await new DataSource({
type: "better-sqlite3",
database: "db.sqlite", // on-disk file; use ":memory:" for a throwaway db
entities: [Cat],
synchronize: true, // fine for a quick start; use migrations for anything real
}).initialize();
return { infrastructure: createInfrastructure(dataSource) };
},
}),
],
controllers: [CatController],
})
export class AppModule {}
KavoModule.forRootAsync builds the Kavo root instance and registers the
problem-details exception filter app-wide — nothing else to add for errors
to come back as RFC 9457 JSON (see error-handling). A plain Nest
controllers: array is all @Kavo classes ever need; there's no separate
per-entity registration step.
src/main.tsimport "reflect-metadata";
import { NestFactory } from "@nestjs/core";
import { AppModule } from "./app.module.js";
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule);
await app.listen(3000);
}
void bootstrap();
npm run build
npm start
curl -X POST localhost:3000/cats -H "content-type: application/json" -d '{"name":"Whiskers","age":3}'
curl localhost:3000/cats
curl "localhost:3000/cats?filter[age][gte]=1&sort=-age"
One extra install, no @Kavo config needed — every generated route
documents itself automatically once @nestjs/swagger is present:
npm install @nestjs/swagger
// src/main.ts
import "reflect-metadata";
import { NestFactory } from "@nestjs/core";
import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
import { AppModule } from "./app.module.js";
async function bootstrap(): Promise<void> {
const app = await NestFactory.create(AppModule);
const document = SwaggerModule.createDocument(
app,
new DocumentBuilder().setTitle("My Kavo API").setVersion("1.0.0").build(),
);
SwaggerModule.setup("docs", app, document); // → GET /docs
await app.listen(3000);
}
void bootstrap();
Full detail (what gets documented automatically vs. what still needs a
hand-written @ApiQuery()/@ApiOperation()) is in the swagger skill.
entities: [...] array and give each its own @Kavo
controller; relation config is in kavo-decorator.dto-slots.global-config.soft-delete.swagger. GraphQL → install the optional graphql peer
and see graphql-binding. Exposing the same entities as MCP tools →
mcp-binding.prisma-adapter, mongoose-adapter, or
mikroorm-adapter; only §4 and §6 above change.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./dto-slotsReference 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, or answering "why isn't my field showing/hiding" or "what shape does this response have" questions./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.Other plugins' skills for the same job