agentleFS
RaditteAnggoroRaditteAnggoro/skill-for-lazy-developer/.agents/skills/transaction-safe-engineering/SKILL.md

transaction-safe-engineering

Skill1 starsChanged 7 days agoMITView on GitHub

Review or implement money movement, ledger updates, batch replay, reconciliation, and retry paths for idempotency, atomicity, concurrency, and recoverability. Use only when transaction integrity is at risk; skip projects without financial or equivalent state-transition risk.

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 4 are distinctive, and 1 is 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.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    no double debit/credit, double refund, or duplicate batch application.

    line 22
  2. Distinctive:

    no partial commit without a recovery path.

    line 24
  3. Distinctive:

    Use an idempotency key derived from the business operation, not a random retry token.

    line 30
  4. Distinctive:

    Test duplicate requests, timeout-after-commit, crash-before-commit, concurrent writers, partial batch failure, replay, and …

    line 44
  5. Very specific:

    If the request is a review, report findings and do not change production behavior without authorization.

    line 48

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

Transaction-Safe Engineering

Protect correctness when an operation can move money, change a ledger, or partially commit durable state. Load this skill only for a demonstrated transaction-integrity concern; it is not a default for ordinary code changes.

Model the transaction

Identify the business transaction, owning service, durable writes, external calls, and the commit boundary. Determine whether the operation is money movement, ledger posting, inventory reservation, batch replay, reconciliation, or another state transition with real-world consequence.

State the invariants before changing code:

  • exactly-once effect or explicitly bounded at-least-once behavior;
  • no double debit/credit, double refund, or duplicate batch application;
  • balanced totals and preserved currency/rounding rules;
  • no partial commit without a recovery path;
  • authorization and approval for high-impact actions;
  • audit evidence for every state change.

Design the safety controls

Use an idempotency key derived from the business operation, not a random retry token. Persist it with the operation result before returning success. Make retries reuse the key and return the original result. Define concurrency control for competing writers.

For multi-step operations, use a transaction where the storage supports it; otherwise use a durable state machine with explicit pending, committed, failed, and compensating states. Separate external side effects from the local commit. Do not claim atomicity across systems that cannot provide it.

For batches, persist checkpoints and a replay marker. Replays must be idempotent and must not reset missing values to zero. Reconcile totals before and after recovery.

Verify

Test duplicate requests, timeout-after-commit, crash-before-commit, concurrent writers, partial batch failure, replay, and rollback/compensation. Verify ledger totals and audit records, not just HTTP 200. Record the actual failure injection and remaining gaps.

If the request is a review, report findings and do not change production behavior without authorization. Pair with systematic-debugging for an unexplained failure and spec-to-code-verification for requirement evidence.

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.