backend-patterns
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Security Assessment
About backend-patterns
backend-patterns is a code-convention and architecture reference skill for building scalable server-side applications with Node.js, Express, and Next.js API routes. It solves the recurring problem of inconsistent, hard-to-maintain backend code by giving the agent a curated set of proven patterns to apply when designing endpoints, structuring data access, and optimizing database interaction. The guidance is delivered as annotated TypeScript examples that explicitly contrast good and bad approaches.
The skill activates around concrete backend tasks: designing REST or GraphQL endpoints, implementing repository/service/controller layers, preventing N+1 queries, adding indexing and connection pooling, and building middleware for auth, logging, and rate limiting. It documents resource-based RESTful URL conventions, the repository pattern (with a Supabase implementation example), a service layer that separates business logic from data access, an auth middleware wrapper, query optimization (selecting only needed columns), N+1 batch-fetch prevention, transaction patterns using Supabase RPC/plpgsql functions, Redis and cache-aside caching strategies, and a centralized ApiError-based error handler.
It is aimed at backend and full-stack developers working in TypeScript-first Node/Next.js stacks, particularly those using Supabase or Redis. Typical use cases include reviewing or scaffolding an API layer, refactoring data-access code to a repository pattern, adding a caching layer, or eliminating query performance problems. The content originates from the ECC project and reflects that codebase's conventions (e.g., a markets/positions domain), so examples are illustrative patterns rather than a general framework.
FAQ
What stacks does this skill target?
Node.js, Express, and Next.js API routes, with TypeScript examples. Several examples assume Supabase for data access and Redis for caching.
When should the skill activate?
When designing REST or GraphQL endpoints, implementing repository/service/controller layers, optimizing queries (N+1, indexing, pooling), adding caching, setting up background jobs, or building auth/logging/rate-limiting middleware.
Does it include runnable code or just guidance?
It provides illustrative TypeScript and SQL snippets (repository, service, middleware, caching, transactions, error handling) meant as patterns to adapt, not a drop-in library.
Are the examples tied to a specific domain?
Examples use a markets/positions domain from the ECC project, so you adapt the naming and schema to your own application.
Install backend-patterns
Quick Setup:
- Copy the skill folder to
.claude/skills/ - Claude will automatically detect and use the skill
Repository
affaan-m/ecc