Howto Develop With Postgres logo

Howto Develop With Postgres

Organization
ed3dai
howto-develop-with-postgres

Use when writing database access code, creating schemas, or managing transactions with PostgreSQL - enforces transaction safety with TX_ naming, read-write separation, type safety for UUIDs/JSONB, and snake_case conventions to prevent data corruption and type errors

Overview

Publishered3dai
Repositoryed3d-plugins
Skill namehowto-develop-with-postgres
Stars
249
Forks
33
Bundled files
1
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 1 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by ed3dai on GitHub. Read the source before you install it.

Installation

Install the Howto Develop With Postgres AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/ed3dai/ed3d-plugins.git /tmp/ed3d-plugins
mkdir -p .claude/skills
cp -r /tmp/ed3d-plugins/plugins/ed3d-house-style/skills/howto-develop-with-postgres .claude/skills/howto-develop-with-postgres
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Howto Develop With Postgres in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Howto Develop With Postgres on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Howto Develop With Postgres is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

PostgreSQL Development Patterns

Overview

Enforce transaction safety, type safety, and naming conventions to prevent data corruption and runtime errors.

Core principles:

  • Transactions prevent partial updates (data corruption)
  • Type safety catches errors at compile time
  • Naming conventions ensure consistency
  • Read-write separation prevents accidental mutations

For TypeScript/Drizzle implementations: See typescript-drizzle.md for concrete patterns.

Transaction Management

TX_ Prefix Rule (STRICT ENFORCEMENT)

Methods that START transactions:

  • Prefix method name with TX_
  • Must NOT accept connection/executor parameter
  • Call connection.transaction() or db.transaction() internally

Methods that PARTICIPATE in transactions:

  • No TX_ prefix
  • MUST accept connection/executor parameter with default value
  • Execute queries using the provided executor
typescript
// GOOD: Starts transaction, has TX_ prefix, no executor parameter
async TX_createUserWithProfile(userData: UserData, profileData: ProfileData): Promise<User> {
  return this.db.transaction(async (tx) => {
    const user = await this.createUser(userData, tx);
    await this.createProfile(user.id, profileData, tx);
    return user;
  });
}

// GOOD: Participates in transaction, no TX_ prefix, takes executor
async createUser(userData: UserData, executor: Drizzle = this.db): Promise<User> {
  return executor.insert(USERS).values(userData).returning();
}

// BAD: Starts transaction but missing TX_ prefix
async createUserWithProfile(userData: UserData, profileData: ProfileData): Promise<User> {
  return this.db.transaction(async (tx) => { /* ... */ });
}

// BAD: Has TX_ prefix but takes executor parameter (allows nesting)
async TX_createUser(userData: UserData, executor: Drizzle = this.db): Promise<User> {
  return executor.transaction(async (tx) => { /* ... */ });
}

What DOES NOT count as "starting a transaction":

  • Single INSERT/UPDATE/DELETE operations
  • Atomic operations like onConflictDoUpdate
  • SELECT queries

Type Safety

Primary Keys

Default: ULID stored as UUID

  • When in doubt, use ULID: "Most things can leak in some way"
  • Prevents ID enumeration attacks
  • Time-sortable for indexing efficiency

Exceptions (context-dependent):

  • Pure join tables (composite PK from both FKs)
  • Small lookup tables (serial/identity acceptable)
  • Internal-only tables with no user visibility (serial/identity acceptable)

Rule: If unsure whether data will be user-visible, use ULID.

Financial Data

Use exact decimal types (numeric/decimal) for monetary values:

  • Never use float/double for money (causes rounding errors)
  • Use numeric/decimal with appropriate precision and scale
  • Example: numeric(19, 4) for general financial data

Why: Floating-point types accumulate rounding errors. Exact decimal types prevent financial discrepancies.

JSONB Columns

ALWAYS type JSONB columns in your ORM/schema:

  • Use typed schema when structure is known
  • Use Record<string, unknown> if truly schemaless
  • Never leave JSONB untyped

Why: Prevents runtime errors from accessing undefined properties or wrong types.

Read-Write Separation

