Agent skill

Java Persistence

by makifbaysal in makifbaysal/tasktrooper

A skill your agent uses when a Java service reads or writes the database - JPA/Hibernate and Panache/Spring Data mapping, transaction boundaries, pagination and avoiding N+1 and entity-over-the-wire…

Apache-2.0Auto-check passedDatabases

Install Java Persistence

skills CLI
$ npx skills add makifbaysal/tasktrooper --skill java-persistence -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install makifbaysal/tasktrooper java-persistence --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/makifbaysal/tasktrooper.git skills-src && mkdir -p .claude/skills && cp -r skills-src/catalog/agents/backend-developer/skills/java-persistence .claude/skills/java-persistence && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
java-persistence
GitHub stars
109
Token cost
~1.3k tokens
SKILL.md length
552 words
Files
1
Skills in repo
99
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when a Java service reads or writes the database - JPA/Hibernate and Panache/Spring Data mapping, transaction boundaries, pagination and avoiding N+1 and entity-over-the-wire…

  • A Java service reads
  • SKILL.md covers Overview, Mapping surface, Rules and Worked Example — killing an…, plus 2 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Writes the database - JPA/Hibernate and Panache/Spring Data mapping

What it does

Java Persistence is an agent skill from makifbaysal/tasktrooper. Use when a Java service reads or writes the database - JPA/Hibernate and Panache/Spring Data mapping, transaction boundaries, pagination and avoiding N+1 and entity-over-the-wire leaks

Its SKILL.md is about 1.3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering ORMs and data access. It works with Java. The repository describes itself as: Local-first agent platform: board + role agents + agent CLI runs (Claude Code, Cursor, Antigravity, OpenCode) or local and API models (Ollama, LM Studio), all on your own Mac. The licence is Apache-2.0.

When your agent uses it

  • A Java service reads
  • Writes the database - JPA/Hibernate and Panache/Spring Data mapping
  • Transaction boundaries
  • Pagination and avoiding N+1 and entity-over-the-wire leaks

Example prompts

  • “/java-persistence”

What it can do on your machine

Read from SKILL.md and the folder at commit f3d59b5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Java Persistence loads about 1.3k tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 552 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~50
When it runs · the whole SKILL.md, loaded when a task matches
~1.3k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from makifbaysal/tasktrooper at commit f3d59b5, republished under its Apache-2.0 licence (© makifbaysal). 552 words, ~1,348 tokens.

