⏳ This skill is pending AI review.

Scores will appear once the review pipeline completes.

version unknown

nestjs

@nestjs⭐ 150 stars

NestJS, the TypeScript framework for Node.js backends. How to start a project non-interactively with the Nest CLI, the project layout and module system, where the current docs are, and the mistakes agents make in Nest apps that still pass their tests. Use when creating or extending a NestJS application.

Choose how to use this skill

You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.

1. Native installer

This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.

Do not guess an installer command or replace an existing version without reviewing the diff.

2. Complete package recommended

Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.

No complete ProSkills package is published for this listing yet.

3. Prompt-only

Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.

Need only the instruction file?

Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.

No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.

—/10

// RATINGS

⭐GitHub Stars
⭐⭐⭐ 150 on GitHubGitHub ↗

Popular

🟢ProSkills Score
—
📍

Not yet listed on ClawHub or SkillsMP

// README

NestJS agent skills

Official Agent Skills for building and extending NestJS applications with coding agents. They give an agent what its training data lacks:

  • the current APIs, which are often newer than the model;
  • Nest's first-party packages;
  • the mistakes that still pass tests: a sign-in that leaks which emails exist, @IsOptional() letting null through to a 500, a rate limiter that never sees the user, an event stream that outlives a revoked key, and many more.

Each skill is a folder with a SKILL.md that holds its rules, plus references/ with longer recipes. Every recipe was run on the released packages. The skills work with any agent that reads the Agent Skills format: Claude Code, Codex, Cursor and others.

Skills

SkillUse when
nestjscreating or extending a NestJS application: starting a project, layout, module system, where the docs are, common mistakes
nestjs-featureadding or changing endpoints: where code goes, modules and providers, validation (Zod with @Body({ schema }) or class-validator), status codes, errors, HTTP options, Server-Sent Events
nestjs-authadding or changing authentication or authorization: @nestjs/authentication (passwords, sessions, tokens, API keys) and @nestjs/authorization (policies)
nestjs-dataadding or changing persistence: @nestjs/drizzle and @nestjs/typeorm, migrations, safe updates, paging, transactions
nestjs-testingwriting, running or fixing tests: unit, service and end-to-end tests, overriding providers and global guards, signing test users in
nestjs-productionpreparing for production: configuration, logs, observability with NestJS Observe, health checks, rate limiting, OpenAPI, shutdown, deployment

Agents load a skill when its description matches the task, so there's nothing to invoke by hand.

Install

The skills live in skills/. Install them for one project (committed with the code, so everyone on the team gets them) or for your user account (every project on your machine).

Any agent, with npm

npx @nestjs/skills add

copies every skill into .agents/skills/, which Codex and Cursor read. Choose where with --agent:

--agentFolderRead by
agents (default).agents/skills/Codex, Cursor and other Agent Skills readers
claude.claude/skills/Claude Code (and Cursor)
cursor.cursor/skills/Cursor
all.agents/skills/ and .claude/skills/Codex, Cursor and Claude Code at once (Cursor reads both folders)
npx @nestjs/skills add --agent claude              # Claude Code, this project
npx @nestjs/skills add --agent all                 # Codex, Cursor and Claude Code
npx @nestjs/skills add --agent agents --global     # every project on your machine (~/.agents/skills)
npx @nestjs/skills add nestjs nestjs-auth          # only some skills
npx @nestjs/skills list                            # what's in the package
npx @nestjs/skills remove                          # remove what it installed

--agent also takes several targets (--agent agents,claude or repeated). --dir <path> installs anywhere else. The installer only replaces or removes folders it installed itself (it leaves a .nestjs-skills marker in each); --force replaces a same-named folder that it didn't. Pin the version for the team with npm i -D @nestjs/skills and npx nestjs-skills add. Programmatic use: import { listSkills, skillsDir } from '@nestjs/skills'.

Claude Code

As a plugin, from this repository's marketplace:

