/tsed:tsed-modelsfrom Ts.ED
Defines Ts.ED v8 models with schema decorators, validation via @tsed/ajv, and serialization via @tsed/json-mapper. Use when creating DTOs, entity classes, or debugging payload/validation issues.
Ships in Ts.ED. 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.
Read when SKILL.md points to them.
One class describes the JSON Schema, the validation rules, the mapping and the OpenAPI model. The schema is the source of truth: what is not described does not exist.
Package map (never import from @tsed/common):
| Concern | Package |
|---|---|
Schema decorators, s, getJsonSchema | @tsed/schema |
serialize, deserialize, OnSerialize, OnDeserialize, BeforeDeserialize, AfterDeserialize | @tsed/json-mapper |
Formats, Keyword, AjvService | @tsed/ajv (plus ajv) |
ValidationPipe, ValidationError | @tsed/platform-params |
import {CollectionOf, Default, Email, Enum, Groups, MinLength, Nullable, Property, Required} from "@tsed/schema";
import {Role} from "./Role.js";
export class User {
@Groups("!creation")
id: string;
@Required()
@MinLength(3)
name: string;
@Required()
@Email()
email: string;
@Enum("admin", "member")
@Default("member")
kind: string = "member";
@Nullable(String)
bio: string | null;
@CollectionOf(Role)
roles: Role[];
@Property()
createdAt: Date;
}
@Property() is the minimum. Undecorated properties are dropped from the schema, from deserialized inputs and from serialized outputs.Array, Map and Set with @CollectionOf(Item) (aliases @ArrayOf, @MapOf). Use @RecordOf for records.@Required() / @Optional() versus @Nullable(Type). @Required() treats undefined, null and "" as missing; whitelist a value with @Allow("") or @Allow(null).@MinLength/@MaxLength, @Minimum/@Maximum (aliases @Min/@Max), @Pattern, @Format("date"), @Email, @Uri, @Url, @DateTime, @Enum, @Const, @Integer, @MinItems/@MaxItems/@UniqueItems.@Name("first_name"). Mark direction with @ReadOnly() / @WriteOnly(). Document with @Description, @Example, @Title.@AdditionalProperties(true) (or a schema). Do not enable jsonMapper.additionalProperties globally to work around a missing decorator.@OneOf(A, B) / @AnyOf / @AllOf. Add @DiscriminatorKey() on the base property and @DiscriminatorValue("a") on each subclass so deserialize instantiates the right class.@Generics("T") on the class, @CollectionOf("T") or @Property("T") on the member, then bind at the endpoint with @(Returns(200, Pagination).Of(Product)).@Ignore() in new code (deprecated); use @Groups.@Groups("creation") exposes a property only for that group; @Groups("!creation") hides it for that group; patterns such as group.* match several.@BodyParams() @Groups("creation") user: User and on output with @(Returns(200, User).Groups("read")).@BodyParams() @Partial() payload: User makes all properties optional for PATCH.jsonMapper.strictGroups: true in new applications. Without it, an endpoint that declares no group exposes every grouped property, and the generated documentation does not match the runtime.import "@tsed/ajv";
import {Configuration} from "@tsed/di";
@Configuration({
ajv: {returnsCoercedValues: true},
jsonMapper: {strictGroups: true}
})
export class Server {}
ajv and @tsed/ajv, and import @tsed/ajv in the server. Without a registered validator the built-in ValidationPipe only checks required parameters; every other constraint is silently skipped.ajv configuration key takes AJV constructor options directly, plus errorFormatter and returnsCoercedValues.AjvValidationError (a BadRequest, name AJV_VALIDATION_ERROR, with errors[]), returned as 400. Payload shape and customization: tsed-exceptions..Error("...") on a constraint decorator, or @ErrorMsg, @TypeError, @DefaultMsg.@Formats("slug", {type: "string"}) on a class implementing FormatsMethods<string> (validate(value): boolean); apply with @Format("slug").@Keyword({keyword: "range", type: "number", schemaType: "array"}) on a class implementing KeywordMethods (compile or validate); apply with @CustomKey("range", [1, 10]).ValidationPipe and decorate with @OverrideProvider(ValidationPipe) from @tsed/di, throwing ValidationError. OpenAPI and mapping keep using the JSON Schema.import {deserialize, serialize} from "@tsed/json-mapper";
import {s} from "@tsed/schema";
import {User} from "./models/User.js";
const user = deserialize<User>(input, {type: User, groups: ["creation"]});
const users = deserialize<User[]>(list, {type: User, collectionType: Array});
const json = serialize(user, {type: User, groups: ["read"]});
const schema = s.compile(User, {groups: ["creation"]}); // getJsonSchema() is the deprecated alias
@BodyParams, @QueryParams, @PathParams and for returned values. Call them yourself for queues, sockets, caches and tests.deserialize does not validate. Validate first with AjvService.validate(value, {type: User}).@OnSerialize((value) => ...) / @OnDeserialize((value) => ...); hook the whole class with @BeforeDeserialize / @AfterDeserialize. All four come from @tsed/json-mapper.jsonMapper.disableUnsecureConstructor is false. Do not rely on Object.assign(this, data) constructors.import {s} from "@tsed/schema";
export const ProductSchema = s.object({
title: s.string().required().minLength(3),
price: s.number().minimum(0),
tags: s.array(s.string())
});
export type Product = s.infer<typeof ProductSchema>;
s is the only builder export to use (s.string, s.number, s.integer, s.boolean, s.date, s.datetime, s.email, s.enums, s.array, s.map, s.set, s.record, s.oneOf, s.anyOf, s.allOf). s.from(Model) returns a local copy to compose; s.get(Model) returns the shared class schema, so changes to it are global; s.generic(Pagination).of(Product) binds generics.
undefined in the handler: no decorator on the property.@CollectionOf is missing, or the parameter decorator did not receive the item class (see tsed-controllers).@tsed/ajv is not imported, or the parameter is typed with an interface or any.null rejected or coerced: add @Nullable(Type); it is mandatory when ajv.returnsCoercedValues is enabled.strictGroups is off.@DiscriminatorKey() property typed with the enum: keep it string; values come from @DiscriminatorValue.OnSerialize imported from @tsed/schema (as some doc pages show) does not compile; import it from @tsed/json-mapper.@CollectionOf.@tsed/ajv imported in the server; jsonMapper.strictGroups decided explicitly.@Returns where the shape differs.s.compile(Model) in a unit test (see tsed-testing).@tsed/common import; relative imports end with .js.Depth: https://tsed.dev/docs/model.md, https://tsed.dev/docs/validation.md, https://tsed.dev/docs/json-mapper.md. OpenAPI output: tsed-openapi.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub tsedio/tsed --plugin tsed13 skills in this plugin
/tsed-cliScaffolds Ts.ED v8 projects and generates files with the Ts.ED CLI v7, through its MCP server (tools set-workspace, init-project, list-templates, get-template, generate-file) or the tsed binary (tsed init, generate, template, add, run, update, dev, build). Use when creating a Ts.ED project, adding a controller, service, middleware, model, interceptor, pipe, decorator or custom template, when package.json has a "tsed" key or @tsed/cli, when a .templates/ directory exists, or on errors E_CWD_NOT_SET, E_PROJECT_NOT_INITIALIZED, E_TEMPLATE_UNKNOWN, E_ARGS_INVALID./tsed-configurationConfigure and bootstrap a Ts.ED v8 server - the @Configuration decorator or configuration() on the Server class, PlatformExpress/PlatformKoa/PlatformFastify.bootstrap, server options (mount, middlewares, httpPort, httpsPort, acceptMimes, logger, statics, views, responseFilters, imports), per-platform express/koa/fastify options, and @tsed/config sources (envs, dotenv, json, yaml). Use when editing Server.ts, index.ts or src/config, adding @tsed/config or the extends option, or reading settings with constant(), refValue(), @Constant, @Value or configuration().get()./tsed-controllersWrite Ts.ED v8 HTTP controllers and routes - @Controller paths and nested children, mounting through the `mount` configuration, verb decorators from @tsed/schema, parameter decorators from @tsed/platform-params, typed inputs, response decorators and custom endpoint decorators. Use when adding or fixing a REST endpoint, when a route returns 404 or is shadowed by another route, when @BodyParams/@QueryParams/@PathParams receive a plain object or the wrong type, or when working with @Returns, @Status, @Redirect, @View, @Hidden, @Req/@Res or useDecorators./tsed-diDeclare, inject and scope Ts.ED v8 providers and wire lifecycle hooks - @Injectable, @Module, @Controller, @Inject, the functional API (inject, injectMany, lazyInject, constant, refValue, injectable().factory/asyncFactory/class/value, injector, context, logger), ProviderScope, custom tokens, @tsed/hooks ($on, $emit, $asyncEmit, $alter) and request context. Use when writing services or modules with @tsed/di, fixing InjectionError, "Given token is undefined" or undefined injected properties, choosing a scope, adding $onInit/$onDestroy/$onReady, or replacing registerProvider and other deprecated DI APIs./tsed-docsLocates authoritative Ts.ED v8 documentation and API reference instead of guessing framework APIs. Routes a topic to the right tsed.dev page, its markdown twin, the llms.txt indexes (tsed.dev, cli.tsed.dev, logger.tsed.dev) and the sibling tsed-* skills. Use when working in a project that depends on @tsed/* packages and an import path, decorator (@Controller, @Injectable, @Returns), function (inject, injectable, configuration), option name or error message is uncertain, when an example imports from @tsed/common, or before answering any "how do I ... in Ts.ED" question./tsed-exceptionsHandle errors and shape responses in a Ts.ED v8 application with @tsed/exceptions, exception filters from @tsed/platform-exceptions and response filters from @tsed/platform-response-filter. Use when throwing BadRequest/NotFound/Unauthorized or a custom exception, customizing the JSON error payload, writing a @Catch filter, customizing the 404 ResourceNotFound page, wrapping all responses in an envelope with @ResponseFilter, documenting errors with @Returns(404, NotFound), or debugging responses such as "InternalServerError", AJV_VALIDATION_ERROR or a response filter that is never called.Other plugins' skills for the same job