backend-patterns

Implements backend architecture patterns for Node.js, Express, and Next.js API routes.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill backend-patterns-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend-patterns
Source: https://github.com/ibytechaos/claude/tree/main/plugins/everything-claude-code/skills/backend-patterns
Command: npx skills add https://github.com/ibytechaos/claude --skill backend-patterns-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Building scalable server-side applications requires consistent patterns for API design, database access, caching, and error handling, and this Skill provides proven implementations so you avoid common pitfalls like N+1 queries and unstructured error responses. ## Core Features & Use Cases - API & Layering Patterns: RESTful endpoint structure, repository pattern, service layer separation, and middleware composition for auth and logging. - Database & Caching: Query optimization, N+1 prevention with batch fetching, transaction handling via Supabase RPC, and Redis cache-aside strategies. - Resilience & Security: Centralized error handlers, retry with exponential backoff, JWT validation, role-based access control, rate limiting, and background job queues. - Use Case: When building a Next.js API route that needs authentication, rate limiting, and cached database access, apply the withAuth middleware, in-memory rate limiter, and CachedMarketRepository patterns directly. ## Quick Start Ask the AI to design a REST API endpoint with authentication, caching, and error handling using backend patterns for a Next.js application.

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 REST API in Next.js?

Use resource-based URLs like GET /api/markets for lists and GET /api/markets/:id for single resources, with query parameters for filtering, sorting, and pagination. Separate concerns with repository, service, and middleware layers.

How to prevent N+1 queries in Node.js applications?

Batch fetch related records instead of querying in a loop. Collect all foreign keys, run one query to fetch them, build a Map keyed by ID, and attach results in memory.

What is the cache-aside pattern with Redis?

Cache-aside checks Redis first, and on a miss fetches from the database then writes the result to Redis with a TTL. Invalidate the cache key when the underlying record changes.

How do I implement role-based access control in an API?

Map each role to a list of permissions, then wrap handlers in a higher-order function that verifies the JWT and checks the user's role against the required permission before executing.

When should I use retry with exponential backoff?

Use it for transient failures like external API calls, doubling the delay between attempts (1s, 2s, 4s) up to a maximum retry count. Do not retry validation or authentication errors since they will not succeed on repeat.