backend-dev-guidelines
Build Production Node.js Backends with Best Practices
Also available from: BrianDai22,DojoCodingLabs,diet103,Dimon94
Stop guessing backend architecture. Get comprehensive guidelines for layered Node.js services with Express, TypeScript, Prisma repositories, and Zod validation that scale reliably.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "backend-dev-guidelines". Create a user registration endpoint
Expected outcome:
- Generated Zod validation schema for user input
- Created UserController extending BaseController with createUser method
- Implemented UserService with business logic and dependency injection
- Created UserRepository with Prisma queries
- Added route registration with asyncErrorWrapper
- Included Sentry error tracking and BFRI assessment
Using "backend-dev-guidelines". Refactor inline database queries in routes
Expected outcome:
- Extracted business logic from routes into new UserService
- Created UserRepository to encapsulate Prisma operations
- Updated UserController to orchestrate service calls
- Added proper error boundaries with BaseController
- Wrote unit tests for service layer
- BFRI improved from -2 (dangerous) to 8 (safe)
Security Audit
SafeStatic analysis flagged 544 patterns across 12 markdown documentation files (5337 lines). All findings are FALSE POSITIVES - the detected patterns exist in markdown code examples and documentation, not executable code. This skill provides secure backend development guidelines that explicitly teach against risky patterns like direct process.env usage. Safe for publication.
Quality Score
What You Can Build
New Microservice Development
Generate a complete backend microservice from scratch following production-ready patterns with proper layering, validation, and error handling.
Legacy Code Refactoring
Refactor monolithic route handlers into proper layered architecture with controllers, services, and repositories for improved maintainability.
Team Onboarding and Standards
Establish consistent backend development standards across teams with clear patterns for architecture, testing, and error handling.
Try These Prompts
Create a UserController following the BaseController pattern with methods for getUser, listUsers, createUser, and updateUser. Include proper error handling with Sentry integration.
Create a UserService that receives UserRepository via dependency injection. Include methods for findById, getAll, create, update, and delete with proper business logic separation.
Implement a complete user registration feature with Zod validation schema, controller extending BaseController, service with business logic, and repository with Prisma. Include BFRI scoring for the implementation.
Refactor this monolithic route handler into proper layered architecture. Identify routes, controllers, services, and repositories. Add proper error handling, validation, and Sentry tracking. Calculate BFRI before and after.
Best Practices
- Always use layered architecture: routes delegate to controllers, controllers call services, services use repositories
- Never use process.env directly - access configuration through unifiedConfig for type safety and testability
- Validate all external input with Zod schemas before processing - request bodies, query params, and route params
Avoid
- Business logic in route handlers - routes should only delegate to controllers
- Direct Prisma usage in controllers - always abstract through repositories
- Using console.log for errors - all errors must be captured in Sentry
Frequently Asked Questions
Why use layered architecture instead of putting logic in routes?
What is BFRI and how do I calculate it?
Why can't I use process.env directly in my code?
Do I need to extend BaseController for all controllers?
When should I use transactions in my services?
How do I test services that use dependency injection?
Developer Details
Author
sickn33License
MIT
Repository
https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/backend-dev-guidelinesRef
main
File structure