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

backend-patterns

Skill1 starsChanged 8 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.

49 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use project-guidelines-example, configure-ecc 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.
  • WorldFlowAISkill

    project-guidelines-example

    Also in 20 projects that use this

  • saxon-ySkill

    configure-ecc

    Interactive installer for Everything Claude Code — guides users through selecting and installing skills and rules to user-level or project-level directories, verifies paths, and optionally optimizes installed files.

    Also in 10 projects that use this

  • InfopibeSkill

    swift-protocol-di-testing

    Protocol-based dependency injection for testable Swift code — mock file system, network, and external APIs using focused protocols and Swift Testing.

    Also in 9 projects that use this

  • FaisalAlqarniSkill

    django-verification

    Verification loop for Django projects: migrations, linting, tests with coverage, security scans, and deployment readiness checks before release or PR.

    Also in 13 projects that use this

  • FaisalAlqarniSkill

    springboot-security

    Spring Security best practices for authn/authz, validation, CSRF, secrets, headers, rate limiting, and dependency security in Java Spring Boot services.

    Also in 14 projects that use this

  • InfopibeSkill

    content-hash-cache-pattern

    Cache expensive file processing results using SHA-256 content hashes — path-independent, auto-invalidating, with service layer separation.

    Also in 9 projects that use this

  • +3 more from Infopibe
  • +1 more from FaisalAlqarni

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 15 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 15 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.