database-expert

Document database architecture decisions for per-node data, migrations, and RLS configurations.

4|5|Updated Nov 5, 2025
One-click install
npx skills add https://github.com/cogni-dao/cogni --skill database-expert-cogni-dao
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: database-expert
Source: https://github.com/cogni-dao/cogni/tree/main/.claude/skills/database-expert
Command: npx skills add https://github.com/cogni-dao/cogni --skill database-expert-cogni-dao

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Cogni-template DB architecture reference — Postgres-vs-Doltgres split (operational vs AI-written data), per-node schema independence, drizzle configs, RLS (app_user/app_service), migrator images, Doltgres syntropy rules, and the gotchas. Use when adding/modifying DB tables, deciding which DB a new table belongs in, writing migrations, running pnpm db:*, debugging drizzle-kit errors, touching @cogni/db-schema or any @cogni/<node>-{db,doltgres}-schema, or dealing with DATABASE_URL / DOLTGRES_URL / __drizzle_migrations / per-node migrator Dockerfiles.

Core Features & Use Cases

  • Ground-truth guidance for per-node database architecture decisions, migrations, and tooling alignment across Postgres and Doltgres.
  • Clear rules for per-node schema independence, RLS setup, and migrator workflow to avoid cross-node leakage.
  • Real-world scenarios: adding a new per-node table, choosing Doltgres for AI-knowledge data, and aligning drizzle migrations with node boundaries.

Quick Start

Follow the per-node database guidelines to decide Postgres vs Doltgres before creating or migrating any table.

Frequently Asked Questions about database-expert

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decide whether to use Postgres or Doltgres for a new database table?

To decide between Postgres and Doltgres for a new database table, assign operational data to Postgres and AI-written knowledge data to Doltgres. This split maintains per-node schema independence and enforces correct multi-node tenancy boundaries.

What is the correct way to configure RLS in a multi-node Postgres setup?

Configuring RLS in a multi-node Postgres setup requires defining app_user and app_service roles. This enforces row-level security and prevents cross-node data leakage while maintaining strict per-node package boundaries.

How do I align drizzle-kit migrations with per-node schema boundaries?

To align drizzle-kit migrations with per-node schema boundaries, use explicit migrations within dedicated per-node schema packages. Ensure each node has its own migrator image and drizzle configuration to prevent cross-node leakage.

How do I handle DATABASE_URL and DOLTGRES_URL when debugging drizzle migration errors?

Handle DATABASE_URL and DOLTGRES_URL by following explicit DSN and URL handling rules to route connections correctly. This resolves drizzle-kit errors and ensures migrations target the correct per-node database instance.

Why do I need separate per-node migrator Dockerfiles for my Postgres schemas?

Separate per-node migrator Dockerfiles are needed to enforce per-node schema independence and package boundaries. This isolation prevents cross-node migration conflicts and ensures each node manages its own database schema evolution.