Database architecture skills, docs, and rules for high-demand multi-tenant commerce platforms (PostgreSQL source of truth, Neo4j as derived GraphRAG projection, transactional outbox, RLS-based tenant isolation). Includes live schema introspection workflow via explicit Supabase MCP/read-only schema sources.
77
97%
Does it follow best practices?
Impact
—
No eval scenarios have been run
Passed
No known issues
These rules are always on, applied to every interaction in this project, regardless of which command or skill is active. They are the minimum bar below which the agent never produces output.
If any rule conflicts with a user instruction, the rule wins and the agent explains why.
tenant_id BIGINT NOT NULL.(tenant_id, ...).tenant_id:
UNIQUE (tenant_id, sku), never UNIQUE (sku).current_setting('app.tenant_id').created_at TIMESTAMPTZ and updated_at TIMESTAMPTZ,
both NOT NULL DEFAULT now(). updated_at is trigger-maintained.TIMESTAMPTZ. Never TIMESTAMP. Never epoch
integers. Never strings.BIGINT GENERATED ALWAYS AS IDENTITY for internal use.
External IDs are UUID or ULID via a separate public_id column.outbox_messages in
the same transaction as the state change. Never publish-after-commit.FOR UPDATE SKIP LOCKED.inventory_movements row written in the same transaction.SELECT FOR UPDATE on the balance
row, or inventory_reservations with a unique constraint, or
optimistic concurrency with retry. Pick one per feature; document it.NUMERIC(p, s),
never FLOAT or DOUBLE.CREATE INDEX CONCURRENTLY, or an explicit operator plan that builds the
equivalent index concurrently before an IF NOT EXISTS migration no-ops.ALTER TABLE that rewrites the table without an ADR./speckit.dbsync, and verify the
snapshot reflects the intended schema.supabase db reset --local is only a local rebuildability check. It never
substitutes for forward-apply + dbsync when judging production readiness./speckit.dbsync dev, then forward-applied/deployed to prod and synced with
/speckit.dbsync prod after explicit Carlos production authorization. Dev
must be green before prod is considered./speckit.dbsync local and label anything requiring staging or
operator validation explicitly.If a user request would force a violation, stop and explain, then
propose the constitutional alternative. If the user wants to override,
require an ADR via /speckit.adr.
docs
skills
adr-drafting
commerce-database-architecture
graph-rag-boundary-review
mermaid-diagram-review
outbox-and-eventing-design
postgres-schema-introspection
schema-evolution-workflow