Nodejs Backend Patterns
ever-works/ever-works
Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices.
A skill your agent uses when building or structuring a NestJS backend — feature modules, providers and DI wiring, provider scopes and request-lifecycle order, where to bind…
$ npx skills add ericrisco/rsc-harness --skill nestjs -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ericrisco/rsc-harness nestjs --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/nestjs .claude/skills/nestjs && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "nestjs" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/nestjs into .claude/skills/nestjs/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "nestjs", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/ericrisco/rsc-harness/tree/main/skills/nestjsType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add ericrisco/rsc-harness --skill nestjs -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ericrisco/rsc-harness nestjs --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/nestjs .agents/skills/nestjs && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "nestjs" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/nestjs into .agents/skills/nestjs/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "nestjs", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ericrisco/rsc-harness --skill nestjs -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ericrisco/rsc-harness nestjs --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/nestjs .cursor/skills/nestjs && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "nestjs" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/nestjs into .cursor/skills/nestjs/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "nestjs", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/ericrisco/rsc-harness.git --path skills/nestjs--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add ericrisco/rsc-harness --skill nestjs -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ericrisco/rsc-harness nestjs --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/nestjs .gemini/skills/nestjs && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "nestjs" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/nestjs into .gemini/skills/nestjs/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "nestjs", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install ericrisco/rsc-harness nestjsInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add ericrisco/rsc-harness --skill nestjs -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/nestjs .github/skills/nestjs && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "nestjs" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/nestjs into .github/skills/nestjs/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "nestjs", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ericrisco/rsc-harness --skill nestjs -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install ericrisco/rsc-harness nestjs --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ericrisco/rsc-harness.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/nestjs .opencode/skills/nestjs && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "nestjs" agent skill from https://github.com/ericrisco/rsc-harness/tree/main/skills/nestjs into .opencode/skills/nestjs/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "nestjs", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
nestjsA skill your agent uses when building or structuring a NestJS backend — feature modules, providers and DI wiring, provider scopes and request-lifecycle order, where to bind…
Nestjs is an agent skill from ericrisco/rsc-harness. Use when building or structuring a NestJS backend — feature modules, providers and DI wiring, provider scopes and request-lifecycle order, where to bind guards/pipes/interceptors/filters, and testing with Test.createTestingModule. NOT a bare Express/Fastify service with no DI (that is nodejs), NOT framework-agnostic REST design (that is api-design).
Its SKILL.md is about 2.9k tokens, which your agent loads only when the skill is triggered. The skill folder holds 8 other files, including scripts and reference files (for example `evals/README.md`, `evals/cases.yaml` and `references/cross-cutting.md`).
It sits in Backend & APIs, covering API design. It works with NestJS, Fastify and Node.js. The repository describes itself as: Your agent invents things because it has no memory, and can't touch your database because it has no arms. rsc is the meta-harness that gives it both, plus the trade to know the… The licence is MIT.
Read from SKILL.md and the folder at commit e3d5b33. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 1 file in scripts/ (Shell), which the agent can run.
From the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names these keys or tokens, usually read from environment variables:
STRIPE_KEYFrom names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Nestjs loads about 2.9k tokens when it runs, and up to ~5.1k if it reads all its reference files. Until then it costs about 91 tokens; SKILL.md has 1,137 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from ericrisco/rsc-harness at commit e3d5b33, republished under its MIT licence (© ericrisco). 1,137 words, ~2,928 tokens.
.claude/skills/nestjs/SKILL.md (or your agent's skills folder). This skill also uses 5 other files; get the full folder from GitHub.Build server-side Node apps the way NestJS intends: feature modules, providers wired through the DI container, controllers, and a cross-cutting layer bound at a deliberate scope. This skill is about Nest-specific mechanics — how DI scopes resolve, what order the request lifecycle runs in, where to bind guards/pipes/interceptors/filters, and how to test it with Test.createTestingModule.
http service, no @Module/@Injectable → ../nodejs/SKILL.md. Nest starts the moment the DI container appears.../api-design/SKILL.md. Nest is where you implement those decisions.../prisma-orm/SKILL.md. Injecting a repo or DataSource provider stays here; designing the table does not.../testing-web/SKILL.md. The Nest harness (TestingModule, overrideProvider, Supertest bootstrap) stays here.Everything is a provider in a directed DI graph. Modules draw the boundaries of that graph — a provider is only reachable where it is provided or imported. Cross-cutting concerns (guards, interceptors, pipes, filters) are decorators bound at a scope you choose: global, controller, or route. Get those three right and the rest is plumbing.
The request lifecycle runs in a fixed order. Memorize it — most "my guard can't see the validated body" bugs are an ordering misunderstanding:
req → middleware → guards → interceptors(pre) → pipes → handler → interceptors(post) → exception filters → resSo pipes run after guards (a guard cannot read a transformed DTO), and filters catch everything thrown downstream. Source: NestJS request-lifecycle docs.
One feature module per bounded context. Rules, each with its why:
exports is the module's public API. A provider not exported is private to that module — that is the encapsulation, lean on it.imports brings in another module's exports; it does not re-declare providers. Re-declaring a provider in two modules gives you two singletons and silent state bugs.AppModule thin. It wires feature modules and global config, nothing else. A god AppModule that declares every controller becomes an untestable circular-dependency magnet.forRoot / forRootAsync) for configurable infrastructure (DB, cache, mailer) so consumers pass options instead of editing the module.// Bad — everything dumped in AppModule, no boundaries
@Module({ controllers: [OrdersController, UsersController, BillingController],
providers: [OrdersService, UsersService, BillingService, PrismaService] })
export class AppModule {}
// Good — a feature module owns its slice and exports only its public surface
@Module({
imports: [PrismaModule],
controllers: [OrdersController],
providers: [OrdersService],
exports: [OrdersService], // other modules consume the service, not the repo
})
export class OrdersModule {}Pick the custom-provider form by intent:
| Form | Use it when | Resolved by |
|---|---|---|
useClass | Default — swap implementation by class (e.g. real vs fake mailer) | Nest instantiates |
useValue | A ready object/constant: config, a mock in tests | Used as-is |
useFactory | Value needs computing or other providers (inject: [...]) | Your factory fn |
useExisting | Alias an existing token to a new token | Reuses instance |
A non-class token needs explicit injection — Nest has no type to reflect on:
const STRIPE = 'STRIPE_CLIENT';
@Module({
providers: [{
provide: STRIPE,
useFactory: (cfg: ConfigService) => new Stripe(cfg.get('STRIPE_KEY')),
inject: [ConfigService],
}],
exports: [STRIPE],
})
export class PaymentsModule {}
@Injectable()
export class CheckoutService {
constructor(@Inject(STRIPE) private readonly stripe: Stripe) {}
}forwardRef(() => X) is a last resort, not a fix — it works around a circular dependency that usually signals two modules that should share a third. Reach for the refactor first; if you must, forwardRef goes on both sides. See the anti-patterns table.
| Scope | Lifetime | Use when |
|---|---|---|
DEFAULT | Singleton (one per app) | Almost always — stateless services |
REQUEST | New instance per request | You genuinely need per-request state (@Inject(REQUEST) for the live request) |
TRANSIENT | New instance per consumer | Each injector gets its own copy |
REQUEST scope bubbles up: any provider that injects a request-scoped provider becomes request-scoped too, and so does the controller — with a real per-request instantiation cost. Default to singleton; reach for REQUEST only when you must.
@Injectable({ scope: Scope.REQUEST })
export class RequestContext {
constructor(@Inject(REQUEST) private readonly req: Request) {}
get userId() { return this.req.user?.id; }
}The classic gotcha: a request-scoped provider injected into a guard reads as undefined or stale because guards run early and the scope propagation is not what you assumed. If a guard needs request data, pull it from ExecutionContext (context.switchToHttp().getRequest()), not from an injected request-scoped service.
Pick the primitive by what it is for:
| Primitive | Job | Signature |
|---|---|---|
| Guard | Authorize — allow/deny the request | returns boolean / Promise<boolean> |
| Interceptor | Wrap the handler before and after (logging, transform, timeout, cache) | RxJS, handle().pipe(...) |
| Pipe | Validate and/or transform an input argument | returns transformed value or throws |
| Exception filter | Catch a thrown error and shape the response | catch(exception, host) |
Then pick the binding scope:
| Binding | Reach | Can inject deps? |
|---|---|---|
APP_GUARD / APP_PIPE / APP_INTERCEPTOR / APP_FILTER token in a module's providers | Global | Yes — resolved by the DI container |
@UseGuards(X) / @UsePipes(X) on controller or route | Local | Yes if you pass the class |
app.useGlobalGuards(new X()) in main.ts | Global | No — you instantiated it yourself |
The gotcha that bites everyone: app.useGlobalPipes(new ValidationPipe()) works, but a guard or pipe that needs to inject a ConfigService cannot be registered with new — Nest never resolved it. Use the APP_* token instead so the container builds it:
// Good — global AND DI-capable
@Module({
providers: [{ provide: APP_GUARD, useClass: AuthGuard }],
})
export class AppModule {}Deeper material — ExecutionContext, custom param decorators, Reflector + SetMetadata for role/@Public() guards, transform/timeout interceptors, filter shape, multiple-binding order — is in references/cross-cutting.md.
DTO + ValidationPipe + class-validator/class-transformer. The production-safe config:
// main.ts
app.useGlobalPipes(new ValidationPipe({
whitelist: true, // strip properties with no decorator
forbidNonWhitelisted: true, // 400 on unknown properties instead of silently dropping
transform: true, // coerce payloads to DTO class instances (and primitives)
}));export class CreateOrderDto {
@IsString() @IsNotEmpty()
sku: string;
@IsInt() @Min(1)
quantity: number;
}If the pipe needs to inject something, bind it globally via APP_PIPE instead of new (same DI rule as above).
Test.createTestingModule({...}).compile() returns a TestingModule you pull providers from. Decision line: unit-test a provider with its collaborators mocked; e2e-test the wired app over HTTP.
Unit — mock the collaborators:
const moduleRef = await Test.createTestingModule({
providers: [OrdersService],
})
.overrideProvider(OrderRepository)
.useValue({ findById: vi.fn().mockResolvedValue(order) })
.compile();
const service = moduleRef.get(OrdersService);e2e — boot the real app and hit it with Supertest. Replicate the global config from main.ts (pipes, filters, guards) or the test passes while prod 400s:
const app = moduleRef.createNestApplication();
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true })); // mirror main.ts
await app.init();
await request(app.getHttpServer()).post('/orders').send(body).expect(201);overrideGuard(AuthGuard).useValue({ canActivate: () => true }) lets an e2e test bypass auth. Full recipes — mocking a repo, request-scoped via resolve(), ConfigModule in tests, Vitest vs Jest — in references/testing-recipes.md.
nest g resource orders, nest g module orders, nest g service orders. It wires the module registration for you.tsc. Keep tsc for type-checking in CI.nest new historically scaffolds.| Anti-pattern | Why it hurts | Do instead |
|---|---|---|
God AppModule declaring every controller/provider | No boundaries; breeds circular deps; untestable | One feature module per bounded context, exports = public API |
new OrdersService(repo) inside a controller/service | Bypasses DI; same class becomes two unmocked instances | Constructor-inject; let the container build it |
| Business logic in the controller | Controllers should map HTTP ↔ service calls only | Push logic into a provider; controller stays thin |
Scope.REQUEST by default | Bubbles up the chain, per-request cost, surprise undefined in guards | Default singleton; REQUEST only with a real reason |
useGlobalPipes(new X()) for a pipe that needs deps | new is not DI-resolved; injected deps are undefined | Bind via APP_PIPE / APP_GUARD token in providers |
e2e test that skips main.ts globals | Green test, red prod — validation/filters not applied | Replicate global pipes/filters/guards in the e2e bootstrap |
forwardRef sprinkled to silence "circular dependency" | Hides the real coupling; fragile bootstrap order | Refactor to a shared module; forwardRef only as last resort, on both sides |
Run scripts/verify.sh [dir] to statically catch DI bypasses without a Nest install. It hard-fails only on new XxxService(...) outside test files; everything else is a warning. Exits 0 on a clean or empty target.
© ericrisco, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 5 other files (scripts, references) in skills/nestjs of ericrisco/rsc-harness.
Open the folder on GitHubat commit e3d5b33
Nestjs next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Nestjs this skillericrisco/rsc-harness | 167 | — | ~2.9k | Automated safety check: Pass | MIT | |
| Nodejs Backend Patternsever-works/ever-works | 158 | 18 repos | ~4k | Automated safety check: Pass | AGPL-3.0 | |
| Fishjam JS Server SDKsoftware-mansion-labs/skills | 291 | — | ~1.4k | Automated safety check: Pass | MIT | |
| Backend PatternshellangleZ/burn-in-cceverywhere-ralph | 112 | 17 repos | ~3.3k | Automated safety check: Pass | None | |
| AI Model NodejsTencentCloudBase/CloudBase-AI-Toolkit | 1.1k | 3 repos | ~5k | Automated safety check: Pass | MIT | |
| Senior Backendalirezarezvani/claude-skills | 28k | 1 repos | ~3.8k | Automated safety check: Pass | MIT |
ever-works/ever-works
Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices.
software-mansion-labs/skills
Node.js / TypeScript server SDK for Fishjam — backends that create rooms, mint peer tokens, listen to server notifications, and run agents.
hellangleZ/burn-in-cceverywhere-ralph
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
TencentCloudBase/CloudBase-AI-Toolkit
A skill your agent uses for Node.js backend AI via @cloudbase/node-sdk (=3.16.0) — cloud functions, CloudRun, Express/Koa/NestJS, serverless APIs, scheduled jobs, LLM proxies, agent orchestration.
alirezarezvani/claude-skills
Designs and implements backend systems including REST APIs, microservices, database architectures, authentication flows, and security hardening.
getsentry/sentry-for-ai
Full Sentry SDK setup for NestJS. An agent skill from getsentry/sentry-for-ai.
ericrisco/rsc-harness
A skill your agent uses when designing or analyzing a controlled experiment — falsifiable hypothesis, sample size from an MDE, reading significance/CI/power, CUPED, or rescuing tests that won't go…
ericrisco/rsc-harness
A skill your agent uses when making a web UI conform to WCAG 2.2 Level AA — axe-core or Lighthouse a11y violations, keyboard operability, focus management, ARIA roles/names/live regions, contrast…
ericrisco/rsc-harness
A skill your agent uses when running or fixing paid acquisition on Google or Meta — campaign structure (Performance Max, Demand Gen, Search, Advantage+), platform-fit creative, budget/scaling rules…
ericrisco/rsc-harness
A skill your agent uses when measuring whether an LLM or agent system actually got better and gating merges on it: golden sets, fixing an inflated LLM-as-judge, scoring RAG (faithfulness, contextual…
ericrisco/rsc-harness
A skill your agent uses when a creative goal must become a finished media file: pick and order generative-media models per modality — AI voiceover, image-to-video clips, score — then glue them with…
ericrisco/rsc-harness
A skill your agent uses when instrumenting product or web analytics — GA4/PostHog SDK wiring, event taxonomy, funnels, double-counted events, consent gating, PII scrubbing.
Categories
A skill your agent uses when building or structuring a NestJS backend — feature modules, providers and DI wiring, provider scopes and request-lifecycle order, where to bind…. Nestjs is an agent skill from ericrisco/rsc-harness.createTestingModule.
Nestjs fits situations like: structuring a NestJS backend — feature modules; providers and DI wiring; provider scopes and request-lifecycle order; where to bind guards/pipes/interceptors/filters.
Run `npx skills add ericrisco/rsc-harness --skill nestjs -a claude-code`. Or copy the skill folder (skills/nestjs in ericrisco/rsc-harness) into .claude/skills/nestjs in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ericrisco/rsc-harness --skill nestjs -a codex`. Or copy the skill folder (skills/nestjs in ericrisco/rsc-harness) into .agents/skills/nestjs in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ericrisco/rsc-harness --skill nestjs -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/nestjs, .gemini/skills/nestjs, .github/skills/nestjs and .opencode/skills/nestjs in your project.
Going by SKILL.md and its folder, Nestjs needs a shell for the scripts in its folder and credentials named STRIPE_KEY. Our summary lists: Node.js; A Bash shell; A credential in STRIPE_KEY.
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
Nestjs is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 2.9k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2.1k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with Nestjs: Nodejs Backend Patterns (ever-works/ever-works, 158 stars), Fishjam JS Server SDK (software-mansion-labs/skills, 291 stars), Backend Patterns (hellangleZ/burn-in-cceverywhere-ralph, 112 stars) and AI Model Nodejs (TencentCloudBase/CloudBase-AI-Toolkit, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
ericrisco (a GitHub user) maintains it in ericrisco/rsc-harness, which has 167 GitHub stars. The repository holds 227 skills in this directory. The repository was last updated on October 7, 2026.
Source: ericrisco/rsc-harness on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.