Setup & Installation
Or with the ClawHub CLI, for registry-managed skill folders outside a full OpenClaw workspace:
Version History
Version 0.1.2 of backend-patterns - No file changes detected in this release. - No updates to features, documentation, or code.
What This Skill Does
Backend architecture patterns for Node.js and Next.js API routes. Covers RESTful API design, repository and service layers, database query optimization, Redis caching, JWT authentication, rate limiting, and structured logging, all with TypeScript examples.
Provides ready-to-copy TypeScript patterns for the most common backend concerns so you spend time on business logic instead of re-architecting auth, caching, and error handling each project.
When to use it
- Adding JWT auth middleware to a Next.js API route
- Fixing N+1 query problems in a data-heavy endpoint
- Caching frequent database reads with Redis
- Setting up role-based access control for admin-only routes
- Implementing rate limiting on a public API endpoint
Example Workflow
Here's how your AI assistant might use this skill in practice.
User asks: How do I protect my Next.js DELETE route so only admins can use it?
- 1Identify the role-based access control pattern from the skill
- 2Define a rolePermissions map assigning read, write, delete, and admin permissions per role
- 3Implement a requirePermission higher-order function that wraps route handlers
- 4Call requireAuth inside requirePermission to verify the JWT and extract the user
- 5Wrap the DELETE handler with requirePermission('delete')
A typed DELETE route handler that returns 401 for missing tokens, 403 for insufficient role, and 200 only for users with the delete permission