agentleFS
alfonsusenricoalfonsusenrico/pakem/skills/backend-engineering/SKILL.md

backend-engineering

Skill0 starsChanged 8 days agoMITView on GitHub

Use when designing or implementing backend services - APIs and error formats, request validation, data access, database migrations, background jobs, configuration and environment variables, logging, authentication, or money, booking, and inventory logic.

11 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use software-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.
  • nek1987Skill

    software-architecture

    Guide for quality focused software architecture. This skill should be used when users want to write code, design architecture, analyze code, in any case that relates to software development.

    Also in 3 projects that use this

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 5 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:

    No SQL or business rules in route handlers.

    line 19
  2. Very specific:

    API shape: follow API conventions: plain resources, RFC 9457 problem+json errors with a stable code and request_id.

    line 41
  3. Distinctive:

    No framework HTTP exceptions inside domain services.

    line 44
  4. Distinctive:

    Reliability: follow reliability for timeouts, retries, idempotency, transactions, and payload budgets.

    line 45
  5. Distinctive:

    Follow data access and migrations:

    line 50
  6. Distinctive:

    If your change introduces one of these capabilities, say so before implementing and include its standards or record the gap as debt.

    line 74
  7. Distinctive:

    Verify webhook signatures and source before processing.

    line 81
  8. Distinctive:

    Never log request bodies, tokens, personal data, or model content.

    line 86

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

Defaults for backend services. Check the project AGENTS.md for its stack, capabilities, and any ## Overrides first: the project's choices win.

1. Stack and structure

  • Suggested stack for a new service, when the project or team has none: Python + FastAPI
    • uv (especially AI services). Use NestJS when the client or team works in TypeScript; Next.js route handlers only for small full-stack apps; a headless CMS when non-developers must edit content cheaply.
  • Layering: thin routes or controllers (parse, authorize, call a service, shape the response) -> services (domain logic; pure helpers with unit tests) -> data layer. No SQL or business rules in route handlers.
  • Split files over about 800 lines by responsibility. Group modules by domain, not by technical type alone.

2. Always (every backend)

  • Validation: a schema library at every trust boundary - requests, webhooks, queue payloads, external API responses (Pydantic; class-validator with whitelist + forbidNonWhitelisted; zod). Reject unknown fields on inputs the project defines (its API requests, its queue payloads). For third-party responses and webhooks, validate the fields you use and ignore the rest: providers add fields as a backward-compatible change.
  • Configuration: one typed settings object, validated at startup; missing required values stop the app. Follow configuration and environment variables.
  • Between release units: code inside one release unit (a monolith, or modules released together) shares freely. A unit released on its own (separate repository, deployment, or version) depends on another only through its published, versioned contract: its API, or a published package version. Never through its source tree or repository, so one unit's releases or visibility never break another's build. Whether a consumer uses a published SDK or its own thin client is the project's choice, recorded in its AGENTS.md.
  • API shape: follow API conventions: plain resources, RFC 9457 problem+json errors with a stable code and request_id.
  • Errors: domain code raises domain errors; one boundary layer maps them to HTTP. No framework HTTP exceptions inside domain services.
  • Reliability: follow reliability for timeouts, retries, idempotency, transactions, and payload budgets.

3. Data (database capability)

Follow data access and migrations:

  • SQL-first thin data layer: parameterized SQL in per-domain query modules, explicit transactions and locks. An ORM only for mapping when the framework already brings one.
  • Idempotent, forward-only migrations that cannot change silently once applied; never runtime schema sync. Migrations run as a separate step that must succeed before new app instances start. Write them by hand and never autogenerate (default:handwritten-migrations); a project whose framework generates migrations overrides it and reviews each generated file as if written by hand.
  • Tests run against a real disposable instance of the project's database with migrations applied: PostgreSQL unless the project uses another (default:postgres).

4. Capability-triggered standards

CapabilityApply
deployedrequest id on every request (header and error body); JSON logs in production with ids, counts, durations, states only; slow-query logging; health endpoint that reports the running revision
moneyintegrity kit
background-jobsjobs and outbox
api-consumersOpenAPI generated from code is the contract; clients generated from it; CI fails on drift; every status code documented
multi-userauthorization checked in services, not only in routes; audit trail for privileged actions; authentication
personal-datasensitive-operations logging and privacy rules; access control and retention defined

If your change introduces one of these capabilities, say so before implementing and include its standards or record the gap as debt.

5. Security essentials

  • Authentication follows authentication.
  • Compare secrets and signatures in constant time.
  • Verify webhook signatures and source before processing; treat callbacks as untrusted input; make them idempotent.
  • Set security headers (CSP, frame denial, nosniff, referrer policy) on any service that serves HTML.
  • Rate-limit authentication, enumeration-prone, and expensive endpoints.
  • Never log request bodies, tokens, personal data, or model content.

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.