agentsclimarketplace

Nestjs exception filters

Skill dkmqflx/nestjs-best-practices-plugin/plugins/nestjs-best-practices/skills/nestjs-exception-filters

Claude Code plugin: 12 NestJS best-practice skills (90 rules) grounded in the official NestJS docs

Install
npx -y skills add dkmqflx/nestjs-best-practices-plugin --skill nestjs-exception-filters

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

NestJS exception handling and filters best practices. Use when handling errors in NestJS — throwing HTTP exceptions, custom exception classes, or global exception filters. Triggers on HttpException, BadRequestException, @Catch, ExceptionFilter, or error response shape.

The file declares its own license as MIT. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.

SKILL.md

2.6 KB, as published. Nobody here has run it

NestJS Exception Handling & Filters

NestJS ships a built-in exceptions layer that catches unhandled exceptions and turns them into a sensible HTTP response. Lean on it: throw exceptions from your business logic and let filters shape the response. These rules cover throwing the right exception, modeling domain errors, and centralizing error formatting with global filters — for NestJS v10/v11.

When to Apply

  • Throwing errors from controllers, services, guards, pipes, or interceptors.
  • Designing custom/domain exception classes.
  • Building a global exception filter (APP_FILTER) or a catch-all filter.
  • Standardizing the JSON error body returned to clients.
  • Reviewing code that manually builds error responses on res.

Rules

RuleImpactSummary
use-builtin-http-exceptionsHIGHThrow BadRequestException/NotFoundException etc. instead of generic Error.
domain-exception-classesMEDIUMModel domain errors as custom classes extending HttpException.
global-exception-filterHIGHRegister a global filter via APP_FILTER for consistent formatting.
catch-all-unknown-errorsHIGHUse a @Catch() catch-all filter to map unknown errors to 500.
dont-leak-internal-detailsCRITICALNever expose stack traces, SQL, or secrets; log them server-side only.
consistent-error-shapeMEDIUMReturn a uniform JSON error body across the API.
throw-dont-return-errorsHIGHLet exceptions propagate to filters; don't hand-craft res in handlers.

How to Use

  1. In handlers/services, throw built-in or domain exceptions — never construct the HTTP response by hand.
  2. Add one global catch-all filter (APP_FILTER) that formats every error into your standard shape and maps unknown errors to 500.
  3. In that filter, log full internals server-side and return only safe, client-facing fields.
  4. Skim the rule files above for the incorrect/correct examples before writing or reviewing error-handling code.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.