agentleFS
HarambeeAIHarambeeAI/bayes-ship/skills/backend-patterns/SKILL.md

backend-patterns

Skill1 starsChanged 7 months agoMITView on GitHub

API design, query optimization, repository/service layer patterns for Node.js, Express, and Next.js backends. Use when implementing backend tasks. Source: everything-claude-code.

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

5 rules. 0 are common, 4 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 26 edited versions we read keep these.

  • 4

    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. Very specific:

    Always add .limit() to list queries

    line 31
  2. Distinctive:

    Use database indexes on columns used in WHERE and ORDER BY

    line 32
  3. Distinctive:

    Use pagination (cursor-based preferred over offset for large datasets)

    line 33
  4. Distinctive:

    Never trust client input inside service or repository layers

    line 38
  5. Distinctive:

    Use guards for auth, interceptors for logging/transformation, pipes for validation

    line 57

“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

Architecture layers

Controller (routes) → Service (business logic) → Repository (data access) → Database
  • Controller: HTTP concerns only. Parse request, validate input, call service, format response.
  • Service: Business logic. No HTTP concepts (no req/res). Testable in isolation.
  • Repository: Data access. Raw queries or ORM calls. No business logic.

API endpoint pattern

// Controller
async function createInvoice(req: Request, res: Response) {
  const dto = CreateInvoiceDto.parse(req.body)  // validate
  const invoice = await invoiceService.create(dto)  // delegate
  res.status(201).json(invoice)  // respond
}

Query optimization

  • Select only needed columns: .select('id, name, status') not .select('*')
  • Always add .limit() to list queries
  • Use database indexes on columns used in WHERE and ORDER BY
  • Use pagination (cursor-based preferred over offset for large datasets)

Input validation

  • Validate at the boundary (controller) with Zod or class-validator
  • Never trust client input inside service or repository layers
  • Validate types AND business rules (e.g., amount > 0, date in future)

Error responses

// Consistent error shape
{
  "error": {
    "code": "INVOICE_NOT_FOUND",
    "message": "Invoice with ID abc123 not found",
    "status": 404
  }
}

Nest.js specifics

  • One module per domain (InvoicesModule, PaymentsModule, AuthModule)
  • Use guards for auth, interceptors for logging/transformation, pipes for validation
  • DTOs with class-validator decorators for all input

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.