java-persistence

java-persistence is a skill for Claude Code, Codex from makifbaysal/tasktrooper. It costs 42 tokens per session (1,269 once invoked), scanned A, original, Apache-2.0.

A guide to database access in Java services with JPA, Hibernate, Panache or Spring Data. It covers mapping objects to database rows, transactions, pagination and query behaviour.

In plain words
What is it for?
Use it when creating entities, repositories and queries, or when fixing pagination, locking, schema and transaction issues.
Why use it?
It prevents common data-access problems such as loading too many rows, issuing one query per result, leaking database objects through an API or using the wrong transaction boundary.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when creating entities, repositories and queries, or when fixing pagination, locking, schema and transaction issues.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/makifbaysal/tasktrooper/java-persistence
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.

Any agent
npx skills add makifbaysal/tasktrooper --skill java-persistence
Clone the repo
git clone --depth 1 https://github.com/makifbaysal/tasktrooper

Made for: Claude Code, Codex.

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 java-persistence

README.md
[![agentmods](https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/java-persistence/github.svg)](https://agentmods.dev/skills/makifbaysal/tasktrooper/java-persistence)
Your own site
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/java-persistence"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/java-persistence/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for java-persistence

Your own site · 80×15
<a href="https://agentmods.dev/skills/makifbaysal/tasktrooper/java-persistence"><img src="https://agentmods.dev/badge/skills/makifbaysal/tasktrooper/java-persistence.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,269 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00042 $0.01269
Opus 5.5 $0.00017 $0.00508
Sonnet 5.5 $0.00008 $0.00254
Haiku 4.5 $0.00004 $0.00127

Measured 8d ago against content hash 0bf3ab9466b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

java-persistence 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 8d 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.

catalog/agents/backend-developer/skills/java-persistence/SKILL.md · 72 lines

How it starts

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

Java Persistence (JPA / Panache / Spring Data)

Overview

Persistence is where Java services most often leak — lazy-loading exceptions, N+1 queries, entities serialized over HTTP, pagination applied in memory. Keep persistence at the repository boundary and mapped deliberately.

Core principle: Entities are a persistence detail. They never cross the HTTP boundary and they never carry business logic that belongs in the domain. Every list query is bounded AND the bound is honored by the SQL, not by Java code truncating a full result set.

Mapping surface

Concern Quarkus (Panache) Spring Data
Entity @Entity + PanacheEntityBase or plain @Entity @Entity
Repository implements PanacheRepository<Task> extends JpaRepository<Task, UUID>
Query find("status", s) / HQL derived methods / @Query
Transaction @Transactional on the service @Transactional on the service
Pagination .page(Page.of(n, size)) Pageable / Page<T>
Optimistic lock @Version @Version
Schema management (non-test) quarkus.hibernate-orm.schema-management.strategy=none (or validate; property renamed from database.generation in 3.23) spring.jpa.hibernate.ddl-auto=validate

Rules

  • Transaction boundary = the service method, never the repository or the resource. One use-case = one transaction.
  • Never return entities from a controller/resource. Map to a DTO inside the service (or a JPA projection). Returning entities causes lazy-init serialization errors and leaks the schema.
  • Fetch deliberately to avoid N+1. A loop that touches a lazy collection per row issues a query per row. Use a JOIN FETCH / entity graph / @BatchSize or hibernate.default_batch_fetch_size, and verify with a query-count assertion in a test.
  • Never paginate a collection JOIN FETCH. Hibernate applies LIMIT/OFFSET in memory when the query also fetches a *-to-many collection (warning HHH90003004) — it loads the whole table to paginate it. Set hibernate.query.fail_on_pagination_over_collection_fetch=true in the test profile so this fails loudly instead of shipping slow. Page the root entity's ids first (plain query, no fetch join), then fetch the page by id with the collection join, or rely on @BatchSize/hibernate.default_batch_fetch_size instead of a fetch join at all.
  • Bound every list query. Page (Page/Pageable, Panache .page(...)) — never findAll()/listAll() on a growing table. Default and maximum page size live with the endpoint (api-design-conventions), not just the repository call.
  • Migrations own the schema, not hibernate.hbm2ddl=update/Quarkus generate-schema. Set validate/none in non-test envs; schema changes go through a migration (postgres-migrations), never auto-DDL in production.
  • Optimistic locking (@Version) on entities with concurrent updates; map OptimisticLockException/ObjectOptimisticLockingFailureException to 409 in the central error mapper (api-design-conventions), never let it surface as 500.
  • spring.jpa.open-in-view=false (Spring) — Open Session In View hides N+1s in the view layer and that lazy access outside a clear transaction boundary is exactly the mistake this skill exists to prevent.

Read the full file on GitHub · 72 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. 8d ago First seen · 72 lines · 42 tokens per session scan A 0bf3ab9466b9

Subscribe to this mod's changes

java-persistence is a skill published in the GitHub repository makifbaysal/tasktrooper (113 stars, last pushed yesterday), licensed Apache-2.0. It adds 42 tokens to every session and 1,269 once invoked, about $0.0002 per session on Opus 5.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-10-05.

Related

Other skills, from other repositories

agentscope-java

Expert Java developer skill for AgentScope Java framework - a reactive, message-driven multi-agent system built on Project Reactor. Use when working with reactive programming, LLM integration, agent orchestration, multi-agent systems, or when the user mentions AgentScope, ReActAgent, Mono/Flux, Project Reactor, or…

agentscope-ai/agentscope-java · 91 tokens

azure-data-tables-java

Build table storage applications with Azure Tables SDK for Java. Use when working with Azure Table Storage or Cosmos DB Table API for NoSQL key-value data, schemaless storage, or structured data at scale.

microsoft/skills · 47 tokens

azure-cosmos-java

Azure Cosmos DB SDK for Java. NoSQL database operations with global distribution, multi-model support, and reactive patterns. Triggers: "CosmosClient java", "CosmosAsyncClient", "cosmos database java", "cosmosdb java", "document database java".

microsoft/skills · 59 tokens

cuopt-routing-api-python

Vehicle routing (VRP, TSP, PDP) with cuOpt — Python API only. Use when the user is building or solving routing in Python.

NVIDIA/skills · 37 tokens

mcore-linting-and-formatting

Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.

NVIDIA/skills · 44 tokens

doca-argp

Use this skill for hands-on DOCA Arg Parser CLI work on a shipped sample or new DOCA-using app — adding / removing / renaming flags; wiring docaargpinit → register params → docaargpstart → docaargpdestroy in order; picking a parameter type from the full public enum (DOCAARGPTYPESTRING, INT, BOOLEAN, DEVICE, DEVICEREP…

NVIDIA/skills · 267 tokens