# Backend patterns

> Backend patterns is an open-source agent skill for developer tools. Guides an agent through Node.js and Express backend design, data access and error handling. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.

- **Kind:** Skill
- **Pricing:** Open source
- **Platforms:** Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf, Goose
- **Website:** https://github.com/Fmarzochi/EGC/tree/main/.agents/skills/backend-patterns
- **Repository:** https://github.com/fmarzochi/egc
- **GitHub stars:** 71
- **License:** Apache-2.0
- **Skill name:** backend-patterns
- **Collection:** https://github.com/Fmarzochi/EGC
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-03

## About

This skill gives the agent a reference of server-side code patterns for Node.js, Express and Next.js API routes. It covers how to lay out REST endpoints with resource URLs, filtering and pagination, and how to separate repository, service and controller layers. It also includes database advice such as selecting only needed columns, batching lookups to avoid N+1 queries, and wrapping multi-step writes in a transaction-style SQL function.

The rest of the guidance covers caching with a Redis-backed repository and cache-aside reads, a centralized error handler that maps custom errors and validation failures to HTTP responses, and retries with exponential backoff. It also describes JWT checks, role-based permission wrappers, a simple in-memory rate limiter, a basic in-process job queue and structured JSON logging. Most examples are TypeScript snippets that the agent adapts to the project it is working in.

The skill ships as a single SKILL.md with no scripts. It expects a TypeScript or JavaScript codebase and refers to libraries such as Supabase, Zod, jsonwebtoken and Redis, so those would need to be present for the examples to apply directly.

## When your agent uses it

> Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.

## What it can access

From a static check of the files on GitHub; nothing was run.

- [Instructions only, no scripts](https://github.com/Fmarzochi/EGC/tree/HEAD/.agents/skills/backend-patterns)
- [License: Apache-2.0](https://github.com/Fmarzochi/EGC/tree/HEAD/.agents/skills/backend-patterns)

## Features

- **API endpoint design:** Conventions for resource-based REST routes, query parameters for filtering, sorting and pagination.
- **Repository and service layers:** Interfaces and classes that separate data access from business logic.
- **Database query optimization:** Column selection, batched fetches to avoid N+1 queries and transaction-style SQL functions.
- **Caching strategies:** Redis caching wrapper and cache-aside reads with invalidation on writes.
- **Centralized error handling:** Custom API error class and a handler that returns consistent JSON error responses.
- **Auth and permissions:** JWT verification helpers and role-based permission checks for route handlers.
- **Rate limiting and logging:** In-memory rate limiter example and structured JSON logger with request context.

## Good for

- Design a REST API for a new resource with filtering and pagination
- Refactor a route handler into repository and service layers
- Find and fix N+1 queries in a data-fetching endpoint
- Add Redis caching with invalidation to a slow lookup
- Add JWT authentication and role checks to Next.js API routes
- Standardize error responses across Express or Next.js endpoints

## Install

### Claude Code

This skill ships in the `egc` plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):

```sh
/plugin marketplace add Fmarzochi/EGC
/plugin install egc@egc
```

Or copy only this skill to `~/.claude/skills/backend-patterns`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Fmarzochi/EGC.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/backend-patterns &&
cp -R "$tmp/.agents/skills/backend-patterns" ~/.claude/skills/backend-patterns &&
rm -rf "$tmp"
```

For one project only, put the folder in `.claude/skills/backend-patterns` inside it instead.

### Codex

Copy the skill folder to `~/.agents/skills/backend-patterns` to use it in every repository:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Fmarzochi/EGC.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/backend-patterns &&
cp -R "$tmp/.agents/skills/backend-patterns" ~/.agents/skills/backend-patterns &&
rm -rf "$tmp"
```

For one repository only, put the folder in `.agents/skills/backend-patterns` inside it instead.

### Cursor

Copy the skill folder to `~/.cursor/skills/backend-patterns` to use it in every project:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Fmarzochi/EGC.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/backend-patterns &&
cp -R "$tmp/.agents/skills/backend-patterns" ~/.cursor/skills/backend-patterns &&
rm -rf "$tmp"
```

For one project only, put the folder in `.cursor/skills/backend-patterns` inside it instead.

### Gemini CLI

Run in a terminal (add `--scope workspace` to install it for the current workspace only):

```sh
gemini skills install https://github.com/Fmarzochi/EGC.git --path .agents/skills/backend-patterns
```

Or copy the folder to `~/.gemini/skills/backend-patterns` yourself.

### VS Code

For GitHub Copilot in VS Code, copy the skill folder to `~/.copilot/skills/backend-patterns`:

```sh
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/Fmarzochi/EGC.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/backend-patterns &&
cp -R "$tmp/.agents/skills/backend-patterns" ~/.copilot/skills/backend-patterns &&
rm -rf "$tmp"
```

For one project only, put the folder in `.github/skills/backend-patterns` inside it instead.

### Other agents

Get the folder:

```sh
git clone --depth 1 https://github.com/Fmarzochi/EGC.git
```

Then copy `EGC/.agents/skills/backend-patterns` into your agent's skills folder as `backend-patterns`. Agents that support SKILL.md read one folder per skill.

## FAQ

### Which frameworks does Backend patterns target?

It targets server-side code in Node.js, with examples for Express and Next.js API routes.

### Does Backend patterns run any scripts or install anything?

No. The skill contains only a SKILL.md with guidance and code examples, and no scripts.

### Does Backend patterns need any specific database or service?

The examples use Supabase, Redis, Zod and jsonwebtoken, so those would be needed to run the snippets as written.

### How do I install Backend patterns in Claude Code?

Copy the skill folder from GitHub to ~/.claude/skills/backend-patterns to use it in all your projects, or to .claude/skills/backend-patterns in one project. Or install the egc plugin, which includes it: /plugin marketplace add Fmarzochi/EGC, then /plugin install egc@egc.

### Does Backend patterns run scripts?

No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.

### Which AI agents can use Backend patterns?

Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.

### What are the best alternatives to Backend patterns?

The closest alternatives to Backend patterns are Backend patterns, Backend engineering edho ferdian, API design, API design and API design.

## Where this comes from

- Description: from the skill's own SKILL.md.

## Alternatives

- [Backend patterns](https://ai-powered.com/skills/backend-patterns): Backend patterns is an open-source agent skill for developer tools.
- [Backend engineering edho ferdian](https://ai-powered.com/skills/backend-engineering-edho-ferdian): Backend engineering edho ferdian is an open-source agent skill for developer tools.
- [API design](https://ai-powered.com/skills/api-design): API design is an open-source agent skill for developer tools.
- [API design](https://ai-powered.com/skills/api-design-fmarzochi): API design is an open-source agent skill for developer tools.
- [API design](https://ai-powered.com/skills/api-design-nabwinsaud): API design is an open-source agent skill for developer tools.
- [Error handling](https://ai-powered.com/skills/error-handling): Error handling is an open-source agent skill for developer tools.
- [Go API design](https://ai-powered.com/skills/go-api-design): Go API design is an open-source agent skill for developer tools.
- [API and interface design](https://ai-powered.com/skills/api-and-interface-design): API and interface design is an open-source agent skill for design and media.

---
Source: https://ai-powered.com/skills/backend-patterns-fmarzochi
