agentleFS
RinisnotarobotRinisnotarobot/rinco-pi-skills-commands/skills/patterns/backend-patterns/SKILL.md

backend-patterns

Skill2 starsChanged 2 months agoMITView on GitHub

Language- and framework-neutral backend architecture patterns. Use when designing or reviewing service boundaries, data consistency, contract evolution, distributed workflows, messaging, caching, regional topology, authorization, or observability; choose patterns from explicit constraints and trade-offs, route domain, failure, security, and rollout work to their owners, then map decisions to the project's existing stack.

88 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use everything-claude-code, investor-materials and 10 more.

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.
  • InfopibeSkill

    everything-claude-code

    Also in 10 projects that use this

  • InfopibeSkill

    investor-materials

    Create and update pitch decks, one-pagers, investor memos, accelerator applications, financial models, and fundraising materials. Use when the user needs investor-facing documents, projections, use-of-funds tables, milestone plans, or materials that must stay internally consistent across multiple fundraising assets.

    Also in 29 projects that use this

  • niloykumarbarmanSkill

    agent-sort

    Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

    Also in 10 projects that use this

  • tpavanipradeepSkill

    bun-runtime

    Bun as runtime, package manager, bundler, and test runner. When to choose Bun vs Node, migration notes, and Vercel support.

    Also in 21 projects that use this

  • mryeastcodeSkill

    everything-claude-code-conventions

    Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

    Also in 8 projects that use this

  • gongyijie85Skill

    unified-memory

    Share durable, inspectable context and handoffs between Claude, Codex, Hermes, Cursor, OpenCode, and other agents through the local ECC Memory Vault. Use when an agent must save work state, transfer context, resume another agent's task, or search shared project knowledge.

    Also in 4 projects that use this

  • +1 more from Infopibe

The file

We split this skill into the rules it gives an agent

8 rules. 0 are common, 7 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 26 edited versions we read keep these.

  • 7

    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:

    Read only the references needed for the active branch:

    line 41
  2. Distinctive:

    Use the project's native primitives and terminology.

    line 74
  3. Distinctive:

    Document where the invariant is enforced.

    line 76
  4. Distinctive:

    Treat transaction script, service layer, vertical slice, ports and adapters, and event-driven designs as alternatives shaped by context—not …

    line 97
  5. Distinctive:

    Add a repository boundary when it protects domain code from meaningful persistence complexity or supports multiple callers/adapters.

    line 98
  6. Distinctive:

    Prefer one authoritative write owner.

    line 106
  7. Very specific:

    Use canonical domain terms and context ownership from domain-modeling.

    line 108
  8. Distinctive:

    When proposing or reviewing a backend pattern, return:

    line 114

“Common” is measured: kept by at least 6 in 10 of the 26 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 Patterns

Choose backend patterns from the problem's forces and invariants. Preserve the project's language, framework, and established architecture unless the evidence justifies a change.

Workflow

1. Establish the context

Inspect the repository and state:

  • execution model: request/response, event-driven, scheduled, streaming, actor, or mixed;
  • deployment shape: process, serverless function, container, edge, or worker;
  • canonical domain terms, capability and data ownership, transaction boundaries, and external systems;
  • consumers, compatibility surfaces, data lifecycle, and deployment coexistence constraints;
  • required consistency, latency, throughput, availability, recovery objectives, and regional or regulatory constraints;
  • existing conventions and operational capabilities.

Consume CONTEXT.md or CONTEXT-MAP.md when present. Invoke domain-modeling when vocabulary or context ownership must be resolved rather than guessed. Backend pattern comparison remains here; route a selected decision to domain-modeling only when the user wants a qualifying ADR recorded.

Completion criterion: every relevant constraint is supported by repository evidence or explicitly marked as an assumption.

2. Define the problem and invariant

Describe the recurring failure or design pressure without naming a solution. Then state the invariant that any acceptable solution must preserve.

Examples:

  • Duplicate delivery may repeat a charge. Invariant: one idempotency key produces at most one charge.
  • A remote dependency stalls requests. Invariant: dependency time is bounded by the caller's deadline.
  • A read path overloads the primary store. Invariant: freshness may lag by at most five minutes.

Completion criterion: the problem, affected boundary, and observable correctness condition are explicit.

3. Select the relevant pattern family

Read only the references needed for the active branch:

