← ClaudeAtlas

backend-fundamentalslisted

Stack-agnostic backend patterns. Use when writing or modifying any server-side code (HTTP handler, DB query, background job, auth/middleware, webhook) regardless of language or framework. Covers services/selectors split, idempotency, error envelopes, migration discipline, N+1 avoidance, scale-aware design, auth guardrails, and logging hygiene.
kouroshez/coding-os · ★ 6 · API & Backend · score 77
Install: claude install-skill kouroshez/coding-os
# Backend Fundamentals — Stack-Agnostic Patterns Universal guidance that holds for Django, FastAPI, Go (stdlib + Fiber), Rails, NestJS, Spring, and any other server-side framework. Framework-specific layering (DRF ViewSets, Pydantic `Depends`, Fiber middleware chain) lives in the stack-specific skill that `depends_on: [backend-fundamentals]`. Loaded automatically when `enforce-skill.sh` routes a file under `backend/` that matches a stack skill. ## 0. Scale mindset (think before writing) Every handler, query, and API must be written as if it will be called by 1,000 concurrent users on a 50M-row table. Before writing: - **How many rows does this touch?** Unknown → run `EXPLAIN ANALYZE` or ask. - **How many callers at once?** Single-user admin page vs. public endpoint changes everything. - **Where's the bottleneck?** DB index miss · network hop · CPU work. - **What's the latency budget?** Default P99 < 500 ms; surface the number in the PR description. - **What happens if step 3 of 5 fails?** Transactions · idempotency key · compensating action. Code that works on 10 rows but collapses on 10 M is a production incident waiting for traffic. Correct answer to "will this scale?" is a number, not "yes". ## 1. Service / selector split Business logic lives in **services** (write path — mutates state, encapsulates a transaction). Read-only DB queries live in **selectors** (pure functions, cached when possible). Controllers / views / handlers only: 1. Parse and validate the reque