Our review
Structured guide for designing database schemas, writing Flyway migrations, and optimizing JPA entities, with a strict prohibition against direct database execution.
Strengths
- Prevents common mistakes by forbidding dangerous actions like direct SQL execution or editing already-applied Flyway files.
- Provides detailed checklists for entities, migrations, and performance, ensuring code consistency and quality.
- Incorporates specific best practices (UUID, lazy loading, @EntityGraph, indexing) suitable for production environments.
Limitations
- Does not cover database-level role or permission management.
- Assumes the project already uses Flyway and BaseEntity, limiting portability.
- Does not provide automated solutions for detecting N+1 queries or optimizing indexes.
Use this skill when you need to create or modify JPA entities, write Flyway migrations, or optimize query performance in a Spring Boot project with PostgreSQL.
Avoid using it if the project does not use Flyway or JPA, or if you need to execute SQL commands directly on the database.
Security analysis
SafeThe skill only provides a checklist for writing files (entity classes, SQL migrations) and explicitly prohibits direct database execution or modifying applied migrations. There are no executable commands, network calls, or destructive instructions.
No concerns found
Examples
Create a new User entity in the member/domain/entity/ package with UUID primary key, email, nickname, and a OneToMany relationship to Post (lazy). Then generate a Flyway migration V2__create_user_table.sql with appropriate UUID default and indexes on email.I need to optimize the feed query for the Post entity. Currently, fetching posts with comments causes N+1. Please add an @EntityGraph to the repository method and create an index on the created_at column for pagination. Also ensure comment_count is not using a COUNT query but a cached counter.Create a Follow entity with composite primary key (follower_id, followee_id) using @IdClass. It should extend BaseEntity, use UUID for the IDs, and include a Flyway migration with the appropriate primary key and indexes.name: db-skill description: DB 스키마 설계, 마이그레이션 작성, 엔티티 최적화 시 사용. 직접 DB 실행 금지.
DB 작업 체크리스트
절대 금지 (시작 전 재확인)
- DB 클라이언트(psql 등) 직접 실행 금지
- 이미 적용된 Flyway 파일 수정 금지
ddl-auto=create/update설정 금지- 파일 작성만. 실행은 사람이 한다.
작업 시작 전
- [ ]
.claude/docs/db-docs.md읽기 (스키마, 인덱스, Redis 전략) - [ ] 기존 Flyway 파일 버전 확인 (
src/main/resources/db/migration/)
엔티티 작성 체크리스트
- [ ] 엔티티는
{domain}/entity/패키지에 작성 - [ ]
BaseEntity상속 확인 (createdAt, updatedAt 자동 관리) - [ ] ID 타입은 UUID,
@GeneratedValue(strategy = GenerationType.UUID) - [ ]
@OneToMany는LAZY로딩 기본 - [ ] 복합 PK는
@IdClass+@Getter @NoArgsConstructor @AllArgsConstructor @EqualsAndHashCode implements Serializable
Flyway 마이그레이션 작성 체크리스트
- [ ] 파일명:
V{N}__{설명}.sql(언더스코어 두 개) - [ ] 위치:
src/main/resources/db/migration/ - [ ] UUID 기본값:
DEFAULT gen_random_uuid() - [ ] 타임스탬프:
DEFAULT now() - [ ] 인덱스 포함 여부 확인
성능 체크리스트
- [ ] 피드 조회 N+1 없는가? (
@EntityGraph또는 fetch join) - [ ]
like_count,comment_countCOUNT 쿼리 없는가? (카운터 캐시 패턴) - [ ] 조회 조건 컬럼에 인덱스 있는가?
- [ ] Redis 캐시 대상인지 확인 (
tags:trending,auth:refresh:{userId})
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.