backend-patterns

Provide reusable TypeScript backend patterns for Express and Next.js API routes.

3|Updated Jan 25, 2026
One-click install
npx skills add https://github.com/dongitran/ai-agent-config --skill backend-patterns-dongitran
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-patterns
Source: https://github.com/dongitran/ai-agent-config/tree/main/.agent/skills/backend-patterns
Command: npx skills add https://github.com/dongitran/ai-agent-config --skill backend-patterns-dongitran

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides structured backend patterns and best practices to design scalable, maintainable Node.js applications using patterns like RESTful APIs, repository/service layers, middleware, caching, and robust error handling.

Core Features & Use Cases

  • RESTful API structure with resource-based routes, filtering and pagination.
  • Repository and Service Layer patterns to separate concerns and enable testability.
  • Middleware patterns for authentication, error handling, and request validation.
  • Database optimization, caching strategies, and observability patterns for performance.
  • Use Case: Retrofit an Express API to adopt repository/service layers and unify error handling across routes, improving maintainability and scalability.

Quick Start

Review the patterns and integrate them into your Node.js backend (Express/Next.js) projects. Adapt the repository/service patterns to your data models and apply centralized error handling across routes. Run a refactor iteration to align existing endpoints with these patterns.

Frequently Asked Questions about backend-patterns

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

FAQPage Schema
How do I structure a scalable Node.js REST API with Express?

Apply repository and service layer patterns to separate data access from business logic in your Node.js REST API. This enforces consistency, improves testability, and maintains maintainability across Express and Next.js projects.

How do I implement centralized error handling in Express routes?

Implement centralized error handling in Express using dedicated middleware patterns. This unifies error responses across all routes, preventing scattered try-catch blocks and ensuring consistent API behavior during failures.

When do I need the repository pattern for my Node.js backend?

Use the repository pattern when you need to separate data access logic from business rules in Node.js applications. It enables better testability and allows you to retrofit existing Express APIs for improved maintainability and scalability.

Can I use these backend patterns with Next.js API routes?

Yes, these backend patterns work with Next.js API routes. They provide reusable TypeScript patterns and code snippets designed to be dropped into both Express and Next.js projects to enforce architectural consistency.

What's the best way to add authentication and caching to an Express API?

Add authentication and caching to Express APIs through dedicated middleware patterns. These patterns handle request validation, token authentication, and database optimization strategies to improve overall performance.

How do I retrofit an existing Express API to use service layers?

Retrofit an Express API by running a refactor iteration to align existing endpoints with repository and service layer patterns. Adapt the provided TypeScript patterns to your data models and apply centralized error handling across routes.