Maintain separate client types at compile time:

  • Read-write client: Full mutation capabilities
  • Read-only client: Mutation methods removed at type level
  • Default to read-only for query methods
  • Use read-write only when mutations needed

Why: Prevents accidental writes to replica, enforces deliberate mutation choices.

Naming Conventions

Database Identifiers

All database objects use snake_case:

  • Tables: user_preferences, order_items
  • Columns: created_at, user_id, is_active
  • Indexes: idx_tablename_columns (e.g., idx_users_email)
  • Foreign keys: fk_tablename_reftable (e.g., fk_orders_users)

Application code: Map to idiomatic case (camelCase in TypeScript, etc.)

Schema Patterns

Standard mixins:

  • created_at, updated_at timestamps on all tables
  • deleted_at for soft deletion when needed
  • tenant_id for multi-tenant tables (project-dependent)

Proactive indexing:

  • All foreign key columns
  • Columns used in WHERE clauses
  • Columns used in JOIN conditions
  • Columns used in ORDER BY

Concurrency

Default isolation (Read Committed) for most operations.

Use stricter isolation when:

  • Financial operations: Serializable isolation
  • Inventory/count operations: Serializable isolation
  • Critical sections: Pessimistic locking (SELECT ... FOR UPDATE)

Migrations

Always use generate + migrate workflow:

  1. Change schema in code
  2. Generate migration file
  3. Review migration SQL
  4. Apply migration to database

Never use auto-push workflow in production.

Common Mistakes

MistakeRealityFix
"This is one operation, doesn't need transaction"Multi-step operations without transactions cause partial updates and data corruptionWrap in transaction with TX_ prefix
"Single atomic operation needs TX_ prefix"TX_ is for explicit transaction blocks, not atomic operationsNo TX_ for single INSERT/UPDATE/DELETE
"UUID is just a string"Type confusion causes runtime errors (wrong ID formats, failed lookups)Use strict UUID type in language
"I'll type JSONB later when schema stabilizes"Untyped JSONB leads to undefined property access and type errorsType immediately with known fields or Record<string, unknown>
"Read client vs write client doesn't matter"Using wrong client bypasses separation, allows accidental mutationsUse read-only client by default, switch deliberately
"I'll add indexes when we see performance issues"Missing indexes on foreign keys cause slow queries from day oneAdd indexes proactively for FKs and common filters
"This table won't be user-visible, use serial"Requirements change, IDs leak in logs/URLs/errorsUse ULID by default unless certain it's internal-only
"Float/double is fine for money, close enough"Rounding errors accumulate, causing financial discrepancies (0.01 differences multiply)Use numeric/decimal types for exact arithmetic

Red Flags - STOP and Refactor

Transaction management:

  • Method calls .transaction() but no TX_ prefix
  • Method has TX_ prefix but accepts executor parameter
  • Multi-step operation without transaction wrapper

Type safety:

  • JSONB column without type annotation
  • UUID/ULID stored as plain string type
  • No separation between read and write clients
  • Float/double types for monetary values

Schema:

  • Missing indexes on foreign keys
  • No created_at/updated_at timestamps
  • camelCase or PascalCase in database identifiers

All of these mean: Stop and fix immediately.

Reference

For TypeScript/Drizzle concrete implementations: typescript-drizzle.md

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Howto Develop With Postgres AI skill do?

Use when writing database access code, creating schemas, or managing transactions with PostgreSQL - enforces transaction safety with TX_ naming, read-write separation, type safety for UUIDs/JSONB, and snake_case conventions to prevent data corruption and type errors

Why use Howto Develop With Postgres on TypingMind?

Because you install it once and use it with any model. Howto Develop With Postgres is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Howto Develop With Postgres in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/ed3dai/ed3d-plugins/tree/main/plugins/ed3d-house-style/skills/howto-develop-with-postgres. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Howto Develop With Postgres?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Howto Develop With Postgres?

As many as you like. As long as a model supports skills, you can use Howto Develop With Postgres with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Howto Develop With Postgres AI skill free?

It is published on GitHub by ed3dai. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