/lakutata:lakutatafrom lakutata
Writes, changes and tests applications built on lakutata 3.x, an IoC framework for Node.js/TypeScript supporting web APIs, CLIs, desktop (Electron/NW.js), React Native, device services, and MCP servers.
Ships in lakutata. 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.
Lakutata is an IoC application framework for Node.js and TypeScript. An application is a tree of objects (components, providers, controllers) that a container creates; DTOs validate their options and inputs; one controller method can answer over HTTP, on the command line, over service transports, on a schedule and from a queue. This file gives the model and the rules that hold everywhere. The details are in the guides that ship with the package the project has installed: read them as the section "Where the details are" says.
Read the dependencies in the package.json of the project (in a workspace, the package of the application, usually
packages/app/package.json), and node_modules/lakutata/package.json or node_modules/@lakutata/core/package.json.
| Signs | Version |
|---|---|
lakutata at ^3…; builders in camelCase (buildEntrypoints()); helpers from lakutata/utils | 3.x: this skill |
lakutata at ^2…; imports from lakutata/helper; builders in PascalCase (BuildEntrypoints()) | 2.x |
@lakutata/core at ^1…, with packages named @lakutata-component/* or @lakutata-module/* | 1.x |
This skill documents 3.x. The three versions are not source compatible, and 1.x and 2.x differ from each other too:
https://lakutata.com/doc/en/UpgradingFrom2.md; to upgrade a 1.x project,
follow only https://lakutata.com/doc/en/UpgradingFrom1.md. Each covers its own version: do not apply the steps of
one to the other.The guides and the examples of lakutata ship inside the package, in the version the project runs. Before writing code in an area this project does not use yet, read its guide, in this order:
node_modules/lakutata/doc/en/ (in a workspace, the node_modules of the root or of the application package).
Overview.md lists the guides of the installed version; examples/, when present, holds whole applications.
The separate packages (@lakutata/nats, @lakutata/grpc, @lakutata/mcp, @lakutata/dbus, @lakutata/webrtc,
@lakutata/ffi, @lakutata/math, @lakutata/barcode, @lakutata/netif, @lakutata/mongo-embedded,
@lakutata/thermal, @lakutata/thermal-printer, @lakutata/serial, @lakutata/ldap, @lakutata/ldap-engine,
@lakutata/cli) have their README in their own directory of node_modules.lakutata and @lakutata/* in node_modules: every export is documented there with an
example. They are the reference for a signature or an option.doc/: the same files on the website, as plain
Markdown: https://lakutata.com/doc/en/<file>.md (the guides) and https://lakutata.com/doc/en/examples/<file>.md;
https://lakutata.com/llms.txt lists them. The website follows the latest sources, which may be ahead of a
project's version: what the installed package says wins.Some assistants keep node_modules away from their file tools (it is ignored by git). When a file there cannot be
opened, read it with a shell command (cat node_modules/lakutata/doc/en/Overview.md) if one is allowed, or use the
website.
| Task | Guides (file names of the current version; Overview.md lists those of the installed one) |
|---|---|
A new project, its files and scripts, the lakutata command | GettingStarted.md, ProjectStructure.md, Command.md |
| The model of the framework; how to structure an application, where its logic lives, tests | Concepts.md; ApplicationDesign.md |
| The application: options, lifecycle, mode | Application.md |
| Components, providers, modules, lifetimes, injection, options of objects | Objects.md, Injection.md, Modules.md, Decorator.md |
| DTOs and validation; exceptions | DTOValidation.md; Exceptions.md |
| Controllers, the entrypoint, middlewares and access control | Controllers.md, Entrypoint.md, Middlewares.md |
| HTTP routes and responses; command line tools | HTTP.md; CLI.md |
| Service actions and their clients; gRPC; NATS | ServiceCalls.md; GRPC.md; NATS.md |
| Scheduled jobs; message queues | Schedules.md; Queue.md |
| Databases, entities, migrations | Database.md, DatabaseDrivers.md, Entities.md, Migrations.md, MongoEmbedded.md |
| Caches; locks | Cache.md; Mutex.md |
| Logs; messages in several languages; monitors | Logger.md; I18n.md; Monitor.md |
| Docker; containerd; D-Bus; MCP servers | DockerIntegration.md; ContainerdIntegration.md; DBus.md; MCP.md |
| Security; time; helper functions | Security.md; Time.md; HelperFunctions.md |
| Workspaces of several packages; native addons; C functions of native libraries | Workspaces.md; NativeAddons.md; FFI.md |
Barcodes and QR codes: generating, printing sizes, EAN/UPC/GS1, reading images (@lakutata/barcode) | Barcode.md |
Thermal printers: receipts and labels in HTML, choosing and saving printers, ESC/POS, TSPL, ZPL; serial ports and Bluetooth (@lakutata/thermal, @lakutata/thermal-printer, @lakutata/serial) | Thermal.md |
LDAP in an application: signing users in against a directory, reading and writing it, serving a directory from the application's database (to SSSD on the same machine over a Unix socket too), its schema, access and password policy, plugins and backends as lakutata classes (@lakutata/ldap) | LDAP.md |
LDAP without an application: the client and its pool, Active Directory, filters, DNs, schemas as documents, LDIF, a server with backends of one's own, the plugins and interceptors, the protocol (@lakutata/ldap-engine) | LDAPEngine.md |
Mathematics: formulas, equations, decimals, matrices, statistics, numeric solutions, units (@lakutata/math) | Math.md |
Listening on a network interface whatever its addresses (the interface option of the entrypoints, or @lakutata/netif alone); the interfaces and their changes | Netif.md |
Serial ports and classic Bluetooth devices: opening a port as a stream, its line and modem lines, finding it by its USB ids, unplugged devices (@lakutata/serial) | Serial.md |
WebRTC: the signaling, a TURN server, a media server, peer connections, service actions over data channels, a browser client (@lakutata/webrtc) | WebRTC.md |
| Bundles, executables, installers | Packaging.md, Installers.md |
| A whole application of a kind (REST API, CLI tool, web, desktop or mobile application, calls between services, background jobs, MCP server, service on a device) | examples/README.md and its pages |
| A 2.x project to bring to 3.x | https://lakutata.com/doc/en/UpgradingFrom2.md (the installed 2.x package does not have it) |
| A 1.x project to bring to 3.x | https://lakutata.com/doc/en/UpgradingFrom1.md (the installed 1.x packages do not have it) |
>=18.10.0 (lakutata create projects declare >=22.13.0; Getting Started lists the features that need a
newer one), ES modules, TypeScript with experimentalDecorators, emitDecoratorMetadata and
useDefineForClassFields: false. The tsconfig.json extends lakutata/tsconfig.json (keeping an include; it needs
a TypeScript that supports "module": "Node20") or sets these options itself, as the default and cli templates
do: keep the project's choice. The relative imports of the sources end in .js:
import {config} from './config/Config.js'.npx @lakutata/cli create --name my-app creates a project from a template: default (an HTTP application), cli,
service, web-react, web-vue, web-next, web-nuxt, electron-react, electron-vue, nwjs-react, nwjs-vue,
mobile-react (Android, iOS and HarmonyOS with React Native; give it --bundle-id com.acme.app);
--with adds features: i18n (every template), installer (cli, service, web-*), win7 (nwjs-*: NW.js
0.72, which runs on Windows 7). All but default are workspaces, the application being the package packages/app.src/App.ts (in a workspace, in packages/app) starts the application with the options returned by config() in
src/config/Config.ts; controllers, components, DTOs and tests have their own directories (controllers/,
components/, dtos/, tests/).default, npm run build compiles to build/, npm test builds then runs node --test on the compiled tests,
and npm run dev builds and starts. In a workspace, the root scripts run those of every package (the application
builds into packages/app/build/); cli and mobile-react have no dev script.Import only from the subpaths of the packages (the main ones are below; the exports of
node_modules/lakutata/package.json lists them all), never from the files inside a package.
| Subpath | What it gives |
|---|---|
lakutata | Application, Module, Component, Provider, BaseObject, Container, DTO, Exception and the framework's exceptions (InvalidValueException…), Time, isPackaged, resourcesPath, the types (ILogger…) |
lakutata/decorator/di | @Inject, @Configurable, @Autoload, @Singleton, @Scoped, @Transient |
lakutata/decorator/dto | @Expect, @Accept, @Return, @IndexSignature |
lakutata/decorator/asst | @Before, @After |
lakutata/dtos | PaginationSearchDTO, PaginationResultDTO, paginator, FlexibleDTO |
lakutata/com/entrypoint | buildEntrypoints, Controller, the contexts, Result, middlewares, access control, httpServiceEntrypoint, HTTPServiceProxy, scheduleEntrypoint |
lakutata/decorator/ctrl | @GET…@OPTIONS, @HTTPAction, @CLIAction, @ServiceAction, @Schedule, @Prefix, @UseMiddlewares |
lakutata/adapter/express, lakutata/adapter/fastify | The HTTP adapters: expressHTTPEntrypoint and jsonEnvelope (express), fastifyHTTPEntrypoint and fastifyJSONEnvelope (fastify) |
lakutata/adapter/commander | The command line adapter (commanderCLIEntrypoint) |
lakutata/adapter/socket.io, lakutata/adapter/jsonrpc, lakutata/adapter/electron, lakutata/adapter/nwjs, lakutata/adapter/react-native | Service transports |
lakutata/com/logger | The Logger, preset as the component log |
lakutata/orm, lakutata/decorator/orm | TypeORM and its decorators |
lakutata/com/database, lakutata/provider/database | buildDatabaseOptions, the Database component and provider |
lakutata/com/queue | Queues: buildQueueOptions, @QueueAction, queueEntrypoint (the queue adapter of buildEntrypoints()) |
lakutata/com/mutex, lakutata/com/cacher | Locks, caches |
lakutata/com/i18n, lakutata/com/monitor, lakutata/com/docker, lakutata/com/containerd | Other components |
lakutata/security, lakutata/provider/passwordHash, lakutata/utils | Security, password hashes, helpers |
Separate packages: @lakutata/cli (the lakutata command), @lakutata/nats, @lakutata/grpc, @lakutata/mcp,
@lakutata/dbus, @lakutata/webrtc (WebRTC: the signaling, a TURN server, a media server, peer connections, the
service actions of an application called through data channels, a browser client), @lakutata/ffi (the C functions of
native libraries, declared with the C declarations of their headers), @lakutata/math (symbolic and numeric
mathematics: equations, derivatives, integrals, limits, matrices, statistics, decimals of any precision; plain
functions, no component), @lakutata/barcode (barcodes and QR codes: 32 formats generated as PNG, SVG or pixels and
read from images; a component, Barcode), @lakutata/netif (servers and UDP sockets listening on a network interface
whatever its addresses, the interfaces of the machine and their changes; plain classes, no component; the entrypoints
that listen on a port use it through their interface option), @lakutata/mongo-embedded (the embedded MongoDB of the
mongo-embedded databases of lakutata/orm, compiled when installed), @lakutata/thermal (receipts, labels and
wristbands written in HTML, rendered to a thermal printer's dots and encoded as ESC/POS, TSPL or ZPL; plain functions),
@lakutata/thermal-printer (a component, ThermalPrinterManager, finding printers and opening them from definitions
saved as JSON; a provider, ThermalPrinter, for each), @lakutata/serial (serial ports and classic Bluetooth devices
as streams; plain functions), @lakutata/ldap (LDAP: the components LDAPClient and LDAPServer, and
DirectoryBackend keeping the entries of the server in the application's database), @lakutata/ldap-engine (the LDAP
protocol, client and server without an application; plain functions and classes). The packages with native code
(@lakutata/barcode, @lakutata/netif, @lakutata/thermal, @lakutata/serial, @lakutata/math,
@lakutata/mongo-embedded) compile it when they are installed, which needs Python 3 and a C++ compiler. The adapters
and drivers need their library installed (express, fastify, commander, socket.io, ws, pg, mysql2,
better-sqlite3, ioredis…): they are optional peer dependencies, of lakutata or of the package that uses them.
import {Application, Component, DTO, Exception, type ILogger} from 'lakutata'
import {buildEntrypoints, Controller} from 'lakutata/com/entrypoint'
import {GET, POST} from 'lakutata/decorator/ctrl'
import {Configurable, Inject} from 'lakutata/decorator/di'
import {Expect} from 'lakutata/decorator/dto'
import {expressHTTPEntrypoint, jsonEnvelope} from 'lakutata/adapter/express'
class NoteNotFoundException extends Exception {
public errno: string = 'E_NOTE_NOT_FOUND'
public readonly statusCode: number = 404
}
class NoteLimitException extends Exception {
public errno: string = 'E_NOTE_LIMIT'
public readonly statusCode: number = 409
}
//A component: one instance for the whole application, its options validated at launch
class Notes extends Component {
@Configurable(DTO.Number().integer().min(1))
protected readonly limit: number = 100
@Inject('log')
protected readonly log: ILogger
protected readonly notes: Map<number, string> = new Map()
public add(text: string): number {
if (this.notes.size >= this.limit) throw new NoteLimitException('{0} notes at most', this.limit)
const id: number = this.notes.size + 1
this.notes.set(id, text)
this.log.info('Note %d added', id)
return id
}
public get(id: number): string {
const text: string | undefined = this.notes.get(id)
if (text === undefined) throw new NoteNotFoundException('Note {id} not found', {id: id})
return text
}
}
class NoteIdDTO extends DTO {
//A route parameter is text: strict(false) converts it to a number
@Expect(DTO.Number().integer().min(1).strict(false).required())
public id: number
}
class NewNoteDTO extends DTO {
@Expect(DTO.String().min(1).max(500).required())
public text: string
}
//A controller: one instance per request
class NoteController extends Controller {
@Inject('notes')
protected readonly notes: Notes
@POST('/notes', NewNoteDTO)
public async create(input: NewNoteDTO): Promise<{ id: number }> {
return {id: this.notes.add(input.text)}
}
@GET('/notes/:id', NoteIdDTO)
public async get(input: NoteIdDTO): Promise<{ id: number, text: string }> {
return {id: input.id, text: this.notes.get(input.id)}
}
}
Application
.run(() => ({
id: 'notes.app',
name: 'Notes',
components: {
notes: {class: Notes, limit: 1000},
entrypoint: buildEntrypoints({
controllers: [NoteController],
http: expressHTTPEntrypoint({port: 8080, respond: jsonEnvelope()})
})
},
//Created at launch, in this order: nothing listens until the entrypoint is created
bootstrap: ['notes', 'entrypoint']
}))
.onLaunched((app: Application, log: ILogger): void => log.info('%s started in %s mode', app.appName, app.mode()))
.onFatalException((error: Error, log: ILogger): void => log.error('Cannot start: %s', error.message))
id and name (required), components and providers by name ({class, ...options}), objects,
bootstrap (names, classes or async functions, run in order at launch), mode, timezone. log (the Logger) and
entrypoint are preset: log: {level: 'debug'} without class configures the preset logger.jsonEnvelope(), a result is answered as {errno: null, errMsg: null, data} and an exception as
{errno, errMsg, data: null} with its statusCode; without it, the result is the body.onLaunched handler, a script), await app.getObject<Notes>('notes') gets an object.| Class | Lifetime | Use it for |
|---|---|---|
Component | @Singleton, locked | Long-lived services that own resources: connections, servers, timers, state |
Provider | @Scoped (may be @Singleton or @Transient) | Work bound to a request or a scope |
Controller | @Scoped, locked | The actions; a new instance for each request |
new on these classes: declare them and let the container create them. In tests and scripts,
create a new Container(), register what the object injects (await container.registerNamed('log', Logger)), then
create the object with its options: await container.set(Notes, {limit: 10}).@Inject properties are resolved, then @Configurable options are validated and set, then init() runs,
then startup(); once the application has launched, launched() runs (not awaited). Teardown runs
beforeDestroy(), destroys what the object created, then destroy(). These hooks are protected async methods.@Inject() takes the object named like the property, @Inject('name') a named one, @Inject(Class) the object
registered for a class (@Inject(Application), an @Autoload class), @Inject('db', (db) => …) a value derived
from it. An object declared under a name is found by that name only.@Configurable(schema) makes a property an option: its value comes from the declaration, the initializer is the
default, and an invalid value in a declaration stops the launch with InvalidObjectOptionsException (given to
getObject() or container.set(), it fails that creation with InvalidValueException). Libraries export a function
that builds the declaration (buildDatabaseOptions(), buildQueueOptions()); use them.@GET('/path', InputDTO), @CLIAction('command <arg>', InputDTO),
@ServiceAction({cmd: 'name'}, InputDTO), @Schedule('5m'), @QueueAction('queue'). One method may carry several.
A decorator does nothing without its adapter in buildEntrypoints() (http, cli, service, schedule, queue).
@QueueAction and the queue adapter (queueEntrypoint) come from lakutata/com/queue..strict(false); JSON bodies and service messages keep their types, and
the command line converts its own arguments. Under strictness .trim() refuses surrounding spaces instead of
removing them: write .trim().strict(false) to trim.InvalidValueException (E_INVALID_VALUE, HTTP 400). @Accept(schema) and
@Return(schema) validate the arguments and the result of any method at run time.Exception with an errno and a statusCode; build messages from templates
('Order {id} not found', {id}). HTTP answers with the status and {errno, errMsg}; the service transports send
the whole error, and a client recognizes it by errno (the class does not cross the call).this.context describes the request (HTTPContext, CLIContext, ServiceContext…). this.signal (typed as
optional: this.signal?.aborted) aborts when the client leaves, or when the entrypoint stops and the request is still
running after shutdownTimeout (30 seconds by default): long actions should check it. Result.status(),
Result.file() and Result.events() control HTTP responses.bootstrap: the application launches, nothing listens, and the process exits with code 0
because nothing keeps it running.buildEntrypoints() is ignored silently..strict(false) fails with "id" must be a number..js fails the build (TS2835: "Did you mean './X.js'?"); compiled by a tool that does
not check it, it fails at run time with ERR_MODULE_NOT_FOUND.notes: {class: Notes}) is found by that name only: @Inject(Notes) and
app.getObject(Notes) fail with Could not resolve 'Notes'; use @Inject('notes') and getObject('notes').npm install <package> -w app).Error reaches an HTTP client as status 500 with errno E_UNKNOWN (or its code): throw an Exception
subclass, whose errno and statusCode the client can rely on.errno, not instanceof: exception classes do not cross the call.@Configurable property declares is only warned about at launch (a Node.js warning on stderr,
not in the log), and ignored silently when given to getObject() or container.set(): check the spelling.launched() is not awaited and its errors are only logged: work that must succeed before the application serves
belongs in init() or startup().before(), on a port of its own (node --test runs files in
parallel), and calls await app.dispose() in after(), or the test run never ends. Application.run() launches
once per process.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub lakutata/lakutata --plugin lakutataOther plugins' skills for the same job