backend-patterns

backend-patterns is a skill for Claude Code from shennawardana23/skillme. It costs 88 tokens per session (2,282 once invoked), scanned A, original, Apache-2.0.

A collection of patterns for structuring server-side software, including separate request handling, business logic, and database access, plus guidance on queries, caching, retries, rate limits, and background jobs.

In plain words
What is it for?
Use it to organize backend services, prevent N+1 queries, add caching or retries, limit traffic, and process work outside the main request.
Why use it?
It helps keep backend code easier to test and change while avoiding common problems such as repeated database queries and unreliable external operations.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: positional $N argument.

Part of the skillme plugin — 137 skills, 2 commands shipped together

Good fit Use it to organize backend services, prevent N+1 queries, add caching or retries, limit traffic, and process work outside the main request.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/shennawardana23/skillme/backend-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add shennawardana23/skillme --skill backend-patterns
Clone the repo
git clone --depth 1 https://github.com/shennawardana23/skillme

Made for: Claude Code.

Or install skillme, the plugin that ships this one along with the rest of its 137 skills, 2 commands.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for backend-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/shennawardana23/skillme/backend-patterns/github.svg)](https://agentmods.dev/skills/shennawardana23/skillme/backend-patterns)
Your own site
<a href="https://agentmods.dev/skills/shennawardana23/skillme/backend-patterns"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/backend-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for backend-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/shennawardana23/skillme/backend-patterns"><img src="https://agentmods.dev/badge/skills/shennawardana23/skillme/backend-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 88 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,282 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00088 $0.02282
Opus 5 $0.00044 $0.01141
Sonnet 5 $0.00018 $0.00456
Haiku 4.5 $0.00009 $0.00228

Measured 9d ago against content hash a6b244cd7376, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

backend-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/backend-patterns/SKILL.md · 229 lines

How it starts

The opening of the file, as written. The whole thing — 229 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Backend Patterns

Structural patterns for server-side code, independent of any one framework. For the shape of the request/response contract itself, see api-design; for query- and index-level database patterns, see postgres-patterns; for structured logs/metrics/traces, see observability-and-instrumentation.

Layering: handler → service → repository

Keep three concerns separate so each can be tested and changed independently:

// repository: only knows SQL, returns domain types or a wrapped error
type ReservationRepo struct{ db *sql.DB }

func (r *ReservationRepo) ByID(ctx context.Context, hotelID int64, id string) (*Reservation, error) {
    const q = `SELECT id, hotel_id, status FROM reservations WHERE hotel_id = $1 AND id = $2`
    var res Reservation
    if err := r.db.QueryRowContext(ctx, q, hotelID, id).Scan(&res.ID, &res.HotelID, &res.Status); err != nil {
        if errors.Is(err, sql.ErrNoRows) {
            return nil, fmt.Errorf("reservation %s: %w", id, ErrNotFound)
        }
        return nil, fmt.Errorf("query reservation %s: %w", id, err)
    }
    return &res, nil
}

// service: business logic, orchestrates repositories, knows nothing about HTTP
type ReservationService struct{ repo *ReservationRepo }

func (s *ReservationService) Cancel(ctx context.Context, hotelID int64, id string) error {
    res, err := s.repo.ByID(ctx, hotelID, id)
    if err != nil {
        return err
    }
    if res.Status == StatusCheckedOut {
        return fmt.Errorf("cancel reservation %s: %w", id, ErrAlreadyCheckedOut)
    }
    return s.repo.SetStatus(ctx, hotelID, id, StatusCancelled)
}

// handler: only knows HTTP — decode, call service, map errors to status codes
func (h *Handler) CancelReservation(w http.ResponseWriter, r *http.Request) {
    hotelID, id := parseParams(r)
    if err := h.svc.Cancel(r.Context(), hotelID, id); err != nil {
        writeError(w, err) // maps ErrNotFound -> 404, ErrAlreadyCheckedOut -> 409, else 500
        return
    }
    w.WriteHeader(http.StatusNoContent)
}

Read the full file on GitHub · 229 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 229 lines · 88 tokens per session scan A a6b244cd7376

Subscribe to this mod's changes

backend-patterns is a skill published in the GitHub repository shennawardana23/skillme (2 stars, last pushed 11d ago), licensed Apache-2.0. It adds 88 tokens to every session and 2,282 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

encore-go-cache

Cache data in Redis from Encore Go using cache.NewCluster and typed keyspaces from encore.dev/storage/cache. Type-safe key/value access with TTLs, atomic increments, and per-keyspace data shapes.

encoredev/skills · 49 tokens

upstash-ratelimit-js

Rate limiting for serverless and edge apps with the @upstash/ratelimit TypeScript/JavaScript SDK backed by Upstash Redis. Use when adding a rate limiter or throttling to an API route, Next.js middleware, Vercel Edge, Cloudflare Workers, or any HTTP endpoint; returning 429 Too Many Requests; choosing between fixed…

upstash/skills · 177 tokens

laravel-async

Asynchronous and caching rules for Laravel — idempotent queued jobs with retries and backoff, domain events for side effects, queue separation and failure handling, deterministic cache keys with event-driven invalidation, and scheduled tasks that queue rather than block. Use when writing or reviewing jobs, events…

Foysal50x/skills · 86 tokens

bullmq-docs

Use when users ask how to create, configure, process, schedule, retry, rate-limit, monitor, or troubleshoot BullMQ job queues and workers in Node.js, including queues, workers, jobs, flows, job schedulers, events, telemetry, Redis compatibility, NestJS integration, patterns, or production deployment, especially when…

cookieMonsterDev/agents-skills · 86 tokens

wp-plugin-performance

Performance guidelines for WordPress plugin development: database optimization, object caching, conditional asset loading, efficient hooks, HTTP requests, WP-Cron, AJAX/REST optimization, and common anti-patterns. Based on official WordPress Developer Resources and WP VIP documentation.

fernandotellado/ai-skills · 55 tokens

redis-caching

Redis caching, rate limiting, session storage, pub/sub, and production integration patterns for TypeScript, Next.js, NestJS, and Prisma applications. Use when adding cache-aside or write-through caching, rate limiting, session or lock storage, pub/sub fanout, or reviewing Redis key design and TTLs.

shipshitdev/skills · 67 tokens