원클릭으로
implement-audit-logging
Implement audit tracking and history endpoints for an existing domain object using Hibernate Envers.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Implement audit tracking and history endpoints for an existing domain object using Hibernate Envers.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Create an Architectural Decision Record (ADR) document for decision documentation. Use this when asked to document a new architectural decision.
Create or update documentation pages for the IDP-Core documentation site. Use this when asked to write, edit, or restructure content in the docs/src/ folder.
| name | implement-audit-logging |
| description | Implement audit tracking and history endpoints for an existing domain object using Hibernate Envers. |
Implement Hibernate Envers audit logging and a history retrieval endpoint for an existing domain object within the Hexagonal Architecture.
This skill leverages the native Envers entity tracking (track_entities_changed_in_revision: true) and relies on the global envers_transaction_log without creating custom tracking tables.
${input:EntityName}—The name of the domain object (for example Property, EntityTemplate).${input:IdentifierType}—The primary identifier type of the object (for example UUID, String).If the entity name or identifier type cannot be determined from the conversation, ask the user before proceeding. Verify that the target JPA entity exists in the infrastructure.adapters.persistence.model package before attempting any modifications.
revinfo or custom tracking tables.@JsonNaming(SnakeCaseStrategy.class) for all API outputs.Locate the target [EntityName]JpaEntity in infrastructure/adapters/persistence/model/.
org.hibernate.envers.Audited annotation to the class.@NotAudited only to lazy relationships or fields that should strictly not trigger audit records.Create a new migration script in src/main/resources/db/migration/.
[entity_name]_aud.id (or primary key), rev (BIGINT NOT NULL), and revtype (SMALLINT).CONSTRAINT fk_[entity_name]_aud_revinfo FOREIGN KEY (rev) REFERENCES envers_transaction_log (rev) ON DELETE CASCADE.Create an interface [EntityName]AuditPort in domain/port/audit/.
List<[EntityName]AuditInfo> getAuditHistory([IdentifierType] id);.Create Postgres[EntityName]AuditAdapter in infrastructure/adapters/persistence/ implementing the port.
AuditReaderFactory.get(entityManager).createQuery().forRevisionsOfEntity([EntityName]JpaEntity.class, false, true) to fetch revisions.Object[] containing the Entity snapshot, CustomRevisionEntity, and RevisionType to the domain AuditInfo model.CustomRevisionEntity.getAuthId() to the modifiedBy field.Create [EntityName]AuditService in domain/service/[entity_name]/.
@Transactional(readOnly = true).Create [EntityName]AuditDtoOut in infrastructure/adapters/api/dto/out/.
@Data, @Builder, and @JsonNaming(SnakeCaseStrategy.class). Include fields: revisionNumber, revisionDate, revisionType, modifiedBy, and snapshot.AuditController to define @GetMapping("entities/[object-plural]/{id}").@Operation, @ApiResponse).SnakeCaseStrategy.