
Backend Dev Guidelines
- 44 installs
- 16 repo stars
- Updated November 20, 2025
- jackspace/claudeskillz
This is a copy of backend-dev-guidelines by davila7 - installs and ranking accrue to the original listing.
Helps with backend & apis tasks.
About
backend-dev-guidelines is a Claude Code skill for backend & apis. It helps solo builders move faster with AI-assisted coding.
- backend-dev-guidelines
- Backend & APIs
- AI-coding skill
Backend Dev Guidelines by the numbers
- 44 all-time installs (skills.sh)
- Data as of Aug 2, 2026 (Skillselion catalog sync)
npx skills add https://github.com/jackspace/claudeskillz --skill backend-dev-guidelinesAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 44 |
|---|---|
| repo stars | ★ 16 |
| Last updated | November 20, 2025 |
| Repository | jackspace/claudeskillz ↗ |
What it does
Helps with backend & apis tasks.
Files
Backend Development Guidelines
Purpose
Establish consistency and best practices across backend microservices (blog-api, auth-service, notifications-service) using modern Node.js/Express/TypeScript patterns.
When to Use This Skill
Automatically activates when working on:
- Creating or modifying routes, endpoints, APIs
- Building controllers, services, repositories
- Implementing middleware (auth, validation, error handling)
- Database operations with Prisma
- Error tracking with Sentry
- Input validation with Zod
- Configuration management
- Backend testing and refactoring
---
Quick Start
New Backend Feature Checklist
- [ ] Route: Clean definition, delegate to controller
- [ ] Controller: Extend BaseController
- [ ] Service: Business logic with DI
- [ ] Repository: Database access (if complex)
- [ ] Validation: Zod schema
- [ ] Sentry: Error tracking
- [ ] Tests: Unit + integration tests
- [ ] Config: Use unifiedConfig
New Microservice Checklist
- [ ] Directory structure (see architecture-overview.md)
- [ ] instrument.ts for Sentry
- [ ] unifiedConfig setup
- [ ] BaseController class
- [ ] Middleware stack
- [ ] Error boundary
- [ ] Testing framework
---
Architecture Overview
Layered Architecture
HTTP Request
↓
Routes (routing only)
↓
Controllers (request handling)
↓
Services (business logic)
↓
Repositories (data access)
↓
Database (Prisma)Key Principle: Each layer has ONE responsibility.
See architecture-overview.md for complete details.
---
Directory Structure
service/src/
├── config/ # UnifiedConfig
├── controllers/ # Request handlers
├── services/ # Business logic
├── repositories/ # Data access
├── routes/ # Route definitions
├── middleware/ # Express middleware
├── types/ # TypeScript types
├── validators/ # Zod schemas
├── utils/ # Utilities
├── tests/ # Tests
├── instrument.ts # Sentry (FIRST IMPORT)
├── app.ts # Express setup
└── server.ts # HTTP serverNaming Conventions:
- Controllers:
PascalCase-UserController.ts - Services:
camelCase-userService.ts - Routes:
camelCase + Routes-userRoutes.ts - Repositories:
PascalCase + Repository-UserRepository.ts
---
Core Principles (7 Key Rules)
1. Routes Only Route, Controllers Control
// ❌ NEVER: Business logic in routes
router.post('/submit', async (req, res) => {
// 200 lines of logic
});
// ✅ ALWAYS: Delegate to controller
router.post('/submit', (req, res) => controller.submit(req, res));2. All Controllers Extend BaseController
export class UserController extends BaseController {
async getUser(req: Request, res: Response): Promise<void> {
try {
const user = await this.userService.findById(req.params.id);
this.handleSuccess(res, user);
} catch (error) {
this.handleError(error, res, 'getUser');
}
}
}3. All Errors to Sentry
try {
await operation();
} catch (error) {
Sentry.captureException(error);
throw error;
}4. Use unifiedConfig, NEVER process.env
// ❌ NEVER
const timeout = process.env.TIMEOUT_MS;
// ✅ ALWAYS
import { config } from './config/unifiedConfig';
const timeout = config.timeouts.default;5. Validate All Input with Zod
const schema = z.object({ email: z.string().email() });
const validated = schema.parse(req.body);6. Use Repository Pattern for Data Access
// Service → Repository → Database
const users = await userRepository.findActive();7. Comprehensive Testing Required
describe('UserService', () => {
it('should create user', async () => {
expect(user).toBeDefined();
});
});---
Common Imports
// Express
import express, { Request, Response, NextFunction, Router } from 'express';
// Validation
import { z } from 'zod';
// Database
import { PrismaClient } from '@prisma/client';
import type { Prisma } from '@prisma/client';
// Sentry
import * as Sentry from '@sentry/node';
// Config
import { config } from './config/unifiedConfig';
// Middleware
import { SSOMiddlewareClient } from './middleware/SSOMiddleware';
import { asyncErrorWrapper } from './middleware/errorBoundary';---
Quick Reference
HTTP Status Codes
| Code | Use Case |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Server Error |
Service Templates
Blog API (✅ Mature) - Use as template for REST APIs Auth Service (✅ Mature) - Use as template for authentication patterns
---
Anti-Patterns to Avoid
❌ Business logic in routes ❌ Direct process.env usage ❌ Missing error handling ❌ No input validation ❌ Direct Prisma everywhere ❌ console.log instead of Sentry
---
Navigation Guide
| Need to... | Read this |
|---|---|
| Understand architecture | architecture-overview.md |
| Create routes/controllers | routing-and-controllers.md |
| Organize business logic | services-and-repositories.md |
| Validate input | validation-patterns.md |
| Add error tracking | sentry-and-monitoring.md |
| Create middleware | middleware-guide.md |
| Database access | database-patterns.md |
| Manage config | configuration.md |
| Handle async/errors | async-and-errors.md |
| Write tests | testing-guide.md |
| See examples | complete-examples.md |
---
Resource Files
architecture-overview.md
Layered architecture, request lifecycle, separation of concerns
routing-and-controllers.md
Route definitions, BaseController, error handling, examples
services-and-repositories.md
Service patterns, DI, repository pattern, caching
validation-patterns.md
Zod schemas, validation, DTO pattern
sentry-and-monitoring.md
Sentry init, error capture, performance monitoring
middleware-guide.md
Auth, audit, error boundaries, AsyncLocalStorage
database-patterns.md
PrismaService, repositories, transactions, optimization
configuration.md
UnifiedConfig, environment configs, secrets
async-and-errors.md
Async patterns, custom errors, asyncErrorWrapper
testing-guide.md
Unit/integration tests, mocking, coverage
complete-examples.md
Full examples, refactoring guide
---
Related Skills
- database-verification - Verify column names and schema consistency
- error-tracking - Sentry integration patterns
- skill-developer - Meta-skill for creating and managing skills
---
Skill Status: COMPLETE ✅ Line Count: < 500 ✅ Progressive Disclosure: 11 resource files ✅
{
"sections": {
"Quick Start": "### New Backend Feature Checklist\r\n\r\n- [ ] **Route**: Clean definition, delegate to controller\r\n- [ ] **Controller**: Extend BaseController\r\n- [ ] **Service**: Business logic with DI\r\n- [ ] **Repository**: Database access (if complex)\r\n- [ ] **Validation**: Zod schema\r\n- [ ] **Sentry**: Error tracking\r\n- [ ] **Tests**: Unit + integration tests\r\n- [ ] **Config**: Use unifiedConfig\r\n\r\n### New Microservice Checklist\r\n\r\n- [ ] Directory structure (see [architecture-overview.md](architecture-overview.md))\r\n- [ ] instrument.ts for Sentry\r\n- [ ] unifiedConfig setup\r\n- [ ] BaseController class\r\n- [ ] Middleware stack\r\n- [ ] Error boundary\r\n- [ ] Testing framework\r\n\r\n---",
"Related Skills": "- **database-verification** - Verify column names and schema consistency\r\n- **error-tracking** - Sentry integration patterns\r\n- **skill-developer** - Meta-skill for creating and managing skills\r\n\r\n---\r\n\r\n**Skill Status**: COMPLETE ✅\r\n**Line Count**: < 500 ✅\r\n**Progressive Disclosure**: 11 resource files ✅",
"Common Imports": "```typescript\r\n// Express\r\nimport express, { Request, Response, NextFunction, Router } from 'express';\r\n\r\n// Validation\r\nimport { z } from 'zod';\r\n\r\n// Database\r\nimport { PrismaClient } from '@prisma/client';\r\nimport type { Prisma } from '@prisma/client';\r\n\r\n// Sentry\r\nimport * as Sentry from '@sentry/node';\r\n\r\n// Config\r\nimport { config } from './config/unifiedConfig';\r\n\r\n// Middleware\r\nimport { SSOMiddlewareClient } from './middleware/SSOMiddleware';\r\nimport { asyncErrorWrapper } from './middleware/errorBoundary';\r\n```\r\n\r\n---",
"Anti-Patterns to Avoid": "❌ Business logic in routes\r\n❌ Direct process.env usage\r\n❌ Missing error handling\r\n❌ No input validation\r\n❌ Direct Prisma everywhere\r\n❌ console.log instead of Sentry\r\n\r\n---",
"Navigation Guide": "| Need to... | Read this |\r\n|------------|-----------|\r\n| Understand architecture | [architecture-overview.md](architecture-overview.md) |\r\n| Create routes/controllers | [routing-and-controllers.md](routing-and-controllers.md) |\r\n| Organize business logic | [services-and-repositories.md](services-and-repositories.md) |\r\n| Validate input | [validation-patterns.md](validation-patterns.md) |\r\n| Add error tracking | [sentry-and-monitoring.md](sentry-and-monitoring.md) |\r\n| Create middleware | [middleware-guide.md](middleware-guide.md) |\r\n| Database access | [database-patterns.md](database-patterns.md) |\r\n| Manage config | [configuration.md](configuration.md) |\r\n| Handle async/errors | [async-and-errors.md](async-and-errors.md) |\r\n| Write tests | [testing-guide.md](testing-guide.md) |\r\n| See examples | [complete-examples.md](complete-examples.md) |\r\n\r\n---",
"Purpose": "Establish consistency and best practices across backend microservices (blog-api, auth-service, notifications-service) using modern Node.js/Express/TypeScript patterns.",
"Quick Reference": "### HTTP Status Codes\r\n\r\n| Code | Use Case |\r\n|------|----------|\r\n| 200 | Success |\r\n| 201 | Created |\r\n| 400 | Bad Request |\r\n| 401 | Unauthorized |\r\n| 403 | Forbidden |\r\n| 404 | Not Found |\r\n| 500 | Server Error |\r\n\r\n### Service Templates\r\n\r\n**Blog API** (✅ Mature) - Use as template for REST APIs\r\n**Auth Service** (✅ Mature) - Use as template for authentication patterns\r\n\r\n---",
"When to Use This Skill": "Automatically activates when working on:\r\n- Creating or modifying routes, endpoints, APIs\r\n- Building controllers, services, repositories\r\n- Implementing middleware (auth, validation, error handling)\r\n- Database operations with Prisma\r\n- Error tracking with Sentry\r\n- Input validation with Zod\r\n- Configuration management\r\n- Backend testing and refactoring\r\n\r\n---",
"Core Principles (7 Key Rules)": "### 1. Routes Only Route, Controllers Control\r\n\r\n```typescript\r\n// ❌ NEVER: Business logic in routes\r\nrouter.post('/submit', async (req, res) => {\r\n // 200 lines of logic\r\n});\r\n\r\n// ✅ ALWAYS: Delegate to controller\r\nrouter.post('/submit', (req, res) => controller.submit(req, res));\r\n```\r\n\r\n### 2. All Controllers Extend BaseController\r\n\r\n```typescript\r\nexport class UserController extends BaseController {\r\n async getUser(req: Request, res: Response): Promise<void> {\r\n try {\r\n const user = await this.userService.findById(req.params.id);\r\n this.handleSuccess(res, user);\r\n } catch (error) {\r\n this.handleError(error, res, 'getUser');\r\n }\r\n }\r\n}\r\n```\r\n\r\n### 3. All Errors to Sentry\r\n\r\n```typescript\r\ntry {\r\n await operation();\r\n} catch (error) {\r\n Sentry.captureException(error);\r\n throw error;\r\n}\r\n```\r\n\r\n### 4. Use unifiedConfig, NEVER process.env\r\n\r\n```typescript\r\n// ❌ NEVER\r\nconst timeout = process.env.TIMEOUT_MS;\r\n\r\n// ✅ ALWAYS\r\nimport { config } from './config/unifiedConfig';\r\nconst timeout = config.timeouts.default;\r\n```\r\n\r\n### 5. Validate All Input with Zod\r\n\r\n```typescript\r\nconst schema = z.object({ email: z.string().email() });\r\nconst validated = schema.parse(req.body);\r\n```\r\n\r\n### 6. Use Repository Pattern for Data Access\r\n\r\n```typescript\r\n// Service → Repository → Database\r\nconst users = await userRepository.findActive();\r\n```\r\n\r\n### 7. Comprehensive Testing Required\r\n\r\n```typescript\r\ndescribe('UserService', () => {\r\n it('should create user', async () => {\r\n expect(user).toBeDefined();\r\n });\r\n});\r\n```\r\n\r\n---",
"Resource Files": "### [architecture-overview.md](architecture-overview.md)\r\nLayered architecture, request lifecycle, separation of concerns\r\n\r\n### [routing-and-controllers.md](routing-and-controllers.md)\r\nRoute definitions, BaseController, error handling, examples\r\n\r\n### [services-and-repositories.md](services-and-repositories.md)\r\nService patterns, DI, repository pattern, caching\r\n\r\n### [validation-patterns.md](validation-patterns.md)\r\nZod schemas, validation, DTO pattern\r\n\r\n### [sentry-and-monitoring.md](sentry-and-monitoring.md)\r\nSentry init, error capture, performance monitoring\r\n\r\n### [middleware-guide.md](middleware-guide.md)\r\nAuth, audit, error boundaries, AsyncLocalStorage\r\n\r\n### [database-patterns.md](database-patterns.md)\r\nPrismaService, repositories, transactions, optimization\r\n\r\n### [configuration.md](configuration.md)\r\nUnifiedConfig, environment configs, secrets\r\n\r\n### [async-and-errors.md](async-and-errors.md)\r\nAsync patterns, custom errors, asyncErrorWrapper\r\n\r\n### [testing-guide.md](testing-guide.md)\r\nUnit/integration tests, mocking, coverage\r\n\r\n### [complete-examples.md](complete-examples.md)\r\nFull examples, refactoring guide\r\n\r\n---",
"Directory Structure": "```\r\nservice/src/\r\n├── config/ # UnifiedConfig\r\n├── controllers/ # Request handlers\r\n├── services/ # Business logic\r\n├── repositories/ # Data access\r\n├── routes/ # Route definitions\r\n├── middleware/ # Express middleware\r\n├── types/ # TypeScript types\r\n├── validators/ # Zod schemas\r\n├── utils/ # Utilities\r\n├── tests/ # Tests\r\n├── instrument.ts # Sentry (FIRST IMPORT)\r\n├── app.ts # Express setup\r\n└── server.ts # HTTP server\r\n```\r\n\r\n**Naming Conventions:**\r\n- Controllers: `PascalCase` - `UserController.ts`\r\n- Services: `camelCase` - `userService.ts`\r\n- Routes: `camelCase + Routes` - `userRoutes.ts`\r\n- Repositories: `PascalCase + Repository` - `UserRepository.ts`\r\n\r\n---",
"Architecture Overview": "### Layered Architecture\r\n\r\n```\r\nHTTP Request\r\n ↓\r\nRoutes (routing only)\r\n ↓\r\nControllers (request handling)\r\n ↓\r\nServices (business logic)\r\n ↓\r\nRepositories (data access)\r\n ↓\r\nDatabase (Prisma)\r\n```\r\n\r\n**Key Principle:** Each layer has ONE responsibility.\r\n\r\nSee [architecture-overview.md](architecture-overview.md) for complete details.\r\n\r\n---"
},
"id": "backend-dev-guidelines_diet103",
"name": "backend-dev-guidelines",
"description": "Comprehensive backend development guide for Node.js/Express/TypeScript microservices. Use when creating routes, controllers, services, repositories, middleware, or working with Express APIs, Prisma database access, Sentry error tracking, Zod validation, unifiedConfig, dependency injection, or async patterns. Covers layered architecture (routes → controllers → services → repositories), BaseController pattern, error handling, performance monitoring, testing strategies, and migration from legacy patterns."
}---
name: backend-dev-guidelines
description: Comprehensive backend development guide for Node.js/Express/TypeScript microservices. Use when creating routes, controllers, services, repositories, middleware, or working with Express APIs, Prisma database access, Sentry error tracking, Zod validation, unifiedConfig, dependency injection, or async patterns. Covers layered architecture (routes → controllers → services → repositories), BaseController pattern, error handling, performance monitoring, testing strategies, and migration from legacy patterns.
---
# Backend Development Guidelines
## Purpose
Establish consistency and best practices across backend microservices (blog-api, auth-service, notifications-service) using modern Node.js/Express/TypeScript patterns.
## When to Use This Skill
Automatically activates when working on:
- Creating or modifying routes, endpoints, APIs
- Building controllers, services, repositories
- Implementing middleware (auth, validation, error handling)
- Database operations with Prisma
- Error tracking with Sentry
- Input validation with Zod
- Configuration management
- Backend testing and refactoring
---
## Quick Start
### New Backend Feature Checklist
- [ ] **Route**: Clean definition, delegate to controller
- [ ] **Controller**: Extend BaseController
- [ ] **Service**: Business logic with DI
- [ ] **Repository**: Database access (if complex)
- [ ] **Validation**: Zod schema
- [ ] **Sentry**: Error tracking
- [ ] **Tests**: Unit + integration tests
- [ ] **Config**: Use unifiedConfig
### New Microservice Checklist
- [ ] Directory structure (see [architecture-overview.md](architecture-overview.md))
- [ ] instrument.ts for Sentry
- [ ] unifiedConfig setup
- [ ] BaseController class
- [ ] Middleware stack
- [ ] Error boundary
- [ ] Testing framework
---
## Architecture Overview
### Layered Architecture
```
HTTP Request
↓
Routes (routing only)
↓
Controllers (request handling)
↓
Services (business logic)
↓
Repositories (data access)
↓
Database (Prisma)
```
**Key Principle:** Each layer has ONE responsibility.
See [architecture-overview.md](architecture-overview.md) for complete details.
---
## Directory Structure
```
service/src/
├── config/ # UnifiedConfig
├── controllers/ # Request handlers
├── services/ # Business logic
├── repositories/ # Data access
├── routes/ # Route definitions
├── middleware/ # Express middleware
├── types/ # TypeScript types
├── validators/ # Zod schemas
├── utils/ # Utilities
├── tests/ # Tests
├── instrument.ts # Sentry (FIRST IMPORT)
├── app.ts # Express setup
└── server.ts # HTTP server
```
**Naming Conventions:**
- Controllers: `PascalCase` - `UserController.ts`
- Services: `camelCase` - `userService.ts`
- Routes: `camelCase + Routes` - `userRoutes.ts`
- Repositories: `PascalCase + Repository` - `UserRepository.ts`
---
## Core Principles (7 Key Rules)
### 1. Routes Only Route, Controllers Control
```typescript
// ❌ NEVER: Business logic in routes
router.post('/submit', async (req, res) => {
// 200 lines of logic
});
// ✅ ALWAYS: Delegate to controller
router.post('/submit', (req, res) => controller.submit(req, res));
```
### 2. All Controllers Extend BaseController
```typescript
export class UserController extends BaseController {
async getUser(req: Request, res: Response): Promise<void> {
try {
const user = await this.userService.findById(req.params.id);
this.handleSuccess(res, user);
} catch (error) {
this.handleError(error, res, 'getUser');
}
}
}
```
### 3. All Errors to Sentry
```typescript
try {
await operation();
} catch (error) {
Sentry.captureException(error);
throw error;
}
```
### 4. Use unifiedConfig, NEVER process.env
```typescript
// ❌ NEVER
const timeout = process.env.TIMEOUT_MS;
// ✅ ALWAYS
import { config } from './config/unifiedConfig';
const timeout = config.timeouts.default;
```
### 5. Validate All Input with Zod
```typescript
const schema = z.object({ email: z.string().email() });
const validated = schema.parse(req.body);
```
### 6. Use Repository Pattern for Data Access
```typescript
// Service → Repository → Database
const users = await userRepository.findActive();
```
### 7. Comprehensive Testing Required
```typescript
describe('UserService', () => {
it('should create user', async () => {
expect(user).toBeDefined();
});
});
```
---
## Common Imports
```typescript
// Express
import express, { Request, Response, NextFunction, Router } from 'express';
// Validation
import { z } from 'zod';
// Database
import { PrismaClient } from '@prisma/client';
import type { Prisma } from '@prisma/client';
// Sentry
import * as Sentry from '@sentry/node';
// Config
import { config } from './config/unifiedConfig';
// Middleware
import { SSOMiddlewareClient } from './middleware/SSOMiddleware';
import { asyncErrorWrapper } from './middleware/errorBoundary';
```
---
## Quick Reference
### HTTP Status Codes
| Code | Use Case |
|------|----------|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 500 | Server Error |
### Service Templates
**Blog API** (✅ Mature) - Use as template for REST APIs
**Auth Service** (✅ Mature) - Use as template for authentication patterns
---
## Anti-Patterns to Avoid
❌ Business logic in routes
❌ Direct process.env usage
❌ Missing error handling
❌ No input validation
❌ Direct Prisma everywhere
❌ console.log instead of Sentry
---
## Navigation Guide
| Need to... | Read this |
|------------|-----------|
| Understand architecture | [architecture-overview.md](architecture-overview.md) |
| Create routes/controllers | [routing-and-controllers.md](routing-and-controllers.md) |
| Organize business logic | [services-and-repositories.md](services-and-repositories.md) |
| Validate input | [validation-patterns.md](validation-patterns.md) |
| Add error tracking | [sentry-and-monitoring.md](sentry-and-monitoring.md) |
| Create middleware | [middleware-guide.md](middleware-guide.md) |
| Database access | [database-patterns.md](database-patterns.md) |
| Manage config | [configuration.md](configuration.md) |
| Handle async/errors | [async-and-errors.md](async-and-errors.md) |
| Write tests | [testing-guide.md](testing-guide.md) |
| See examples | [complete-examples.md](complete-examples.md) |
---
## Resource Files
### [architecture-overview.md](architecture-overview.md)
Layered architecture, request lifecycle, separation of concerns
### [routing-and-controllers.md](routing-and-controllers.md)
Route definitions, BaseController, error handling, examples
### [services-and-repositories.md](services-and-repositories.md)
Service patterns, DI, repository pattern, caching
### [validation-patterns.md](validation-patterns.md)
Zod schemas, validation, DTO pattern
### [sentry-and-monitoring.md](sentry-and-monitoring.md)
Sentry init, error capture, performance monitoring
### [middleware-guide.md](middleware-guide.md)
Auth, audit, error boundaries, AsyncLocalStorage
### [database-patterns.md](database-patterns.md)
PrismaService, repositories, transactions, optimization
### [configuration.md](configuration.md)
UnifiedConfig, environment configs, secrets
### [async-and-errors.md](async-and-errors.md)
Async patterns, custom errors, asyncErrorWrapper
### [testing-guide.md](testing-guide.md)
Unit/integration tests, mocking, coverage
### [complete-examples.md](complete-examples.md)
Full examples, refactoring guide
---
## Related Skills
- **database-verification** - Verify column names and schema consistency
- **error-tracking** - Sentry integration patterns
- **skill-developer** - Meta-skill for creating and managing skills
---
**Skill Status**: COMPLETE ✅
**Line Count**: < 500 ✅
**Progressive Disclosure**: 11 resource files ✅