backend-dev-guidelines

Standardize Node.js/Express/TypeScript backend architecture and conventions.

Updated Nov 9, 2025
One-click install
npx skills add https://github.com/ZeroGravitySkin-Ron/Claude --skill backend-dev-guidelines-zerogravityskin-ron
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-dev-guidelines
Source: https://github.com/ZeroGravitySkin-Ron/Claude/tree/main/skills/backend-dev-guidelines
Command: npx skills add https://github.com/ZeroGravitySkin-Ron/Claude --skill backend-dev-guidelines-zerogravityskin-ron

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @clerk/express, pino, zod, @quantum/data-access, @quantum/shared-validation, @quantum/shared-types, and includes references (resource) components.

What problem does it solve?

Backend development often suffers from inconsistent patterns, poor error handling, and tightly coupled code. This Skill provides a clear, layered architecture and best practices for Node.js/Express/TypeScript microservices, ensuring maintainability, testability, and robust error management.

Core Features & Use Cases

  • Layered Architecture: Enforces separation of concerns (Routes → Controllers → Services → DAOs) for clean, testable code.
  • Structured Error Handling: Utilizes custom error classes and asyncHandler middleware for consistent, predictable error responses.
  • Zod Validation & Clerk Auth: Integrates Zod for type-safe input validation and Clerk for secure authentication.
  • Pino Logging: Implements structured logging with Pino for better observability and debugging.
  • Use Case: When developing a new API endpoint, follow this Skill to define routes, implement controllers, apply validation, handle authentication, and ensure proper error handling and logging, all within a consistent architectural framework.

Quick Start

To create a new API endpoint for user profile updates:

  1. Define the route in routes/users.ts, delegating to a controller function.
  2. Implement the controller in controllers/users.controller.ts, wrapping it with asyncHandler.
  3. Use validateRequest middleware with a Zod schema for input validation.
  4. Apply requireAuthClerk middleware to protect the route.
  5. Perform database operations using DAOs from @quantum/data-access.
  6. Log relevant events using logger.info().

Frequently Asked Questions about backend-dev-guidelines

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Node.js/Express API with proper layered architecture?

Layered architecture separates concerns across Routes, Controllers, Services, and DAOs. This Skill enforces one responsibility per layer—routes delegate to controllers, controllers use services for business logic, services call DAOs for data access—ensuring testable, maintainable code that scales with your microservices.

What's the best way to handle errors consistently in Express APIs?

Use custom error classes paired with asyncHandler middleware to catch errors uniformly across all route handlers. This approach standardizes error responses, prevents unhandled rejections, and integrates with structured logging, giving you predictable error behavior across your entire API.

How do I validate request data and authenticate users in Express with TypeScript?

Combine Zod schemas for type-safe input validation with Clerk authentication middleware. validateRequest middleware applies Zod validation to incoming data, requireAuthClerk protects routes, and both integrate seamlessly into your controller layer for secure, validated endpoints.

Can I use Prisma for database access in a layered Node.js architecture?

Yes. This Skill patterns database access through DAOs via @quantum/data-access, decoupling Prisma from your business logic. Services call DAOs instead of querying directly, making your code testable and allowing you to swap data sources without touching controllers or services.

Why should I use structured logging with Pino instead of console.log?

Structured logging with Pino outputs JSON, enabling better observability, easier parsing in production, and correlation tracking across requests. This Skill integrates Pino throughout your layers so debugging and monitoring become machine-queryable instead of text-searching logs.

Do I need to follow this architecture for small microservices?

This Skill's layered pattern scales from single endpoints to microservices. Even small services benefit from separation of concerns, consistent error handling, and validated inputs. The overhead is minimal and prevents architectural debt as your service grows.