backend-dev-guidelines

Enforces layered architecture and error handling standards for Node.js Express backend services.

Updated Jun 12, 2026
One-click install
npx skills add https://github.com/bilacchi/agents-skills --skill backend-dev-guidelines-bilacchi
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: backend-dev-guidelines
Source: https://github.com/bilacchi/agents-skills/tree/main/skills/backend-dev-guidelines
Command: npx skills add https://github.com/bilacchi/agents-skills --skill backend-dev-guidelines-bilacchi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Backend codebases often drift into inconsistent patterns: business logic leaking into routes, direct database calls in controllers, unvalidated input, and silent error swallowing. This Skill enforces a strict, production-grade architecture doctrine so every route, controller, service, and repository follows the same predictable, testable, and observable structure. ## Core Features & Use Cases - Layered Architecture Enforcement: Mandates the Routes → Controllers → Services → Repositories flow with no layer skipping, plus strict naming conventions and dependency injection rules. - BFRI Risk Scoring: Provides a Backend Feasibility & Risk Index to assess architectural fit, data risk, and testability before implementing features. - Observability & Validation Standards: Requires Sentry error capture, Zod input validation, unifiedConfig-based configuration, and asyncErrorWrapper for all async handlers. - Use Case: When asked to add a new Express endpoint with Prisma database access, the Skill produces a clean route delegating to a BaseController-based controller, a service with business rules, a repository for queries, Zod validation, and Sentry-instrumented error handling. ## Quick Start Ask the AI to create a new Express endpoint for user management following the backend guidelines, including the controller, service, repository, and Zod validation.

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 backend with clean architecture?▼

Use a layered flow of Routes → Controllers → Services → Repositories → Database. Routes only register paths and middleware, controllers handle request/response via a BaseController, services contain business logic, and repositories encapsulate all Prisma queries.

How to handle errors in Express async route handlers?▼

Wrap every async route handler with an asyncErrorWrapper that forwards errors to next(), then register a central error boundary middleware after all routes. Capture every error to Sentry and never swallow exceptions or use console.log for failures.

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

No. Direct process.env usage lacks type safety, validation, and defaults. Centralize all configuration in a unifiedConfig module that validates values at startup and provides typed access throughout the codebase.

When should I use the repository pattern with Prisma?▼

Use repositories when queries are complex, reused across services, need caching, or must be mocked in tests. Repositories encapsulate Prisma operations, handle transactions, and expose intent-based methods like findActiveUsers instead of raw queries.

Why is business logic in Express routes a problem?▼

Business logic in routes is hard to test, reuse, and debug because it is tied to HTTP concerns. Moving it into framework-agnostic services makes it unit-testable via dependency injection and keeps routes to a few readable lines.