Problem branchReference
Module boundaries, layering, dependency directionreferences/boundaries.md
Unresolved domain vocabulary or context ownership; recording a confirmed qualifying ADRInvoke domain-modeling; consume its canonical terms or ADR while keeping backend pattern selection here
Transactions, concurrency, distributed consistency, data access and lifecyclereferences/consistency-and-data.md
API, event, schema, or consumer compatibility and evolutionreferences/contracts-and-evolution.md
Remote, asynchronous, partial-failure, or capacity policyInvoke the resilience skill — in this repository at skills/workflows/resilience/, in an installed flat scope as a sibling resilience/ folder — and consume its policy and evidence requirements
Queues, delivery semantics, publish/subscribereferences/messaging.md
Caching, batching, pagination, throughput and cost modelingreferences/caching-and-performance.md
Regional topology, replication placement, failover, restorereferences/topology-and-continuity.md
Authentication, authorization, auditability, telemetryreferences/security-and-observability.md; invoke security-review for a deep review of changed trust boundaries
Node.js/TypeScript implementation: project and runtime setup, composition, validation and error mapping, persistence and job wiringInvoke ts-backend; it expresses the selected backend architecture in Node.js and TypeScript forms

Completion criterion: candidate patterns come from the problem branch rather than from habit.

4. Compare the smallest viable options

For each candidate, record:

  1. Context — conditions in which it applies.
  2. Forces — competing goals such as consistency versus availability.
  3. Solution shape — components and their relationships, without framework syntax.
  4. Invariant — what must remain true.
  5. Consequences — complexity, latency, storage, and operational cost.
  6. Failure modes — how the pattern is commonly misapplied.
  7. Verification — tests, metrics, traces, constraints, or failure injection that prove it works.

Include the simplest option, including keeping the current design. Prefer the least complex option that satisfies the invariant.

5. Map the pattern to the codebase

Use the project's native primitives and terminology. Keep conceptual boundaries distinct from file-count or class-count: a boundary can be a function, module, process, database constraint, policy, or protocol.

Document where the invariant is enforced. If enforcement spans systems, identify the gap and the recovery mechanism.

Completion criterion: the proposal names concrete integration points without pretending the example implementation is the pattern.

6. Verify the behavior

Match verification to the risk:

  • concurrency properties: race tests plus database constraints;
  • delivery semantics: duplicate, delayed, reordered, and poison messages;
  • resilience: consume the focused failure scenarios and observable requirements from resilience; do not derive a second failure policy;
  • consistency: concurrency and storage-invariant tests plus the partial-failure and recovery requirements consumed from resilience;
  • contracts and migrations: supported-version matrices, mixed-version tests, backfill reconciliation, and explicit contract-removal evidence;
  • topology and continuity: restore tests, failover/failback exercises, replication-lag bounds, and RPO/RTO evidence;
  • security: deny-by-default authorization tests and audit evidence; route changed trust boundaries to security-review;
  • performance: representative load, latency percentiles, saturation signals, workload skew, and unit-cost evidence.

Report what was proved, what remains assumed, and the operational signals needed after deployment.

Pattern Selection Rules

  • Treat transaction script, service layer, vertical slice, ports and adapters, and event-driven designs as alternatives shaped by context—not maturity levels.
  • Add a repository boundary when it protects domain code from meaningful persistence complexity or supports multiple callers/adapters. Direct data access is valid for a simple local operation.
  • Route deadlines, retries, retry or replay safety, overload, and operation-level partial-failure recovery policy to resilience; this Skill maps that policy, while topology and continuity own regional authority, restore, failover, and failback architecture.
  • A cache is a replicated view with a freshness policy. Define invalidation, ownership, fallback behavior, and stampede control before adding it.
  • At-least-once delivery requires duplicate-safe consumers. Ordering is scoped to the guarantees of the chosen broker and partition key.
  • Cross-service consistency requires explicit compensation, reconciliation, or durable state transfer; local database transactions do not cross remote calls.
  • Authentication establishes identity. Authorization evaluates whether that identity may perform this action on this resource in this context.
  • In-process state is process-local. Do not use it to claim distributed rate limits, durable work, global locks, or cross-instance coordination.
  • Compatibility is a time-bounded invariant across deployed versions, consumers, and stored data. Versioning alone does not prove coexistence or safe removal.
  • Prefer one authoritative write owner. A multi-writer or active-active topology is incomplete until conflict semantics, failover, failback, and reconciliation are explicit.
  • Separate architecture selection from delivery sequencing. Hand migration and rollout steps to plan; do not hide irreversible data transitions behind a generic rollback claim.
  • Use canonical domain terms and context ownership from domain-modeling; do not redefine them inside an implementation recommendation. Backend pattern comparison and selection remain this Skill's responsibility.

Output Contract

Scale depth to scope: combine headings for a small local decision; use the full structure for cross-system, irreversible, security-sensitive, or continuity-critical work. Mark a section not applicable rather than manufacturing concerns.

When proposing or reviewing a backend pattern, return:

Context and constraints
Problem and invariant
Current design
Candidate options and trade-offs
Selected pattern and why
Rejected alternatives and why
Implementation and evolution mapping
Operational ownership and continuity
Failure modes
Verification plan
Assumptions and open risks

The pattern is not complete until its applicability boundary, cost, and verification method are stated.

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.