backend-dev-guidelines

Enforces layered architecture patterns for Node.js Express TypeScript microservices.

Updated Dec 1, 2025
One-click install
npx skills add https://github.com/Boulea7/ohmyclaude --skill backend-dev-guidelines-boulea7
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: backend-dev-guidelines
Source: https://github.com/Boulea7/ohmyclaude/tree/main/src/ohmyclaude/templates/skills/backend-dev-guidelines
Command: npx skills add https://github.com/Boulea7/ohmyclaude --skill backend-dev-guidelines-boulea7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Backend microservices often drift into inconsistent patterns: business logic leaks into routes, configuration is scattered across process.env calls, and error handling is missing or ad hoc. This Skill provides a complete, opinionated guide for building Node.js/Express/TypeScript services with a consistent layered architecture. ## Core Features & Use Cases - Layered Architecture Enforcement: Guides routes → controllers → services → repositories separation with BaseController patterns, dependency injection, and repository-based data access via Prisma. - Operational Standards: Covers Sentry error tracking and performance monitoring, Zod input validation, unifiedConfig configuration management, middleware patterns (auth, audit with AsyncLocalStorage, error boundaries), and async error handling. - Use Case: When asked to add a new REST endpoint to an Express microservice, the Skill ensures the route delegates to a BaseController subclass, input is validated with Zod, business logic lives in a service, database access goes through a repository, and all errors are captured to Sentry. ## Quick Start Ask the AI to create a new Express route, controller, and service for a resource following the backend development guidelines.

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 an Express TypeScript microservice with clean architecture?▼

Organize code into four layers: routes handle only routing and middleware registration, controllers extend a BaseController for request handling, services contain business logic with dependency injection, and repositories encapsulate Prisma data access. Each layer has exactly one responsibility.

How to handle errors in Express async route handlers?▼

Wrap async handlers with an asyncErrorWrapper utility that forwards errors to Express error middleware via next(error). Register the error boundary after all routes, capture every exception to Sentry, and use custom error classes like NotFoundError or ValidationError with proper HTTP status codes.

Should I use process.env directly in Node.js backend code?▼

No. Use a unifiedConfig module that reads from a config file with environment variable fallbacks, validates values at startup, and provides type-safe access. Direct process.env usage causes typos, missing defaults, and untestable configuration scattered across the codebase.

How do I prevent N+1 queries with Prisma?▼

Use Prisma's include option to fetch related records in a single query, or batch queries with the in operator when includes are impractical. Limit selected fields with select and avoid deeply nested includes that fetch unnecessary data.

When should I use the repository pattern versus direct Prisma calls?▼

Use repositories for complex queries with joins, queries reused in multiple places, or when you need caching and easy test mocking. Skip repositories for simple one-off queries or early prototyping where the abstraction adds no value.

How do I integrate Sentry error tracking in an Express service?▼

Create an instrument.ts file that initializes Sentry with integrations and PII scrubbing, and import it first in server.ts. Register Sentry request handlers before routes and error handlers after routes, then capture exceptions in controllers via BaseController.handleError.