Download SKILL.mdSave it as .claude/skills/java-persistence/SKILL.md (or your agent's skills folder).
name
java-persistence
description
Use when a Java service reads or writes the database - JPA/Hibernate and Panache/Spring Data mapping, transaction boundaries, pagination and avoiding N+1 and entity-over-the-wire leaks
category
architecture
tech_stack
Java

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

ConcernQuarkus (Panache)Spring Data
Entity@Entity + PanacheEntityBase or plain @Entity@Entity
Repositoryimplements PanacheRepository<Task>extends JpaRepository<Task, UUID>
Queryfind("status", s) / HQLderived 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.
Show full SKILL.md (151 more words)Show less

Worked Example — killing an N+1 without breaking pagination

java
// ❌ N+1: one query for projects, then one per project for its tasks
List<Project> projects = repo.findAll(pageable).getContent();
projects.forEach(p -> total += p.getTasks().size());   // lazy hit per row

// ❌ "fixed" with a fetch join but now unbounded: Hibernate pages in memory
@Query("select p from Project p left join fetch p.tasks")
Page<Project> findAllWithTasks(Pageable pageable);   // HHH90003004

// ✅ page the roots first (no collection fetch), then fetch by id with the join
Page<UUID> ids = repo.findIds(pageable);
List<Project> page = repo.findByIdInWithTasks(ids.getContent());

Add a query-count assertion (Hibernate Statistics, see java-testing-junit-mockito) so the N+1 can't creep back in, and a test on the test profile with hibernate.query.fail_on_pagination_over_collection_fetch=true so an accidental collection-fetch-plus-page regresses loudly instead of just getting slow.

Common Mistakes

  • @Transactional on the repository or resource instead of the service.
  • Serializing entities in the HTTP response.
  • findAll()/listAll() with no paging.
  • Paginating a query that also does a collection JOIN FETCH.
  • hbm2ddl=update / Quarkus schema generation in a real environment instead of migrations.
  • Testing on H2 where the SQL dialect differs from Postgres (java-testing-junit-mockito: use Testcontainers).
  • Letting OptimisticLockException surface as an unmapped 500.

Red Flags

  • LazyInitializationException in an HTTP response → you serialized an entity outside the transaction.
  • Query count scales with row count → N+1.
  • HHH90003004 in the logs, or a pagination query that also lists fetch in its JPQL.
  • Schema changes with no migration file in the diff.

© makifbaysal, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in catalog/agents/backend-developer/skills/java-persistence of makifbaysal/tasktrooper.

Open the folder on GitHubat commit f3d59b5

Compare with similar skills

Java Persistence next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Java Persistence compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Java Persistence this skillmakifbaysal/tasktrooper109—~1.3kAutomated safety check: PassApache-2.0
144 Java Data Oriented Programmingjabrena/plinth445—~979Automated safety check: PassApache-2.0
Jimmer OrmCoooolfan/XiaomiAlbumSyncer418—~702Automated safety check: PassGPL-3.0
Java Injection Auditwgpsec/AboutSecurity1.8k—~1.1kAutomated safety check: PassNone
Content Create Hero Imageprisma/web1.1k—~6.9kAutomated safety check: PassNone
Sea Orm 2FlyinPancake/yoink112—~2.9kAutomated safety check: PassApache-2.0

Similar skills

  • A skill your agent uses when you need to apply data-oriented programming best practices in Java — including separating code (behavior) from data structures using records, designing immutable data…

    445 GitHub stars~979 tokensUpdated today
    DatabasesAuto-check passed
  • Jimmer Orm

    Coooolfan/XiaomiAlbumSyncer

    Jimmer ORM 开发助手(XiaomiAlbumSyncer 服务端),帮助编写实体映射代码、DTO 和 DSL 查询语句。适用于:(1) 定义或修改 Jimmer 实体(使用 @Entity 注解的 interface);(2) 编写 Jimmer DSL 查询代码;(3) 配置实体关联关系(@ManyToOne, @OneToMany, @ManyToMany);(4)…

    418 GitHub stars~702 tokensUpdated yesterday
    DatabasesAuto-check passed
  • Java Injection Audit

    wgpsec/AboutSecurity

    Java 源码注入类漏洞审计。当在 Java 白盒审计中需要检测注入类漏洞时触发. An agent skill from wgpsec/AboutSecurity.

    1.8k GitHub stars~1.1k tokensUpdated 4 days ago
    DatabasesAuto-check passed
  • Official

    A skill your agent uses when the operator wants a hero or meta image for a Prisma blog post; asks to create or generate a blog hero, cover, social card, Open Graph, or YouTube image; mentions cover…

    1.1k GitHub stars~6.9k tokensUpdated today
    DatabasesAuto-check passed
  • Sea Orm 2

    FlyinPancake/yoink

    Expert guidance for SeaORM 2.0, Rust's async ORM with strongly-typed columns, nested ActiveModels, Entity Loader API, and entity-first workflow.

    112 GitHub stars~2.9k tokensUpdated 2 days ago
    DatabasesAuto-check passed
  • Prisma Client API

    curvenote/curvenote

    Prisma Client API reference covering model queries, filters, operators, and client methods.

    169 GitHub starsUsed in 2 repos~1.6k tokens
    DatabasesAuto-check passed

More from makifbaysal/tasktrooper

All 99 skills in this repo
  • API Contract Testing

    makifbaysal/tasktrooper

    A skill your agent uses when a task adds or changes an HTTP endpoint, its request/response shape, status codes, auth or error format - the request matrix, curl templates and what counts as a…

    109 GitHub starsUsed in 1 repo~754 tokens
    Auto-check passed
  • Acceptance Criteria Gwt

    makifbaysal/tasktrooper

    A skill your agent uses when writing acceptance criteria for a task - express each as an observable Given/When/Then that QA can execute, including negative cases

    109 GitHub stars~1.7k tokensUpdated yesterday
    Auto-check passed
  • Accessibility Check

    makifbaysal/tasktrooper

    A skill your agent uses when a task changes any screen, form, dialog, menu or control - Lighthouse/axe scan of the changed screens, a keyboard walk, and the thresholds that fail a task

    109 GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • Analiz Gate

    makifbaysal/tasktrooper

    A skill your agent uses when deciding whether a request needs an analiz task before implementation - the conditions that require the architect's analysis versus going straight to implementation

    109 GitHub stars~641 tokensUpdated yesterday
    Auto-check passed
  • Analiz HTML Report

    makifbaysal/tasktrooper

    A skill your agent uses when you write or revise the analiz deliverable - the ONE self-contained HTML report (spec and plan as sections) a human reviews passage by passage

    109 GitHub stars~3.9k tokensUpdated yesterday
    Auto-check passed
  • Analiz Human Review Gate

    makifbaysal/tasktrooper

    A skill your agent uses when you finish an analiz report - the human must approve the analysis before any implementation task is created, via the analizreview column

    109 GitHub stars~2.2k tokensUpdated yesterday
    Auto-check passed

Works with

Categories

Questions about Java Persistence

What does Java Persistence do?

A skill your agent uses when a Java service reads or writes the database - JPA/Hibernate and Panache/Spring Data mapping, transaction boundaries, pagination and avoiding N+1 and entity-over-the-wire…. Java Persistence is an agent skill from makifbaysal/tasktrooper.

When should I use Java Persistence?

Java Persistence fits situations like: A Java service reads; writes the database - JPA/Hibernate and Panache/Spring Data mapping; transaction boundaries; pagination and avoiding N+1 and entity-over-the-wire leaks.

How do I install Java Persistence in Claude Code?

Run `npx skills add makifbaysal/tasktrooper --skill java-persistence -a claude-code`. Or copy the skill folder (catalog/agents/backend-developer/skills/java-persistence in makifbaysal/tasktrooper) into .claude/skills/java-persistence in your project. Claude Code loads it when a task matches its description.

How do I install Java Persistence in Codex?

Run `npx skills add makifbaysal/tasktrooper --skill java-persistence -a codex`. Or copy the skill folder (catalog/agents/backend-developer/skills/java-persistence in makifbaysal/tasktrooper) into .agents/skills/java-persistence in your project. Codex loads it when a task matches its description.

Can I use Java Persistence in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add makifbaysal/tasktrooper --skill java-persistence -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/java-persistence, .gemini/skills/java-persistence, .github/skills/java-persistence and .opencode/skills/java-persistence in your project.

What does Java Persistence need to run?

SKILL.md names no scripts, command-line tools or credentials: Java Persistence is instructions for the agent only.

Does Java Persistence access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Java Persistence safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Java Persistence use?

Java Persistence is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Java Persistence use?

About 1.3k tokens (SKILL.md is roughly 5.4k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Java Persistence?

Skills that share tags, products or a category with Java Persistence: 144 Java Data Oriented Programming (jabrena/plinth, 445 stars), Jimmer Orm (Coooolfan/XiaomiAlbumSyncer, 418 stars), Java Injection Audit (wgpsec/AboutSecurity, 1.8k stars) and Content Create Hero Image (prisma/web, 1.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Java Persistence?

makifbaysal (a GitHub user) maintains it in makifbaysal/tasktrooper, which has 109 GitHub stars. The repository holds 99 skills in this directory. The repository was last updated on October 6, 2026.

Source: makifbaysal/tasktrooper on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.