/mokata:backend-nestjsfrom mokata
Enforces NestJS best practices for modules, guards, DTOs, and providers. Loaded when the spec's routing or domain constraint names backend-nestjs, or when changes touch NestJS core files.
Ships in mokata. 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.
mokata Agent Skill. This is mokata's
backend-nestjsdomain knowledge. mokata LOADS it — it is routed by the approved spec'sdomains(classified from the approach's graph surface and the touched package's declared dependencies), not by matching words in a prompt. It enriches develop and review and feeds the blast-radius walk that already runs there. mokata's non-negotiables still hold — durable writes are human-gated, and a contract change is walked to its callers first.
⛭ mokata backend-nestjs active — gate: a contract change is walked to its callers before it lands; the decision is recorded to memory + the ledger
This file is an INDEX. Each rule lives in its own file under references/ with an impact level,
the version branch it applies to, an Incorrect and a Correct example, and how to verify it.
Open only the rules the change touches.
Read the touched package's package.json for the @nestjs/core major, the HTTP platform
(@nestjs/platform-express or @nestjs/platform-fastify), the test runner and the validation
library in use. Version facts and defaults belong to the official docs (https://docs.nestjs.com/)
for that major, not to this pack. What you could not confirm there is UNVERIFIED, and you say so.
dto-is-a-runtime-class becomes "the schema is a runtime value"), test setup follows the
project's runner, and import paths follow ESM resolution. Which major made which change is
UNVERIFIED here — read the release notes for the version the project pins.| Impact | Rule (file in references/) |
|---|---|
| CRITICAL | authorize-in-guards-not-middleware.md — authorization belongs in guards, every route guarded or explicitly public |
| CRITICAL | dto-is-a-runtime-class.md — a DTO imported with import type silently disables validation |
| CRITICAL | validation-rejects-unknown-fields.md — the global validation pipe strips and rejects unknown fields |
| HIGH | verify-every-jwt-claim.md — pin the algorithm, audience and issuer when verifying tokens |
| HIGH | request-scope-bubbles-up.md — a request-scoped provider makes every dependant request-scoped |
| HIGH | no-barrels-between-modules.md — barrel imports between modules create cycles that forwardRef only hides |
| MEDIUM | provide-what-you-inject.md — every injected provider is provided or exported by an imported module |
| MEDIUM | errors-as-http-exceptions.md — map failures to HTTP exceptions; never leak internals in responses |
| MEDIUM | test-with-a-testing-module.md — unit tests build a testing module and override providers; e2e drives HTTP |
mokata query callers <symbol>) before you edit, then write the failing test.security skill.This skill feeds the blast-radius instrument: a contract change is walked to its callers before it lands, and the decision is recorded. A static "every route is guarded" check is not part of this skill; until such a check is backed in code, rule 1 is review discipline, and this skill never claims a gate passed that does not exist.
This guidance runs inside a pipeline phase. If that phase appears stuck, or the harness stops it mid-run: run mokata resume (where the run stands and the gate that still applies) and mokata approve --list (anything waiting on a human). Nothing is lost — run state, approvals and the audit ledger are on disk — so re-invoke the phase to continue; mokata doctor names a hung MCP server or a hook that is not firing.
| Rationalization | Reality |
|---|---|
| "The auth middleware already checks the token." | Middleware runs before routing details are settled and is path-matched by the adapter; authorization in a guard is the layer that sees the resolved handler. |
"import type is cleaner for the DTO." | The type disappears at runtime, so the validation pipe has no class to validate against — every field passes. |
| "Unknown fields are harmless, we ignore them." | Without whitelisting they reach the service; mass-assignment is exactly an unexpected field written to the database. |
"forwardRef fixed the circular import." | It hid it. The cycle is a module boundary problem; split or invert the dependency. |
| "REQUEST scope is just a bit slower." | It is transitive: every provider and controller depending on it becomes per-request too. |
Evidence, not "seems right" — check every box or say which is unmet and why:
@nestjs/core major, platform and test runner were READ from the project (cited)import typereferences/authorize-in-guards-not-middleware.md, references/dto-is-a-runtime-class.md, references/validation-rejects-unknown-fields.md — the CRITICAL rulesreferences/verify-every-jwt-claim.md, references/request-scope-bubbles-up.md, references/no-barrels-between-modules.md — the HIGH rulesreferences/provide-what-you-inject.md, references/errors-as-http-exceptions.md, references/test-with-a-testing-module.md — the MEDIUM rulesCAN
file:line and the rule file it breaksMUST NOT
DEPENDS ON
backend-nestjs domain (routed at emit from the graph surface + package.json; amend-in if reached late) (advisory)Grounding:
(gate: …)boundaries are enforced by that gate in code;(advisory)ones are protocol discipline this skill follows, not a hard block.
references/authorize-in-guards-not-middleware.md (opens in a new tab)references/dto-is-a-runtime-class.md (opens in a new tab)references/errors-as-http-exceptions.md (opens in a new tab)references/no-barrels-between-modules.md (opens in a new tab)references/provide-what-you-inject.md (opens in a new tab)references/request-scope-bubbles-up.md (opens in a new tab)references/test-with-a-testing-module.md (opens in a new tab)references/validation-rejects-unknown-fields.md (opens in a new tab)references/verify-every-jwt-claim.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Engage when mokata's per-turn routing or `spec show` names `backend-nestjs` for this run, when the spec's `domains` constraint names `backend-nestjs`, or when the approach's blast radius touches a controller, module, provider, guard, pipe or DTO file in a package that depends on `@nestjs/core`. Do NOT engage for a plain Express, Fastify or Koa server without NestJS, for a frontend-only change, or for a TypeScript library that does not depend on `@nestjs/core`.
Three short reads, in order
30 skills in this plugin
/apimokata · API & interface design — contract-first, blast-radius on every change./brainstormmokata · Socratic pre-spec exploration — explore approaches WITH the user, one question at a time, and HARD-GATE the spec behind explicit approval. Runs standalone or as the front of mokata's pipeline./browser-testingmokata · Browser testing (DevTools) — live runtime captured via the existing MCP surface, fed to the test gate./bugmokata · Start from a reproducer and a failing test, then fix./ci-cdmokata · CI/CD & automation — the quality-gate pipeline + Scorecard posture, not a suggestion.npx claudepluginhub jasgujral/mokata-oss --plugin mokataOther plugins' skills for the same job