agentleFS
kennguyen887kennguyen887/agent-foundation/skills/rules-backend/SKILL.md

rules-backend

Skill1 starsChanged 5 months agoMITView on GitHub

Binding personal rules for backend data — load before adding config/env vars, writing migrations/SQL/transactions/money fields, or building consumers, crons, retries, timeouts or backfills.

  • Reads credentials

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    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:

    Never hardcode config; new env vars → .env.example + Joi/Zod schema (fail boot if missing).

    line 11
  2. Distinctive:

    Follow database-migrations skill.

    line 14
  3. Distinctive:

    Avoid OR across columns in WHERE (kill NULLs with NOT NULL DEFAULT, same-column → IN, else UNION ALL/derived column).

    line 17
  4. Distinctive:

    Every consumer idempotent (natural-key upsert / atomic status transition / processed marker in same trx).

    line 20

≈ “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

rules-backend

These rules are binding (moved verbatim from ~/.claude/CLAUDE.md). Each heading names its full-text file in ~/.claude/rulebook/: Read that file before acting in its area — the one-liners are the trigger, not the whole rule.

Config & Env — 21-config-environment-rules.md

  • Never hardcode config; new env vars → .env.example + Joi/Zod schema (fail boot if missing); no process.env.X in business logic.

Database — 22-database-migration-rules.md

  • Follow database-migrations skill; never alter schema manually; migrations immutable once merged, reversible; filters in SQL.
  • ACID: 2+ dependent writes in ONE trx, every query uses the trx, no external calls inside; invariants in schema (unique index > check-then-insert, map violations to 4xx); derived data in same trx or computed on read; locks only for read-decide-write under concurrency — atomic conditional UPDATE + affected rows > atomic arithmetic > FOR UPDATE inside the same trx; short trx, retry whole trx on deadlock; report success only after commit; durable state in DB (outbox for critical side effects).
  • Money never FLOAT — DECIMAL(p,2)/cents, no float math, round once.
  • Avoid OR across columns in WHERE (kill NULLs with NOT NULL DEFAULT, same-column → IN, else UNION ALL/derived column); sargable predicates + index; never column-vs-column selection — use a constant recency window.

Reliability — 23-reliability-rules-idempotency-bounded-everything.md

  • Every consumer idempotent (natural-key upsert / atomic status transition / processed marker in same trx); crons need overlap guard + max tries; migrations/backfills idempotent.
  • Everything bounded: explicit timeouts under the caller's deadline; paginate/chunk growing scans, select only needed columns; retries capped with backoff + jitter.

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.