← ClaudeAtlas

repositorylisted

Scaffold data access for a domain entity — a JpaRepository interface named *EntityRepository, plus optional *JdbcRepository (bulk ON CONFLICT upsert) and *AggregateRepository (QueryDSL). Use when adding persistence access.
ch4570/vulpora · ★ 1 · AI & Automation · score 67
Install: claude install-skill ch4570/vulpora
# repository — persistence-access scaffold Generate the persistence-access types for a domain entity. The naming and type (interface vs class) decisions are **load-bearing** — getting them wrong fails the build or breaks boot. > **Authority**: project conventions (`AGENTS.md` 등) are binding. Review with `kotlin-spring-review`; > SQL with a SQL review pass. Bean-name collision constraint: see KB [`reference/kb/bean-naming.md`](reference/kb/bean-naming.md). ## Where it goes - Domain module (`<domain-module>`), package `com.example.<domain>.repository`. No `public` keyword. ## JPA interface — name MUST end with `EntityRepository` ```kotlin interface <Name>EntityRepository : JpaRepository<<Name>Entity, String> { fun findBy<Field>(<field>: String): List<<Name>Entity> } ``` (see `order/repository/OrderEntityRepository.kt`). No `@Repository` on the interface. Add `, SelectExtensions<E, ID>` for pessimistic-lock reads. ## JDBC bulk-upsert — a **class** (auto-excluded from the naming rule) ```kotlin @Repository class <Name>JdbcRepository(private val jdbcTemplate: JdbcTemplate) { fun upsert(rows: List<<Model>>): Int { if (rows.isEmpty()) return 0 jdbcTemplate.batchUpdate(UPSERT_SQL, rows, BATCH_SIZE) { ps, m -> bind(ps, m) } return rows.size } private companion object { private const val BATCH_SIZE = 1000; private val UPSERT_SQL = """ INSERT ... ON CONFLICT (<pk>) DO UPDATE SET ... """.trimIndent() } } ``` (see `order/repository/OrderJdbcRep