agentleFS
luckysluckys/agent-skills/skills/infrastructure-design/SKILL.md

infrastructure-design

Skill5 starsChanged 30 days agoMITView on GitHub

Use when designing event buses or broker relays, Outbox/Inbox and CDC delivery, retries, ordering, dead-letter replay, crash recovery, concurrent workers, transaction boundaries, optimistic Aggregate concurrency, Redis caching, or database views in layered applications. Focuses on real adapter guarantees and coordination; use DDD for aggregate and context ownership.

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    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:

    Read references/retry-and-concurrency.md when an operation can be retried, resumed, or executed by concurrent workers.

    line 54

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

Infrastructure Design

Practical infrastructure patterns for layered (hexagonal/DDD) applications. The domain defines business consistency requirements, the application defines unit-of-work boundaries and capability ports, and infrastructure implements transaction and delivery mechanics.

Workflow

  1. Identify the concern — is this about event delivery, data consistency, read performance, or query simplification?
  2. Choose the right reference — load the relevant file from references/.
  3. Apply at the right layer — domain owns business meaning, application owns orchestration contracts, and infrastructure provides technical adapters.
  4. Validate the tradeoff — every infrastructure decision trades something (complexity, consistency, latency). Make the tradeoff explicit.

Quick Decision Map

ConcernPatternReference
Publishing domain events reliably without losing themDB-backed Event Bus / Outboxreferences/event-bus.md
Ensuring multiple writes succeed or fail togetherTransactions in use casereferences/transactions.md
Repeated measured reads with acceptable stalenessCache-Aside at the narrowest reusable layerreferences/cache.md
Complex JOIN queries repeated across the codebaseDatabase View / Materialized Viewreferences/database-views.md
Read model needs pre-computed aggregatesMaterialized view, trigger, or event-driven projectionreferences/database-views.md
Events must survive application crashesOutbox patternreferences/event-bus.md
Consumers must tolerate duplicate deliveryIdempotent handler / Inboxreferences/event-bus.md
Legacy writer cannot emit messagesChange Data Capture translatorreferences/event-bus.md
Stale Aggregate writes must not overwrite newer decisionsOptimistic version checkreferences/transactions.md

Core Principles

  • Core contracts first — define required ports in the domain or application core; implement adapters in infrastructure. DDD owns Repository semantics; infrastructure owns mapping, transactions, locking, caching, and Outbox mechanics.
  • Transactions wrap units of work — application code or a typed decorator owns the business boundary; repositories join the scoped transaction and do not commit it independently.
  • Cache is a derived copy — add it only for a measured problem, with explicit freshness, invalidation, privacy, failure, and removal policies.
  • Views abstract queries, not business logic — a view is a saved SELECT, not a substitute for a domain model.
  • Durability is designed, not implied — persist critical events with their writes; asynchronous delivery needs durable handoff, idempotent consumers, retries, dead-letter handling, and observability. Synchronous versus asynchronous delivery is a separate latency and coupling decision.

Related Skills

  • ddd-best-practices — bounded context design and aggregate boundaries
  • design-patterns-best-practices — Decorator for transparent transaction/cache wrapping
  • oop-best-practices — domain interface design and dependency inversion
  • tdd-best-practices — real-database transaction, rollback, concurrency, and delivery tests
  • refactoring-best-practices — incremental migration of controller/repository transaction boundaries
  • data-migration-best-practices — snapshot/backfill, live-delta handoff, reconciliation, cutover, and repair workflow

References

  • Read references/retry-and-concurrency.md when an operation can be retried, resumed, or executed by concurrent workers.
  • references/event-bus.md — synchronous failure policy, transactional Outbox, relay claiming, fan-out, Inbox/idempotency, ordering, retries, dead-letter/replay, RabbitMQ and AWS EventBridge/SQS semantics, brokers, and CDC
  • references/transactions.md — transaction placement, Aggregate consistency boundaries, optimistic concurrency, decorator pattern, unit of work
  • references/cache.md — cache placement, keys, invalidation, failures, stampede, capacity, Redis operations, and observability
  • references/database-views.md — views vs materialized views, trigger-maintained tables, event-driven projections, and workload-based selection

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.