claude plugin marketplace add nestjs/agent-skills
claude plugin install nestjs@nestjs

Or inside a session: /plugin marketplace add nestjs/agent-skills, then /plugin install nestjs@nestjs. Skills from the plugin are namespaced (nestjs:nestjs-auth).

Without the plugin: npx @nestjs/skills add --agent claude (add --global for ~/.claude/skills/).

To preconfigure a repository for your team, add this to its .claude/settings.json; each contributor still runs the install once:

{
  "extraKnownMarketplaces": {
    "nestjs": { "source": { "source": "github", "repo": "nestjs/agent-skills" } }
  },
  "enabledPlugins": { "nestjs@nestjs": true }
}

Codex

Codex reads skills from .agents/skills/ in the repository (and in parent folders up to the repository root) and from ~/.agents/skills/ for your user.

Cursor

Cursor reads skills from .agents/skills/ and .cursor/skills/ in the project, and from ~/.agents/skills/ and ~/.cursor/skills/ for your user. It also loads .claude/skills/ and .codex/skills/.

Any agent, by hand

Copy (or symlink) the skill folders to where your agent loads skills. .agents/skills/ covers Codex and Cursor at once:

git clone https://github.com/nestjs/agent-skills.git
mkdir -p .agents/skills && cp -R agent-skills/skills/* .agents/skills/

For every project on your machine, use ~/.agents/skills/ instead. A symlink (ln -s "$PWD/agent-skills/skills/nestjs-auth" ~/.agents/skills/) keeps a copy current with git pull.

Keep each folder whole: SKILL.md links to its references/ with relative paths, and the skills refer to each other by name.

Updating

  • Claude Code plugin: claude plugin marketplace update nestjs, then claude plugin update nestjs@nestjs, or turn on auto-update for the marketplace in /plugin.
  • npm: npx @nestjs/skills@latest add again: it replaces the copies it installed, dropping files a skill no longer has.
  • Copies by hand: git pull and copy the folders again (symlinked folders update with the pull).

Compatibility

Written for NestJS 12 (@nestjs/core 12.x) on Node.js 20 or later. The recipes were run on:

  • Nest 12.5.1;
  • @nestjs/authentication 0.1.6 and @nestjs/authorization 0.1.4;
  • @nestjs/drizzle 0.0.2 with Drizzle 1.0 rc, and @nestjs/typeorm 12.0.3 with TypeORM 1.1;
  • @nestjs/throttler 6.8, @nestjs/swagger 12.1, @nestjs/terminus 12.2, @nestjs/config 12.1 and @nestjs/observe 0.3.

The skills tell the agent to check the installed version and the documentation before relying on what it remembers.

Format

Each SKILL.md follows the Agent Skills specification:

  • name matches the folder;
  • description says when the skill applies, under 1,024 characters;
  • the frontmatter uses only portable fields (name, description, license, compatibility), so the same files work in every agent and can be uploaded to the Claude apps.

The repository is also a Claude Code plugin (.claude-plugin/plugin.json), its own marketplace (.claude-plugin/marketplace.json), and the npm package @nestjs/skills (the skills, the plugin manifests, and the nestjs-skills installer; no dependencies).

Contributing

Keep SKILL.md files short: rules and pitfalls in the file, longer code in references/, one level deep. Before adding an API or a pitfall, check it against the docs and run it on a released version.

Validate the frontmatter, links and versions, and test the installer:

npm run validate
npm test
claude plugin validate --strict .

A release bumps version in both package.json and .claude-plugin/plugin.json (npm run validate checks they match), then npm publish, which runs the same checks first.

License

MIT

// HOW IT'S BUILT

// FILES

3 files shipped with this skill. Inline text is the catalog copy. The upstream link is the source repository.

  • skills/nestjs/SKILL.md6.7 KB52cd3a5eb4b5upstream ↗
    ---
    name: nestjs
    description: NestJS, the TypeScript framework for Node.js backends. How to start a project non-interactively with the Nest CLI, the project layout and module system, where the current docs are, and the mistakes agents make in Nest apps that still pass their tests. Use when creating or extending a NestJS application.
    license: MIT
    compatibility: Written for NestJS 12 (@nestjs/core 12.x) on Node.js 20+.
    ---
    
    # NestJS
    
    Nest's APIs move faster than model training data, so what you remember may be a major version behind. Check before relying on memory:
    
    - Which version you're on: `npm ls @nestjs/core` in a project, `npm view @nestjs/core version` for the latest. Use the latest for a new project.
    
    - https://docs.nestjs.com/llms.txt indexes every chapter. Each chapter is plain markdown at its URL plus `.md`, e.g. https://docs.nestjs.com/controllers.md. Fetch the one chapter you need, not `llms-full.txt`. Find the page in the index rather than from memory: remembered paths (`/techniques/...`) are from older versions; most redirect to the current chapter, but some topics moved or split.
    - Nest has first-party packages for most backend needs (auth, permissions, databases, config, rate limiting, OpenAPI, health checks, queues, scheduling). Check them before writing your own or adding another library. The other skills in this package cover the common ones.
    
    ## Start a project
    
    In an empty folder:
    
    ```bash
    npx @nestjs/cli new . --skip-git --package-manager npm
    ```
    
    Without a TTY (an agent's shell) it asks nothing: it creates an ESM project with Vitest and installs dependencies. `--minimal` creates a one-file app (`src/main.ts`). `npm start` runs `nest start`, which compiles first.
    
    It also sets up `@nestjs/observe` (`--no-observe` skips it), which sends nothing until the project is linked. Once the project exists, tell the user to run `npx @nestjs/observe link` in it: they approve a code in the browser (signing up for free if needed), and it writes the key pair into `.env`. If they ask you to run it, run it with `--no-browser` in the background and pass on the address and the code it prints. Never write the keys yourself.
    
    Write modules, controllers and services as files yourself (`nestjs-feature` shows the shape); register each in its module. `nest generate` is optional: `npx nest g module|controller|service <name> --no-spec` creates a stub and registers it, which helps when you're unsure where it goes. `nest g resource` makes a CRUD scaffold of stubs, DTOs and an entity class; use it only when you want exactly that, and pass `--type rest --crud` so it doesn't prompt.
    
    The scaffold comes with an `AGENTS.md`; read it in an existing project, along with `package.json` and `nest-cli.json`.
    
    ## Layout and module system
    
    - `src/main.ts` bootstraps (`NestFactory.create(AppModule)`, global pipes, `app.listen(process.env.PORT ?? 3000)`); `src/app.module.ts` imports the feature modules.
    - One folder per feature: `src/notes/notes.module.ts`, `notes.controller.ts` (HTTP only), `notes.service.ts` (rules), a repository (queries), DTOs (`CreateNoteDto`) or schemas next to them. Share a provider by adding it to its module's `exports` and importing that module. Where code goes, how to split modules and what to avoid: `nestjs-feature`'s `references/structure.md`.
    - Projects from `nest new` are ESM (`"type": "module"`), and Nest's packages are ESM only: relative imports end in `.js` (`import { NotesService } from './notes.service.js'`), there's no `__dirname` (use `import.meta.dirname`), tests use `vi.fn()`, not `jest.fn()`. Follow what an existing project uses.
    - Run through the Nest CLI or `tsc`, not `tsx`: `tsx` emits no decorator metadata, so providers injected by type arrive as `undefined`.
    - **Never `import type` a class you inject.** Dependency injection reads the constructor's parameter types at run time; a type-only import erases them, and the app stops at startup with `Nest can't resolve dependencies of the NotesService (?)`. Linters and auto-fixers (`consistent-type-imports`) make this change on their own. The opposite holds for plain types in decorated signatures (`Request` from express, `RawBodyRequest`): with `isolatedModules`, TypeScript requires `import type` there (error TS1272).
    
    ## Mistakes that pass tests
    
    Coding agents make these in Nest apps whose tests all pass:
    
    - **Sign-in leaks which emails exist.** Hand-assembled sign-in (`@nestjs/jwt` + bcrypt) returns early for an unknown email (`if (!user || !(await bcrypt.compare(...))) throw`), so unknown emails answer faster. Use `@nestjs/authentication`'s `PasswordHasher.verify(password, user?.passwordHash)`, which checks a dummy hash when there's no user. See the `nestjs-auth` skill.
    - **`@Post()` answers 201.** A POST that creates nothing (sign-in, actions, searches) needs `@HttpCode(200)` or the code it means.
    - **`@IsOptional()` lets `null` through.** class-validator skips every rule for `null`, so `{"title": null}` reaches the database and fails with a 500. For "may be left out, not null", use `@ValidateIf((_, value) => value !== undefined)` instead. Zod's `.optional()` doesn't have this problem.
    - **A short HS256 secret.** `@nestjs/authentication`'s `accessToken.key` needs at least 32 bytes and stops the app at startup otherwise. Never hash or pad a secret to fit: tokens are then signed with a different key and whatever verifies them with the real secret rejects them. The `nestjs-auth` skill covers a secret the task fixes.
    - **The OpenAPI document leaves out its own route.** `SwaggerModule.setup()` serves the document outside Nest's router, so it isn't listed. Add it if the contract says every route is documented (`nestjs-production`).
    - **Stopping servers.** Start a server in the background, note its PID (`npm start > server.log 2>&1 & echo $!`), and stop it with `kill <pid>`, or by its port: `kill $(lsof -ti tcp:3000 -sTCP:LISTEN)`. Never `pkill -f nest` or `pkill -f "npm start"`: they match other projects' processes on the machine.
    
    A contract the task fixes (status codes, error bodies, secrets, field names) wins over a package's defaults. Adapt the package, or say what you couldn't do.
    
    When a task says how to test, follow it. When it says nothing, cover the behaviour you change with focused tests rather than broad e2e suites.
    
    ## Other skills in this package
    
    - `nestjs-feature`: modules, controllers, services, validation (Zod with `@Body({ schema })`, or class-validator), status codes, error bodies, Server-Sent Events.
    - `nestjs-auth`: `@nestjs/authentication` and `@nestjs/authorization`.
    - `nestjs-data`: `@nestjs/drizzle` and `@nestjs/typeorm`.
    - `nestjs-testing`: unit and e2e tests.
    - `nestjs-production`: config, logging, observability (NestJS Observe), health checks, rate limiting, OpenAPI, shutdown, deployment.
    
    More detail: [references/docs-map.md](references/docs-map.md) lists the docs chapter for each topic.
    
  • skills/nestjs/references/docs-map.md4.0 KB64331a323454upstream ↗
    # Where each topic is documented
    
    Every chapter is plain markdown at `https://docs.nestjs.com/<path>.md`. The full index, with each chapter's first sentence, is https://docs.nestjs.com/llms.txt. Some chapters are long (authentication is ~200 KB): fetch one and read the section you need.
    
    | Topic | Chapter | Package |
    | --- | --- | --- |
    | A first app, project files | `/first-steps` | `@nestjs/cli` |
    | CLI commands and options (`new`, `generate`, `--minimal`) | `/cli/usages` | `@nestjs/cli` |
    | Controllers, routes, status codes, `@HttpCode()` | `/controllers` | `@nestjs/common` |
    | Providers and dependency injection | `/providers`, `/fundamentals/custom-providers` | |
    | Modules, `exports`, global and dynamic modules | `/modules`, `/fundamentals/dynamic-modules` | |
    | Pipes (`ParseIntPipe`, custom pipes) | `/pipes` | |
    | Validation: `StandardSchemaValidationPipe` (Zod, Valibot, ArkType) and `ValidationPipe` (class-validator) | `/application/validation` | |
    | Guards, interceptors, exception filters | `/guards`, `/interceptors`, `/exception-filters` | |
    | Lifecycle hooks, `enableShutdownHooks()` | `/fundamentals/lifecycle-events` | |
    | Request lifecycle (order of middleware, guards, interceptors, pipes, filters) | `/faq/request-lifecycle` | |
    | Common errors ("Nest can't resolve dependencies", circular imports) | `/faq/common-errors`, `/fundamentals/circular-dependency` | |
    | Logger, JSON logs, redaction | `/application/logger` | `@nestjs/common` |
    | Tests (`Test.createTestingModule`, Vitest, Supertest) | `/fundamentals/testing` | `@nestjs/testing` |
    | Configuration and `.env` | `/application/configuration` | `@nestjs/config` |
    | Sign-in, sessions, tokens, API keys | `/security/authentication` | `@nestjs/authentication` |
    | Permissions (policies, `@Can()`) | `/security/authorization` | `@nestjs/authorization` |
    | Rate limiting | `/security/rate-limiting` | `@nestjs/throttler` |
    | Password hashing and encryption | `/security/encryption-and-hashing` | |
    | Drizzle | `/data/drizzle` | `@nestjs/drizzle` |
    | TypeORM | `/data/typeorm` | `@nestjs/typeorm` |
    | Prisma, MongoDB, Sequelize, MikroORM | `/data/prisma`, `/data/mongodb`, `/data/sequelize`, `/data/mikroorm` | |
    | Server-Sent Events | `/http/server-sent-events` | `@nestjs/common` |
    | Streaming responses (web `Response`, async generators) | `/http/streaming-responses` | |
    | Events inside the app | `/application/events` | `@nestjs/event-emitter` |
    | Scheduled jobs | `/application/task-scheduling` | `@nestjs/schedule` |
    | Queues and background jobs | `/application/queues` | `@nestjs/bullmq` |
    | Health checks | `/reliability/terminus` | `@nestjs/terminus` |
    | OpenAPI | `/openapi/introduction` | `@nestjs/swagger` |
    | Webhooks | `/http/webhooks` | `@nestjs/webhooks` |
    | Idempotency keys, outbox, locks, retries | `/reliability/idempotency`, `/reliability/outbox`, `/reliability/locks`, `/reliability/resilience` | |
    | HTTP adapters (Express, Fastify, `node:http`) and performance | `/http/performance` | |
    | Global prefix, versioning, CORS, Helmet, CSRF | `/faq/global-prefix`, `/http/versioning`, `/security/cors`, `/security/helmet`, `/security/csrf` | |
    | Raw request body (webhook signatures), keep-alive connections at shutdown | `/faq/raw-body`, `/faq/keep-alive-connections` | |
    | Deployment (build, `NODE_ENV`, Docker, scaling) | `/deployment` | |
    | Observability: overview, plans, first project | `/observability/overview` | `@nestjs/observe` |
    | Observe SDK setup and options (`createObserveModule`, `instrument`, shutdown flush, log forwarding, redaction) | `/observability/sdk` | `@nestjs/observe` |
    | Custom spans, handled errors, custom metrics (`TracerService`) | `/observability/manual-instrumentation` | `@nestjs/observe` |
    | Distributed tracing, error monitoring, production rules, MCP server for agents | `/observability/distributed-tracing`, `/observability/error-monitoring`, `/observability/production-rules`, `/observability/mcp-server` | |
    | OpenTelemetry, choosing an APM | `/observability/opentelemetry`, `/observability/choosing-an-apm` | |
    | Upgrading from older versions | `/migration-guide` | |
    
  • README.mdupstream ↗

    Contents are not inlined in the catalog. Open the upstream file.

Plain-text copy, no login: /skill-bundles/nestjs-agent-skills-skills-nestjs.md

// REPO STATS

150 stars