nestjs
Skill12 starsChanged 8 days agoMITView on GitHub
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.
- Reads credentials
9 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- nestjs/typescript-starteredited, first seen Nov 30, 2026
- Ghost7802/awesome-api-skillstheir own version, first seen Nov 29, 2026
- youlaitech/youlai-skillstheir own version, first seen Nov 24, 2026
- thanhdat2508/agent-skillstheir own version, first seen Nov 22, 2026
- G1Joshi/Agent-Skillstheir own version, first seen Oct 13, 2026
- nimadorostkar/Claude-Skills-collectiontheir own version, first seen Oct 13, 2026
Other versions9 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- nestjs/typescript-starter★ 2.2k99% same
Wrote their own version · 8
- youlaitech/youlai-skills★ 72same name
- nimadorostkar/Claude-Skills-collection★ 41same name
- G1Joshi/Agent-Skills★ 15same name
- Ghost7802/awesome-api-skills★ 13same name
- nguyenchilong/claude-skills-fullstacks★ 1same name
- thanhdat2508/agent-skills★ 1same name
- conjure-3301/skills★ 0same name
- zeeshanalimughal/claude-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository41 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .claude/skills/react-doctor/AGENTS.mdAGENTS.md
- .claude/skills/vercel-react-best-practices/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ai-agent-developmentSkill
- angular-developerSkill
- api-design-principlesSkill
- aws-serverlessSkill
- brainstormingSkill
- cavemanSkill
- cognitive-doc-designSkill
- diagram-designSkill
- error-handling-patternsSkill
- frontend-designSkill
- golang-proSkill
- gsap-animationSkill
- impeccable-bridgeSkill
- impeccableSkill
- java-springbootSkill
- judgment-daySkill
- kaizenSkill
- nestjs-authSkill
- nestjs-dataSkill
- nestjs-featureSkill
- nestjs-productionSkill
- nestjs-testingSkill
- product-manager-toolkitSkill
- pr-reviewSkill
- react-doctorSkill
- security-auditSkill
- seo-auditSkill
- shadcn-uiSkill
- social-marketingSkill
- software-architectSkill
- stitch-designSkill
- systematic-debuggingSkill
- tailwind-design-systemSkill
- tddSkill
- ui-ux-pro-maxSkill
- vercel-react-best-practicesSkill
- video-productionSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 1 is distinctive, and 2 are very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 44
Run through the Nest CLI or tsc, not tsx: tsx emits no decorator metadata, so providers injected by type arrive as undefined.
- Very specific: line 56
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 …
- Distinctive: line 60
When a task says how to test, follow it.
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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/corein a project,npm view @nestjs/core versionfor 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, notllms-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:
npx @nestjs/cli new . --skip-git --package-manager npmWithout 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.tsbootstraps (NestFactory.create(AppModule), global pipes,app.listen(process.env.PORT ?? 3000));src/app.module.tsimports 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'sexportsand importing that module. Where code goes, how to split modules and what to avoid:nestjs-feature'sreferences/structure.md. - Projects from
nest neware 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(useimport.meta.dirname), tests usevi.fn(), notjest.fn(). Follow what an existing project uses. - Run through the Nest CLI or
tsc, nottsx:tsxemits no decorator metadata, so providers injected by type arrive asundefined. - Never
import typea 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 withNest 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 (Requestfrom express,RawBodyRequest): withisolatedModules, TypeScript requiresimport typethere (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'sPasswordHasher.verify(password, user?.passwordHash), which checks a dummy hash when there's no user. See thenestjs-authskill. @Post()answers 201. A POST that creates nothing (sign-in, actions, searches) needs@HttpCode(200)or the code it means.@IsOptional()letsnullthrough. class-validator skips every rule fornull, 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'saccessToken.keyneeds 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. Thenestjs-authskill 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 withkill <pid>, or by its port:kill $(lsof -ti tcp:3000 -sTCP:LISTEN). Neverpkill -f nestorpkill -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/authenticationand@nestjs/authorization.nestjs-data:@nestjs/drizzleand@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 lists the docs chapter for each topic.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

