jooq-database-access

jooq-database-access is a cursor rule for coding agents from e-gov/cursor-prompts. It costs 1,615 tokens per session, scanned A, original, MIT.

A set of Java rules for using jOOQ, a library that builds database queries in code, for database access.

In plain words
What is it for?
Use it when writing or changing service or repository code that reads from or writes to a database.
Why use it?
It keeps database queries, result mapping, and connection handling consistent across the project.

Cursor rule

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/e-gov/cursor-prompts/jooq-database-access
Clone the repo
git clone --depth 1 https://github.com/e-gov/cursor-prompts

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for jooq-database-access

README.md
[![agentmods](https://agentmods.dev/badge/rules/e-gov/cursor-prompts/jooq-database-access.svg)](https://agentmods.dev/rules/e-gov/cursor-prompts/jooq-database-access)
Your own site
<a href="https://agentmods.dev/rules/e-gov/cursor-prompts/jooq-database-access"><img src="https://agentmods.dev/badge/rules/e-gov/cursor-prompts/jooq-database-access.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,615 This file is loaded in full into every session.
When invoked 1,615 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.01615 $0.01615
Opus 5 $0.00807 $0.00807
Sonnet 5 $0.00323 $0.00323
Haiku 4.5 $0.00161 $0.00161

Measured 4d ago against content hash e3c97186f15b, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

jooq-database-access scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

rules/java-common/jooq-database-access.mdc · 154 lines

How it starts

The opening of the file, as written. The whole thing — 154 lines — stays where its author put it; the contents beside it link to each section on GitHub.

jOOQ DSL and Database Access Conventions

Context

  • Apply when writing or modifying database access logic using jOOQ, typically within service or repository classes.
  • Focuses on consistent use of the jOOQ DSL and mapping.
  • Retry Logic: Retry mechanisms are framework-specific. Refer to:
    • Spring Boot: mdc:rules/java-spring-boot/spring-retry-conventions.mdc
    • Micronaut: mdc:rules/java-micronaut/micronaut-retry-conventions.mdc
  • Transaction Management: Managed by the specific framework (Spring/Micronaut). Refer to framework convention rules.
  • Auditing: For conventions on using the AuditLogger, see mdc:rules/java-common/audit-logging.mdc.

Requirements

  • Database Interaction: Use jOOQ (DSLContext) injected via constructor for all database operations. Avoid Spring Data JPA repositories or raw JDBC.
  • Type-Safe DSL: ALWAYS use the jOOQ type-safe DSL (generated tables/fields like BOOK.TITLE) over constructing queries with raw SQL strings.
  • Mapping: Implement clear logic (e.g., dedicated private methods like mapToXyz) to map jOOQ Record objects to application DTOs/models (BookResponse, etc.).
  • Connection Handling: Rely on the framework's transaction management (Spring/Micronaut) and jOOQ integration for connection handling; do not manage connections manually.

Examples

// ... inside a service method (retry/transaction/audit handled by framework/other rules) ... public List findCheapBooks() { // The actual DB call might be wrapped by retry logic elsewhere (see specific retry rules) List cheapBooks = dsl.selectFrom(BOOK) .where(BOOK.PRICE.lt(BigDecimal.TEN)) // Type-safe condition .orderBy(BOOK.TITLE.asc()) .fetchStream() .map(this::mapToBookResponse) // Mapping function .toList();

  // Auditing is handled separately (see mdc:rules/java-common/audit-logging.mdc)
  // if (!cheapBooks.isEmpty()) { AuditLogger.logBatchOperation(...); }

  return cheapBooks;

}

private BookResponse mapToBookResponse(BookRecord record) { // ... mapping implementation ... }

</example>

Read the full file on GitHub · 154 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 154 lines · 1,615 tokens per session scan A e3c97186f15b

Subscribe to this mod's changes

jooq-database-access is a cursor rule published in the GitHub repository e-gov/cursor-prompts (34 stars, last pushed 4mo ago), licensed MIT. It adds 1,615 tokens to every session, about $0.0081 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.