kotlin-backend-jpa-entity-mapping

kotlin-backend-jpa-entity-mapping is a skill for Claude Code, Codex from Kotlin/kotlin-agent-skills. It costs 104 tokens per session (1,633 once invoked), scanned A, original, Apache-2.0.

A set of design guidelines for Kotlin classes that store data through Spring Data JPA and Hibernate, tools that map objects to database tables.

In plain words
What is it for?
Use it to create or review JPA entities, IDs, equality methods, unique fields, relationships, fetch plans, and Kotlin-specific ORM configuration.
Why use it?
It helps avoid Kotlin features and object relationships that can cause incorrect identity, equality, loading, or database-constraint behavior.

Skill for Claude CodeCodex

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

Good fit Use it to create or review JPA entities, IDs, equality methods, unique fields, relationships, fetch plans, and Kotlin-specific ORM configuration.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kotlin/kotlin-agent-skills/kotlin-backend-jpa-entity-mapping
About the project

Kotlin/kotlin-agent-skills is a collection of packaged instructions, scripts, and resources that help coding agents handle projects written in Kotlin. It is for developers using Kotlin, with skills covering areas such as backend frameworks and build tooling. The catalogue entries are the individual Kotlin-focused skills distributed from the repository.

Kotlin/kotlin-agent-skills · 1,044 stars · on GitHub · kotlinlang.org

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 Kotlin/kotlin-agent-skills --skill kotlin-backend-jpa-entity-mapping
Clone the repo
git clone --depth 1 https://github.com/Kotlin/kotlin-agent-skills

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 kotlin-backend-jpa-entity-mapping

README.md
[![agentmods](https://agentmods.dev/badge/skills/kotlin/kotlin-agent-skills/kotlin-backend-jpa-entity-mapping/github.svg)](https://agentmods.dev/skills/kotlin/kotlin-agent-skills/kotlin-backend-jpa-entity-mapping)
Your own site
<a href="https://agentmods.dev/skills/kotlin/kotlin-agent-skills/kotlin-backend-jpa-entity-mapping"><img src="https://agentmods.dev/badge/skills/kotlin/kotlin-agent-skills/kotlin-backend-jpa-entity-mapping/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 kotlin-backend-jpa-entity-mapping

Your own site · 80×15
<a href="https://agentmods.dev/skills/kotlin/kotlin-agent-skills/kotlin-backend-jpa-entity-mapping"><img src="https://agentmods.dev/badge/skills/kotlin/kotlin-agent-skills/kotlin-backend-jpa-entity-mapping.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 104 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,633 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. Third-party audits
  • Socket pass 17 Mar 2026
  • Snyk pass 17 Mar 2026
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
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.00104 $0.01633
Opus 5 $0.00052 $0.00816
Sonnet 5 $0.00021 $0.00327
Haiku 4.5 $0.00010 $0.00163

Measured 12d ago against content hash 5d9c864a55c5, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

kotlin-backend-jpa-entity-mapping 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 12d 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.

skills/kotlin-backend-jpa-entity-mapping/SKILL.md · 186 lines

How it starts

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

JPA Entity Mapping for Kotlin

Kotlin's data class is natural for DTOs but dangerous for JPA entities. Hibernate relies on identity semantics that data class breaks: equals/hashCode over all fields corrupts Set/Map membership after state changes, and auto-generated copy() creates detached duplicates of managed entities.

This skill teaches correct entity design, identity strategies, and uniqueness constraints for Kotlin + Spring Data JPA projects.

Entity Design Rules

  • Never use data class for JPA entities. Use a regular class. Keep data class for DTOs.
  • Keep transport DTOs and persistence entities separate unless the project clearly uses a shared model.
  • Model required columns as non-null only when object construction and persistence lifecycle make it safe.
  • Use lateinit only when the project already accepts that tradeoff and the lifecycle is safe.
  • Verify kotlin("plugin.jpa") or equivalent no-arg support when JPA entities exist.
  • Verify classes and members are compatible with proxying where needed.

Identity and Equality

  • Never accept all-field equals/hashCode generated by data class on an entity.
  • Follow project conventions when they already define an identity strategy.
  • If no convention exists, use ID-based equality with a stable hashCode.
  • For DB-generated IDs, model the unsaved state with nullable var id: Long? = null and a protected set; do not use 0L as a sentinel value.
  • Be explicit about mutable fields and lazy associations when discussing equality.

Broken: data class Entity

// WRONG: data class generates equals/hashCode from ALL fields,
// and the generated ID uses a 0 sentinel instead of null
data class Order(
    @Id @GeneratedValue val id: Long = 0,
    var status: String,
    var total: BigDecimal
)
// BUG: order.status = "SHIPPED"; set.contains(order) → false (hash changed)
// BUG: Hibernate proxy.equals(entity) → false (proxy has lazy fields uninitialized)

Correct: Regular Class with ID-Based Identity

Read the full file on GitHub · 186 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. 12d ago First seen · 186 lines · 104 tokens per session scan A 5d9c864a55c5

Subscribe to this mod's changes

kotlin-backend-jpa-entity-mapping is a skill published in the GitHub repository Kotlin/kotlin-agent-skills (1,044 stars, last pushed today), licensed Apache-2.0. It adds 104 tokens to every session and 1,633 once invoked, about $0.0005 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.

Related

Other skills, from other repositories

supabase

Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies…

supabase/agent-skills · 185 tokens

spring-data-neo4j

Provides Spring Data Neo4j integration patterns for Spring Boot applications. Use when you need to work with a graph database, Neo4j nodes and relationships, Cypher queries, or Spring Data Neo4j. Creates node entities with @Node annotation, defines relationships with @Relationship, writes Cypher queries using @Query…

giuseppe-trisciuoglio/developer-kit · 94 tokens

spring-boot-crud-patterns

Provides and generates complete CRUD workflows for Spring Boot 3 services. Creates feature-focused architecture with Spring Data JPA aggregates, repositories, DTOs, controllers, and REST APIs. Validates domain invariants and transaction boundaries. Use when modeling Java backend services, REST API endpoints, database…

giuseppe-trisciuoglio/developer-kit · 79 tokens

nestjs-best-practices

Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration. Use when designing NestJS modules, implementing providers, creating exception filters, validating DTOs, or integrating Drizzle…

giuseppe-trisciuoglio/developer-kit · 64 tokens

spring-boot-cache

Provides patterns for implementing Spring Boot caching: configures Redis/Caffeine/EhCache providers with TTL and eviction policies, applies @Cacheable/@CacheEvict/@CachePut annotations, validates cache hit/miss behavior, and exposes metrics via Actuator. Use when adding caching to Spring Boot services, configuring…

giuseppe-trisciuoglio/developer-kit · 79 tokens

spring-data-jpa

Provides patterns to implement persistence layers with Spring Data JPA. Use when creating repositories, configuring entity relationships, writing queries (derived and @Query), setting up pagination, database auditing, transactions, UUID primary keys, multiple databases, and database indexing.

giuseppe-trisciuoglio/developer-kit · 56 tokens