/tsed:tsed-difrom Ts.ED
Declare, 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…
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.
Register every class the framework must build, resolve dependencies through the injector, and never construct DI-managed classes with new.
Read the DI API reference for signatures, the hook order and the deprecated-API table. Depth: https://tsed.dev/docs/providers.md, https://tsed.dev/docs/custom-providers.md, https://tsed.dev/docs/hooks.md.
All symbols below come from @tsed/di. Decorators and the functional API are interchangeable; follow the style already used in the project.
import {Injectable, Inject, inject, injectable} from "@tsed/di";
import {UsersRepository} from "./UsersRepository.js";
@Injectable()
export class UsersService {
@Inject()
protected repository: UsersRepository; // decorator style
// or: private readonly repository = inject(UsersRepository); // functional style
}
// Functional registration, without the class decorator:
// export class UsersService { ... }
// injectable(UsersService);
inject() works in class field initializers, constructors, factories and hooks of registered providers.inject() at module top level: it builds the provider before configuration, imports overrides and test mocks are loaded.@Injectable() and injectable(Class) on the same class.@Controller("/path"), or controller(Class).path("/path"). Routing belongs to tsed-controllers.@Injectable().@Module({imports: [...]}).@Interceptor() and @Intercept() are exported by @tsed/di.import {constant, injectable} from "@tsed/di";
export const DbConnection = injectable(Symbol.for("DbConnection"))
.asyncFactory(async () => {
const options = constant<DbOptions>("database");
return connect(options);
})
.hooks({$onDestroy: (connection) => connection.close()})
.token();
export type DbConnection = typeof DbConnection;
.value(v), .factory(fn), .asyncFactory(fn), .class(Klass); chain .scope(), .deps(), .imports(), .hooks(), .type(), .alias(), and end with .token().inject(DbConnection) or @Inject(DbConnection) db: DbConnection.@Inject(TOKEN). A bare @Inject() only works when the TypeScript type is a class.export const RetryPolicy = Symbol("RetryPolicy") plus export interface RetryPolicy {...}, then injectable(RetryPolicy).class(TokenBucket).injectable(Foo).type(Bar) or @Injectable({type: Bar}), then injectMany<Bar>(Bar) or @Inject(Bar) bars: Bar[].@OverrideProvider(Original) on the replacement class, or imports: [{token, useClass}] in configuration.import {Injectable, ProviderScope, Scope} from "@tsed/di";
@Injectable()
@Scope(ProviderScope.REQUEST)
export class RequestCart {}
// functional: injectable(RequestCart).scope(ProviderScope.REQUEST);
SINGLETON (default): one instance, built at startup.REQUEST: one instance per request. The controller and every provider on the injection chain must also be REQUEST; a singleton parent keeps the first instance forever.INSTANCE: a new instance on every injection. inject(Token, {rebuild: true}) forces a fresh one ad hoc.REQUEST scope when you only need per-request data.import {lazyInject} from "@tsed/di";
const service = await lazyInject(() => import("./ReportService.js")); // module must `export default` the class
Decorator form: @LazyInject("ReportService", () => import("./ReportService.js")) reports: Promise<ReportService>. Only $onInit runs for lazy providers. Do not lazy-load controllers, middlewares, or providers that rely on other hooks.
import {Injectable, OnDestroy, OnInit} from "@tsed/di";
import {$asyncEmit, $on} from "@tsed/hooks";
@Injectable()
export class QueueService implements OnInit, OnDestroy {
async $onInit() {}
async $onDestroy() {}
$onReady() {}
}
$on("$onReady", () => {}); // subscribe without a class
await $asyncEmit("$orderCreated", [order]); // emit a custom hook; listeners are `$orderCreated(order)` methods
$ on a provider is registered as a hook listener.$beforeInit → $onInit → $afterInit → $beforeRoutesInit → $onRoutesInit → $afterRoutesInit → $beforeListen → $afterListen → $onReady; per request $onRequest / $onResponse; shutdown $onDestroy.OnInit and OnDestroy types come from @tsed/di; BeforeInit, AfterInit, BeforeRoutesInit, OnRoutesInit, AfterRoutesInit, BeforeListen, AfterListen, OnReady come from @tsed/platform-http.$alter("$name", value, [args]) / $asyncAlter for hooks that transform a value. $emit is synchronous and does not await listeners.import {context} from "@tsed/di";
import type {PlatformContext} from "@tsed/platform-http";
const $ctx = context<PlatformContext>();
$ctx.logger.info({event: "LOOKUP", id: $ctx.request.params.id});
@Context() $ctx: PlatformContext from @tsed/platform-params.context() or @InjectContext() $ctx?: PlatformContext from @tsed/di. Do not store $ctx on a singleton.$ctx.set(key, value) / $ctx.get(key). Outside a request, context() returns a detached DIContext, not the request.InjectionError or "Given token is undefined. Could mean a circular dependency problem": two files import each other. Extract the shared logic into a third provider, or resolve late with inject(Token) inside the method; never fix it with new.@Inject() typed as an interface resolves to Object and throws InvalidPropertyTokenError. Pass the token.undefined in the constructor under some compilers: set useDefineForClassFields: false and enable experimentalDecorators + emitDecoratorMetadata.$onInit; consumers receive the resolved value, not a promise. Do not await inject(TOKEN) in singletons.$onDestroy; other $ hooks are not called on them.imports.@tsed/common; use @tsed/di, @tsed/hooks, @tsed/platform-http, @tsed/platform-params.@Injectable/@Module/@Controller or injectable()/controller()).$onInit or a factory are closed in $onDestroy.registerProvider, injector.emit/alter/alterAsync, or @tsed/common import remains (see the reference table; use tsed-migration for v7 code).constant() / refValue() (tsed-configuration) and providers are tested through PlatformTest (tsed-testing).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-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./tsed-loggerConfigure and use logging in a Ts.ED v8 application with @tsed/logger v8. Covers logger injection, request-scoped logs with $ctx.logger, the `logger` configuration key, @tsed/platform-log-request, appenders, layouts, JSON logs in production, connectors and custom appenders. Use when working with $log, inject(Logger), logger(), ContextLogger, $log.appenders.set, @Appender, @Layout or any @tsed/logger-* package, or when seeing "Appender ... doesn't exists", "Missing ... layout doesn't exists", duplicated log lines, missing request logs after a v8 upgrade, or an appender ignoring its levels.Other plugins' skills for the same job