agentleFS
robo311robo311/devflow/skills/be-rules/SKILL.md

be-rules

Skill1 starsChanged 24 days agoMITView on GitHub

Rules for backend code: input validation, authorization, transactions, migrations, API contracts, errors and logging, queries, external calls, jobs. Use when implementing or changing server-side code, and when judging whether it follows them.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 4 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈4

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When you see a better design than the project's, build it the project's way and put the alternative in your report as a suggestion, with …

    line 13
  2. Distinctive:

    Every new or changed entry point checks who may do this to which record: ownership or tenant, not only "is logged in".

    line 22
  3. Distinctive:

    Every migration has a working rollback, or the plan says why it cannot.

    line 31
  4. Distinctive:

    No queries in loops where one query would do.

    line 47

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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 rules

These add to code-rules for server-side code, under the same priority: the developer's instructions and the plan first, then the project's docs (CLAUDE.md, AGENTS.md, docs/), then its existing backend code and conventions, then these rules. Apply each rule where its subject exists in the task.

Architecture and language

  • Build inside the project's backend architecture: its layers (controller, service, repository, domain), dependency injection, module boundaries and patterns. A new endpoint, job or service is shaped like the existing ones.
  • When you see a better design than the project's, build it the project's way and put the alternative in your report as a suggestion, with what it would buy.
  • Where the project is silent, follow the language's and framework's idioms and best practices: their type system, error handling, standard library and the framework's own way of doing validation, persistence and configuration.

Input

  • Validate and normalise input at the boundary (controller, handler, command, consumer) into a typed shape before it reaches domain code; reject invalid input in the project's error format.

Authorization

  • Every new or changed entry point checks who may do this to which record: ownership or tenant, not only "is logged in".

Consistency

  • Writes that must succeed together run in one transaction.
  • Handlers that can be retried (webhooks, queue consumers, payment callbacks) are idempotent.

Migrations

  • Every migration has a working rollback, or the plan says why it cannot.
  • Migrations are safe on existing data: new columns are nullable or have defaults, backfills are explicit, destructive changes (drop, rename, type change) happen only when the plan includes them.

API contract

  • Response shapes and status codes follow the project's conventions.
  • A contract change updates everything that describes it in the same task: the API spec (OpenAPI or similar), generated types and clients, and docs.
  • Existing consumers keep working, or the plan says how they change.

Errors and logging

  • Errors leave in the project's error format with a stable code.
  • Logs carry enough context to debug (ids, operation) and never secrets, tokens or personal data; responses never leak internals.

Data access

  • No queries in loops where one query would do; lists that can grow are paginated; new filters and joins are backed by an index or the report says why not.

External calls

  • Calls to other services have a timeout, a defined behaviour on failure, and retries only where the call is safe to repeat.

Time, money, config

  • Time zones are explicit; money uses integer minor units or the project's decimal type, never floats.
  • Configuration and secrets come through the project's config mechanism, never hard-coded.

Background jobs

  • Jobs are idempotent, report failure, and can be re-run safely.

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.