Index of every page on this site: llms.txt
All skills
amirtaherkhani avatar

/nestjs-features-performance

@8272374
Run it yourself

Selects and implements NestJS runtime features, error and API contracts, security, testing, DevOps, performance, and safe scale. Use for middleware, guards, pipes, interceptors, exception filters, typed failures/results, Problem Details, validation errors, HTTP/GraphQL/RPC/gRPC/WebSocket error mapping, deadlines, cancellation, retry classification, fatal process errors, authentication, authorization, caching, queues, schedulers, CI/CD, containers, Kubernetes, configuration and secrets, migrations, supply-chain controls, health probes, logs/metrics/traces, SLOs and alerts, incident recovery, rollout and rollback, event-loop or database bottlenecks, load tests, horizontal scaling, idempotency, backpressure, and graceful shutdown. Do not use for frontend-only performance or non-NestJS services. When other skills also apply, reconcile ownership before mutation.

Use this Skill: https://skilld.dev/gh/amirtaherkhani/nestjs-skills/nestjs-features-performance

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencessecurity.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Security Rules

Apply defense in depth at every untrusted boundary. Security choices depend on the clients, data, threats, deployment, and installed versions; no single guard, JWT library, or validation pipe secures an application by itself.

Establish the threat model

Identify trust boundaries, exposed transports, identities, tenants, sensitive data, privileged operations, outbound network access, uploaded content, webhook callers, proxies, and dependency versions. Preserve security controls already required by the repository or platform.

Validate and bound input

  • Define DTO or schema allow-lists for body, path, query, message, job, configuration, and webhook input.
  • Reject or intentionally strip unknown fields; make coercion, nullability, defaults, and nested validation explicit.
  • Bound body size, strings, arrays, pages, filters, files, decompression, regex work, and GraphQL depth/complexity.
  • Use parameterized ORM/driver APIs. Validation is not a substitute for injection-safe queries.
  • Validate according to business meaning as well as syntax, and re-check authorization after resolving the target resource.

Nest's ValidationPipe is one framework mechanism. Verify global and route-specific options because transform, whitelist, and forbidNonWhitelisted change behavior.

Separate authentication and authorization

  • Authentication establishes a principal; authorization decides whether that principal may perform this action on this resource.
  • Use guards and route metadata for coarse policy, then enforce ownership, tenant, state, and field rules in the application operation or policy that has the required data.
  • Default sensitive routes to denied when policy metadata or identity is missing.
  • Test cross-tenant and horizontal privilege escalation, not only anonymous access.

JWT is one credential format, not a universal authentication architecture. When used, verify signature and allowed algorithm, issuer, audience, expiry/not-before, key selection, rotation, storage, and revocation/session policy. Do not accept algorithm choice from an untrusted token or build custom cryptography.

Protect secrets and sessions

  • Load secrets from the deployment's secret mechanism and validate required configuration at startup.
  • Never commit, log, trace, return, or embed server secrets in client bundles.
  • Rotate keys and credentials with an overlap plan.
  • For browser cookies, deliberately configure Secure, HttpOnly, SameSite, domain/path, expiry, CSRF defense, and trusted origins.
  • For bearer tokens, account for exfiltration, replay, audience, and client storage risk.

Control output and browser exposure

Return explicit response DTOs or projections and allow-list fields. Do not serialize ORM entities with credentials, reset tokens, internal flags, or private relations.

Serialization controls data exposure; it is not universal XSS prevention. Encode output for its eventual HTML/URL/JavaScript context at the renderer. Sanitize only when intentionally accepting rich content, with a maintained context-appropriate sanitizer.

Configure CORS, proxy trust, security headers, redirects, and cache headers for the actual deployment. CORS is a browser policy, not authentication.

Defend abusive and risky features

  • Rate-limit by an appropriate identity, tenant, route cost, and trusted client IP. Use shared state when limits must span replicas and account for proxy configuration.
  • Treat rate limiting as one abuse control, not complete DDoS protection.
  • Verify webhook signatures over the required raw bytes, enforce freshness/replay policy, and rotate secrets.
  • Restrict outbound URLs to prevent SSRF; validate scheme, resolved destination, redirects, and network ranges according to policy.
  • Scan and isolate uploads, generate server-side names, bound size/type, and never trust the original filename or content type alone.
  • Apply timeouts and resource bounds to expensive cryptography, parsing, queries, and external calls.

Operate securely

Use structured audit events for privileged actions without placing secrets or unnecessary personal data in logs. Patch supported runtime and dependency versions, review advisories, minimize production privileges, and keep database/broker/cloud credentials scoped to the owning service.

Verification gate

  • Unit-test policies and ownership decisions.
  • E2E-test unauthenticated, forbidden, cross-tenant, malformed, oversized, replayed, and rate-limited requests.
  • Test response field allow-lists and log redaction.
  • Scan dependencies and container artifacts in CI, then triage results rather than treating a scan as proof of safety.
  • Perform focused manual or automated security testing for uploads, webhooks, outbound URLs, rich content, and privileged flows.

This reference owns disclosure and redaction requirements. Error handling owns failure taxonomy and transport mapping; a mapper must satisfy these security rules rather than creating a separate disclosure policy.

Use current official guidance for NestJS authentication, authorization, rate limiting, validation, and serialization, plus the OWASP REST Security and Input Validation cheat sheets.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning3d3 checks · Risk SAFE
  • Gen Agent Trust Hub4d

    This skill provides extensive architectural, operational, and security guidance for developing and scaling NestJS applications. It contains best practices for error handling, performance diagnosis, CI/CD, and deployment. No malicious behavior or security risks were identified.

  • Socket3d

    No alerts

  • Snyk4d

    Risk: MEDIUM · 1 issue

Signed by skilld at 8272374. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 4 days ago.

Activeupdated 5 days ago
metadata
{
  "author": "amirtaherkhani",
  "version": "1.5.0"
}

README badge

README badge for amirtaherkhani/nestjs-skills/nestjs-features-performance