agentleFS
bedomaxbedomax/webdesigner-agent/.claude/skills/backend-architecture/SKILL.md

backend-architecture

Skill1 starsChanged 4 months agoMITView on GitHub

Backend engineering and architecture decisions for scalable websites. Use when designing APIs, data models, databases, caching, auth, background jobs, integrations, infrastructure, or making any system architecture decision.

10 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use frontend-architecture.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • MicrosoftSkill

    frontend-architecture

    Internal frontend architecture, design, implementation, verification, and audit rules loaded only when an explicitly invoked repository SDD prompt directs the agent to this skill.

    Also in 3 projects that use this

The file

We split this skill into the rules it gives an agent

3 rules. 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 8 edited versions we read keep these.

  • 2

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Every significant decision goes in the spec's "Architecture Decisions" section:

    line 12
  2. Very specific:

    Every table: primary key, created_at, updated_at.

    line 35
  3. Distinctive:

    Never cache personalized or lead-submission responses.

    line 45

“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Backend & Architecture

Build backends that scale, and document every architecture decision.

Architecture Decision Discipline

Every significant decision goes in the spec's "Architecture Decisions" section:

### AD-1: <Decision title>
- **Context**: what problem forces a choice
- **Decision**: what we chose
- **Alternatives**: what we rejected and why
- **Consequences**: trade-offs we accept

Decide deliberately on: rendering strategy, database choice, caching layers, API style, hosting model, and third-party services. Default to boring, proven technology; choose the simplest design that meets requirements plus one order of magnitude of growth.

API Design

  • REST by default: nouns for resources, correct verbs and status codes (200/201/204/400/401/403/404/409/422/500).
  • Validate every input at the boundary with a schema (Zod/Valibot/Joi); trust nothing from the client.
  • Consistent error shape: { "error": { "code": "...", "message": "..." } } — never leak stack traces or internal details.
  • Version public APIs (/api/v1/); paginate every list endpoint (cursor-based for large sets).
  • Rate-limit public endpoints, especially lead/contact forms (abuse + spam protection).

Data Modeling

  • Normalize by default; denormalize only for measured read bottlenecks.
  • Every table: primary key, created_at, updated_at. Use foreign keys with explicit ON DELETE behavior.
  • Index for actual query patterns; check with EXPLAIN before and after.
  • Migrations are forward-only, reversible when possible, and never edit past migrations.
  • Leads are sacred data: never lose a form submission — persist first, then trigger side effects (email/CRM) asynchronously with retries.

Caching (in order of preference)

  1. CDN/edge cache for static and SSG/ISR pages.
  2. HTTP caching headers (Cache-Control, ETag) for APIs.
  3. Application cache (Redis) for expensive computed data — always with TTL and explicit invalidation strategy.
  4. Never cache personalized or lead-submission responses.

Reliability & Jobs

  • Anything slower than ~500ms or with external dependencies (email, CRM sync, image processing) goes to a background job/queue.
  • Jobs are idempotent and retried with exponential backoff; failed jobs land in a dead-letter queue with alerting.
  • Webhooks: verify signatures, respond fast (202), process async.

Security Baseline

  • Secrets in environment variables only — never committed, never logged.
  • Parameterized queries always; no string-built SQL.
  • Auth: proven library/provider (never hand-rolled crypto), httpOnly+secure+sameSite cookies for sessions.
  • Security headers: CSP, HSTS, X-Content-Type-Options, Referrer-Policy.
  • Sanitize and size-limit all user input, especially file uploads and form fields.

Scalability Defaults

  • Stateless application servers: session and state in the database/cache, so horizontal scaling works.
  • Connection pooling for the database; know your pool limits vs serverless concurrency.
  • Measure before scaling: add observability (structured logs, error tracking, latency metrics) from day one.

Backend Review Checklist

  • All inputs validated at the boundary
  • Correct status codes and consistent error shape
  • Indexes match query patterns, no N+1
  • Slow/external work in background jobs
  • Lead submissions persisted before side effects
  • No secrets in code, security headers set
  • Architecture decisions recorded in the spec

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.