agentleFS
Pouya-MansourniaPouya-Mansournia/ARCHON/skills/05_Database/SKILL.md

database-data-architecture

Skill2 starsChanged 5 months agoMITView on GitHub

Database and data architecture — relational vs NoSQL vs key-value vs time-series vs search vs vector vs object storage, caching architecture, search architecture, and storage architecture decision rules.

The file

Files
SKILL.md

05 — Database & Data Architecture (L2/L3)

Level: L2 Software Engineering core, extending into L3 Infrastructure for storage/caching at scale.

Goal

Choose the right datastore(s) for each access pattern — most non-trivial systems use more than one — and avoid both "everything in Postgres forever, including search and full-text and time-series" and "premature polyglot persistence with five datastores for a system serving a hundred users."

Datastore Category Decision Matrix

CategoryDefault ChoiceUse ForAvoid When
Relational / SQLPostgreSQLDefault for almost everything — strong consistency, mature tooling, flexible queryingSchema is genuinely unknown/highly variable per-record at write time
Document / NoSQLMongoDBHighly variable/nested document shapes, rapid schema iterationNeed for strong cross-document transactional consistency
Key-Value / CacheRedisCaching, session storage, rate-limit counters, leaderboards, pub/subNeed for it to be the system of record (it's not durable enough by default for that role)
Time-SeriesTimescaleDB / InfluxDBMetrics, sensor data, IoT telemetry, financial tick dataGeneral-purpose application data with no time-ordered query pattern
SearchElasticsearch / OpenSearch / MeilisearchFull-text search, faceted filtering, relevance rankingSimple exact-match lookups that an indexed SQL query already handles well
Vector DBpgvector (in Postgres) / Pinecone / WeaviateEmbedding similarity search for AI/RAG featuresNo AI/semantic-search feature actually exists yet
Object StorageS3 / GCS / Azure BlobFiles, images, backups, data lake raw storageStructured, queryable data that belongs in a real database

PostgreSQL vs. MongoDB — The Most Common Real Decision

Default to PostgreSQL unless there's a specific, named reason for a document store: genuinely unpredictable/sparse schema per record, or a workload that's overwhelmingly document-shaped with little need for cross-record joins. Postgres's jsonb column type already covers most "I want some schema flexibility" needs without giving up relational integrity and tooling for the rest of the data.

Decision Rule

Most products need exactly one primary relational datastore (Postgres) plus a cache (Redis) once there's real read traffic to offload. Add a search engine, time-series store, or vector DB only when there's a specific, demonstrated feature need (full-text search at scale, sensor/metrics ingestion, AI semantic search) — not preemptively.

Reference Files

  • reference/database-data-architecture.md — full datastore comparison, indexing, replication, and data modeling guidance.
  • reference/caching-architecture.md — caching layers, invalidation strategies, cache-aside vs write-through.
  • reference/search-architecture.md — full-text search architecture, when SQL LIKE/tsvector suffices vs. needing a dedicated search engine.
  • reference/storage-architecture.md — object storage, data lakes, backup/retention architecture.

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.