Use when mounting a TriadJS router on Fastify (triadPlugin), Express (createTriadRouter), or Hono (createTriadHono), configuring per-request services, or choosing which adapter fits a deployment target. Fastify is the only adapter with WebSocket support.
Use when writing TriadJS BDD scenarios, wiring .given().when().then().and() chains, choosing assertion phrases, using scenario.auto() for schema-derived adversarial tests, or debugging "Unrecognized assertion" errors. Authoritative phrase table for the heuristic assertion parser.
Use when declaring TriadJS WebSocket channels with channel(), wiring onConnect/onDisconnect/handlers, typing per-connection state via the phantom witness, using ctx.broadcast/ctx.broadcastOthers/ctx.send, or implementing first-message auth for browsers.
Use when running the triad CLI — triad test, triad docs, triad gherkin, triad db generate, triad validate, triad fuzz — configuring triad.config.ts, debugging CLI errors, or understanding flag behavior.
Use when generating Drizzle ORM schemas from TriadJS models via triad db generate, choosing a dialect (sqlite/postgres/mysql), declaring .storage() hints on fields, designing repositories around the generated tables, or handling isUniqueViolation for domain-level conflict detection.
Use when declaring TriadJS HTTP endpoints with endpoint(), wiring request/responses/handler/beforeHandler, building a router with createRouter and router.context() bounded contexts, designing auth via beforeHandler, or debugging ctx.respond/ctx.state/ctx.services.
Use when designing TriadJS schemas — t.model(), t.value(), primitives (t.string, t.int32, t.enum, t.datetime, t.file), collections (t.array, t.record, t.tuple, t.union), model operations (.pick, .omit, .partial, .extend, .merge, .named), or DDD entities and value objects. Loaded by using-triadjs when schema work is…
Use when wiring dependency injection for TriadJS — declaring services, module-augmenting ServiceContainer, creating createServices() factories, and threading repositories/clients onto ctx.services with full type inference and no casts.
Use when wiring the TriadJS test runner — triad.config.ts, test-setup.ts default-exported services factory, per-scenario DB isolation, teardown, fixtures, and scenario.auto() for schema-derived adversarial tests. Tests run in-process — no HTTP, no adapter middleware.
Use whenever the user mentions TriadJS, the @triadjs/ packages, t.model(), endpoint(), channel(), scenario(), triad test, triad docs, or asks to build a TypeScript backend with validation + OpenAPI + BDD tests from one definition. Overview of the framework and pointer to the focused sub-skills.