agentleFS
Sequela02Sequela02/canasta/skills/stack/postgres/SKILL.md

postgres

Skill0 starsChanged yesterdayMITView on GitHub

Change or diagnose PostgreSQL schemas, queries, indexes, locks, migrations, backups, or upgrades.

23 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use mysql, redis and 3 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • planetscaleSkill

    mysql

    Plan and review MySQL/InnoDB schema, indexing, query tuning, transactions, and operations. Use when creating or modifying MySQL tables, indexes, or queries; diagnosing slow/locking behavior; planning migrations; or troubleshooting replication and connection issues. Load when using a MySQL database.

    Also in 6 projects that use this

  • Sorcha-PlatformSkill

    redis

    Implements Redis caching, session management, and distributed coordination for the Sorcha platform. Use when: Adding caching layers, token revocation, rate limiting, SignalR backplane, or distributed state.

    Also in 3 projects that use this

  • OpenAISkill

    sentry

    Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry CLI; perform read-only queries using the `sentry` command.

    Also in 3 projects that use this

  • OpenAISkill

    linear

    Manage issues, projects & team workflows in Linear. Use when the user wants to read, create or updates tickets in Linear.

    Also in 3 projects that use this

  • NVIDIASkill

    deep-research

    Queue deep, multi-step research and analysis tasks to the DeepAgents worker. Supports execution depth presets, request-specific rubrics, SubAgent delegation, and RubricMiddleware cross-validation.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

13 rules. 0 are common, 11 are distinctive, and 2 are very specific to this project.

  • 0

    Common

    Most of the 14 edited versions we read keep these.

  • 11

    Distinctive

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Keep the schema simple, enforce cross-process invariants in the database, and optimize from measured plans rather than folklore.

    line 8
  2. Distinctive:

    Use that active major for changes and tests unless an explicit upgrade slice changes it, and take the target major from that slice.

    line 15
  3. Distinctive:

    Read references/postgres-practice.md for modeling, query, migration, and operational guidance.

    line 17
  4. Very specific:

    Use TIMESTAMPTZ for instants, exact numeric types for money, and JSONB only for data whose shape or querying justifies it.

    line 27
  5. Very specific:

    Use NOT NULL, foreign keys, unique/check/exclusion constraints, and ranges for invariants that must survive concurrent processes.

    line 29
  6. Distinctive:

    Add supporting indexes for real predicates, joins, ordering, tenant filters, and foreign keys.

    line 31
  7. Distinctive:

    Prefer keyset pagination for deep ordered traversal.

    line 38
  8. Distinctive:

    Keep transactions short and make lock ordering, retry behavior, and timeout handling explicit.

    line 42
  9. Distinctive:

    Write forward migrations that are deterministic and safe for the deployment sequence.

    line 47
  10. Distinctive:

    Add preflight queries for legacy values, nullability, duplicates, enum/state changes, ownership keys, and expensive rewrites.

    line 50
  11. Distinctive:

    Run migration-from-baseline and migration-from-supported-production-state.

    line 60
  12. Distinctive:

    Use Testcontainers for dialect, constraint, JSONB, range, lock, isolation, generated-column, and Flyway behavior.

    line 61
  13. Distinctive:

    Verify hot plans, concurrency cases, backup/restore evidence, and monitoring.

    line 63

“Common” is measured: kept by at least 6 in 10 of the 14 edited versions of this file we could read. “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

PostgreSQL

Keep the schema simple, enforce cross-process invariants in the database, and optimize from measured plans rather than folklore.

Establish The Database Contract

  1. Identify the production major, extensions, collation, driver, pooler, migration tool, backup/restore path, replicas, and Testcontainers image.
  2. Use that active major for changes and tests unless an explicit upgrade slice changes it, and take the target major from that slice.
  3. Read references/postgres-practice.md for modeling, query, migration, and operational guidance.
  4. Separate application migration, database-major upgrade, and production data repair into independently verifiable slices.

Modeling And Integrity

  • Normalize first; denormalize only for a measured access path with an owner.
  • Choose identifiers from domain and distribution requirements. Do not mandate UUIDs or sequences universally.
  • Use TIMESTAMPTZ for instants, exact numeric types for money, and JSONB only for data whose shape or querying justifies it.
  • Use NOT NULL, foreign keys, unique/check/exclusion constraints, and ranges for invariants that must survive concurrent processes.
  • Add supporting indexes for real predicates, joins, ordering, tenant filters, and foreign keys. Every index adds write and maintenance cost.

Queries And Concurrency

  • Capture representative parameters and use EXPLAIN (ANALYZE, BUFFERS) for high-cost or high-volume queries in a safe environment.
  • Prefer keyset pagination for deep ordered traversal; use offset pagination when bounded pages and totals are genuinely required.
  • Address races with constraints, atomic statements, locks, isolation, or idempotency keys. An application check followed by a write is not protection.
  • Keep transactions short and make lock ordering, retry behavior, and timeout handling explicit.

Migrations And Operations

  • Write forward migrations that are deterministic and safe for the deployment sequence. Operational recovery comes from rehearsed backup/restore or rollout strategy, not a fictional universal down migration.
  • Add preflight queries for legacy values, nullability, duplicates, enum/state changes, ownership keys, and expensive rewrites.
  • Rehearse risky migrations on production-shaped isolated data and record duration, locks, storage growth, and recovery behavior.
  • A major upgrade requires extension/driver review, backup and restore or pg_upgrade rehearsal, collation/index checks, replication review, and observed application compatibility.

Verification

  • Run migration-from-baseline and migration-from-supported-production-state.
  • Use Testcontainers for dialect, constraint, JSONB, range, lock, isolation, generated-column, and Flyway behavior.
  • Verify hot plans, concurrency cases, backup/restore evidence, and monitoring.
  • Report exactly what was exercised; do not equate compilation with database readiness.

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.