agentleFS
ptonlixptonlix/OneSelf/.agents/skills/drizzle-best-practices/AGENTS.md

OneSelf / drizzle-best-practices

AGENTS.md21 starsChanged 10 days agoMITView on GitHub

Comprehensive best practices guide for Drizzle ORM with PostgreSQL. Contains guidance across 8 categories, prioritized by impact to help AI agents generate correct, performant, and idiomatic Drizzle code. Reference these guidelines when: Read individual reference files for detailed explanations and code examples: Each reference file contains:

The file

We split this AGENTS.md into the rules it gives an agent

2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Read SKILL.md for the main skill instructions

    line 25
  2. Distinctive:

    Read individual reference files for detailed explanations and code examples:

    line 61

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “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
AGENTS.md

Drizzle ORM Best Practices (PostgreSQL)

Structure

drizzle-best-practices/
  SKILL.md                # Main skill file - read this first
  AGENTS.md               # This navigation guide
  CLAUDE.md               # Symlink to AGENTS.md
  references/
    engine-postgres.md    # Postgres-specific types, features, and idioms
    schema-*.md           # Schema design patterns
    query-*.md            # Query patterns
    relations-*.md        # Relation definitions and relational queries
    migrations-*.md       # Drizzle Kit configuration and workflow
    types-*.md            # TypeScript type inference and custom types
    perf-*.md             # Performance optimization
    driver-*.md           # Driver setup and serverless configuration
    advanced-*.md         # Dynamic queries, raw SQL, power-user patterns
    _sections.md          # Full index of all reference files

Usage

  1. Read SKILL.md for the main skill instructions
  2. Browse references/ for detailed documentation on specific topics
  3. Reference files are loaded on-demand — read only what you need

Comprehensive best practices guide for Drizzle ORM with PostgreSQL. Contains guidance across 8 categories, prioritized by impact to help AI agents generate correct, performant, and idiomatic Drizzle code.

When to Apply

Reference these guidelines when:

  • Defining table schemas with pgTable
  • Writing select, insert, update, or delete queries
  • Setting up relations between tables
  • Configuring drizzle-kit for migrations
  • Inferring TypeScript types from your schema
  • Choosing between the SQL-like API and the relational query API
  • Optimizing query performance
  • Integrating Drizzle with serverless Postgres providers (Neon, Supabase, etc.)

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Schema DesignCRITICALschema-
2Query PatternsCRITICALquery-
3RelationsHIGHrelations-
4MigrationsHIGHmigrations-
5Type SafetyMEDIUM-HIGHtypes-
6PerformanceMEDIUMperf-
7Database DriversMEDIUMdriver-
8Advanced PatternsLOWadvanced-

How to Use

Read individual reference files for detailed explanations and code examples:

references/engine-postgres.md
references/schema-table-definitions.md
references/schema-column-types.md
references/schema-indexes-constraints.md
references/query-select-patterns.md
references/query-mutations.md
references/query-filters-operators.md
references/query-error-handling.md
references/relations-defining.md
references/relations-querying.md
references/migrations-config.md
references/migrations-workflow.md
references/types-inference.md
references/types-custom-types.md
references/types-validators.md
references/perf-prepared-statements.md
references/perf-batch-operations.md
references/driver-postgres.md
references/driver-serverless.md
references/advanced-dynamic-queries.md
references/advanced-sql-operator.md
references/_sections.md

Each reference file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Links to official Drizzle documentation

References

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.