PluginBench
Skill
Pass
Audit score 90

nodejs-backend-patterns

wshobson/agents

Build production-ready Node.js backends with Express/Fastify, middleware patterns, authentication, and database integration.

What is nodejs-backend-patterns?

Comprehensive guidance for building scalable, maintainable Node.js backend applications using modern frameworks and architectural patterns. Use this when creating REST APIs, GraphQL servers, microservices, or implementing authentication, error handling, and database integration.

  • Implement middleware patterns and error handling strategies
  • Set up authentication and authorization flows
  • Design REST APIs and GraphQL backends
  • Integrate SQL and NoSQL databases with connection pooling
  • Build microservices architectures with proper separation of concerns
  • Implement real-time features using WebSockets

How to install nodejs-backend-patterns

npx skills add https://github.com/wshobson/agents --skill nodejs-backend-patterns
Prerequisites
  • Node.js runtime environment
  • Basic knowledge of Express or Fastify frameworks
  • Understanding of HTTP and REST concepts
Claude Code
Cursor
Windsurf
Cline

How to use nodejs-backend-patterns

  1. 1.Review the best practices section to understand core principles like TypeScript usage, error handling, and environment configuration
  2. 2.Read `references/details.md` for detailed pattern documentation and worked examples
  3. 3.Choose your framework (Express or Fastify) and implement middleware patterns for your use case
  4. 4.Set up input validation, authentication, and authorization layers
  5. 5.Configure database integration with connection pooling
  6. 6.Implement structured logging and monitoring
  7. 7.Add rate limiting, CORS, and security headers
  8. 8.Write unit, integration, and E2E tests using the `javascript-testing-patterns` skill

Use cases

Good for
  • Creating a REST API with Express or Fastify with proper error handling and validation
  • Building a GraphQL server with authentication and database integration
  • Designing a microservices architecture with multiple Node.js services
  • Implementing user authentication with JWT and session management
  • Setting up a real-time chat or notification system with WebSockets
Who it's for
  • Backend engineers building Node.js applications
  • Full-stack developers creating server-side logic
  • DevOps engineers designing microservices architectures
  • Teams implementing production-grade API services

nodejs-backend-patterns FAQ

Should I use Express or Fastify?

Both are valid; Express has a larger ecosystem and community, while Fastify offers better performance and modern defaults. Choose based on your performance requirements and team familiarity.

How do I handle errors properly in Node.js backends?

Create custom error classes, use consistent error response formats, implement try-catch blocks or promise error handlers, and log errors with context for debugging.

What's the recommended approach for authentication?

Use JWT tokens for stateless APIs, implement refresh token rotation, store tokens securely, validate on every protected route, and consider OAuth2 for third-party integrations.

How should I structure my database queries?

Use connection pooling to manage database connections efficiently, implement query builders or ORMs for type safety, use transactions for multi-step operations, and add proper error handling for database failures.

Where can I find more detailed implementation examples?

Detailed pattern documentation and worked examples are available in the `references/details.md` file included with this skill.

Full instructions (SKILL.md)

Source of truth, from wshobson/agents.


name: nodejs-backend-patterns description: Build production-ready Node.js backend services with Express/Fastify, implementing middleware patterns, error handling, authentication, database integration, and API design best practices. Use when creating Node.js servers, REST APIs, GraphQL backends, or microservices architectures.

Node.js Backend Patterns

Comprehensive guidance for building scalable, maintainable, and production-ready Node.js backend applications with modern frameworks, architectural patterns, and best practices.

When to Use This Skill

  • Building REST APIs or GraphQL servers
  • Creating microservices with Node.js
  • Implementing authentication and authorization
  • Designing scalable backend architectures
  • Setting up middleware and error handling
  • Integrating databases (SQL and NoSQL)
  • Building real-time applications with WebSockets
  • Implementing background job processing

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Use TypeScript: Type safety prevents runtime errors
  2. Implement proper error handling: Use custom error classes
  3. Validate input: Use libraries like Zod or Joi
  4. Use environment variables: Never hardcode secrets
  5. Implement logging: Use structured logging (Pino, Winston)
  6. Add rate limiting: Prevent abuse
  7. Use HTTPS: Always in production
  8. Implement CORS properly: Don't use * in production
  9. Use dependency injection: Easier testing and maintenance
  10. Write tests: Unit, integration, and E2E tests
  11. Handle graceful shutdown: Clean up resources
  12. Use connection pooling: For databases
  13. Implement health checks: For monitoring
  14. Use compression: Reduce response size
  15. Monitor performance: Use APM tools

Testing Patterns

See javascript-testing-patterns skill for comprehensive testing guidance.