Install
1
Install the plugin$
npx claudepluginhub allousas/claude-code-plugins --plugin kotlin-building-blocksWant just this skill?
Add to a custom plugin, then install with one command.
Description
Apply when creating, modifying, or reviewing any file that implements a repository (classes with names containing `Repository`, implementing an interface which name contains `Repository`, or classes that abstract data access to a database or external storage)
Tool Access
This skill uses the workspace's default tool permissions.
Supporting Assets
View in Repositoryexamples.mdSkill Content
Purpose
Database repositories translate domain calls into database operations, handling persistence and retrieval of domain entities.
Typical Flow
- Receive domain object or query parameters from application service
- Map domain objects to database DTOs/parameters
- Execute SQL query
- Map database result rows back to domain entities
- Return domain entity, null or Unit depending on the operation
Guidelines
DO:
- Follow the repository pattern: https://martinfowler.com/eaaCatalog/repository.html
- Use simple string queries if no complex query building logic is needed
- Use lightweight database access libraries, e.g., JDBCTemplate, instead of full ORM frameworks
- File naming:
<ExternalSystem><Concern>Repository, e.g.,PostgresTeamsRepository - Keep database schema simple - avoid complex joins, views, stored procedures
- Always add
created_atandupdated_attimestamps to all tables - Use parameterized queries or prepared statements to prevent SQL injection
- Declare DTOs in the same file where they are used for cohesion
- Use internal private functions for simple mapping, dedicated mapper classes for complex transformations
- Keep one repository per entity
DON'T:
- Have granular field methods to save or update specific fields of an entity - save the whole entity, if partial updates are needed, then it's a sign that the entity is not well modeled and should be split into multiple entities
- Leak DB dtos OUT of repositories, always map to domain objects, IN and OUT
- Use ORM frameworks unless necessary, they are adding an innecessary complex layer
- Declare transactions here - transactions are declared in application services layer
- Include business logic - only translation, mapping, and external system integration
- Push complexity to the database - push it to the domain layer instead
- Throw domain exceptions or return domain errors - those belong in domain/application layers
Spring specific
- Use
@Repositoryannotation - Use JDBCTemplate for database access
Examples
Please use always these examples as reference: examples.md
Stats
Stars1
Forks0
Last CommitFeb 25, 2026
Actions