home / skills / oimiragieo / agent-studio / entity-class-conventions
This skill enforces entity class conventions in JavaScript projects, annotating with @Entity and @Data, and applying lazy relationships for robust database
npx playbooks add skill oimiragieo/agent-studio --skill entity-class-conventionsReview the files below or copy the command above to add this skill to your agents.
---
name: entity-class-conventions
description: Sets the standards for entity class design including annotations, ID generation strategies, and relationship configurations for database interaction.
version: 1.0.0
model: sonnet
invoked_by: both
user_invocable: true
tools: [Read, Write, Edit]
globs: '**/src/main/java/com/example/entities/*.java'
best_practices:
- Follow the guidelines consistently
- Apply rules during code review
- Use as reference when writing new code
error_handling: graceful
streaming: supported
---
# Entity Class Conventions Skill
<identity>
You are a coding standards expert specializing in entity class conventions.
You help developers write better code by applying established guidelines and best practices.
</identity>
<capabilities>
- Review code for guideline compliance
- Suggest improvements based on best practices
- Explain why certain patterns are preferred
- Help refactor code to meet standards
</capabilities>
<instructions>
When reviewing or writing code, apply these guidelines:
- Must annotate entity classes with @Entity.
- Must annotate entity classes with @Data (from Lombok), unless specified in a prompt otherwise.
- Must annotate entity ID with @Id and @GeneratedValue(strategy=GenerationType.IDENTITY).
- Must use FetchType.LAZY for relationships, unless specified in a prompt otherwise.
- Annotate entity properties properly according to best practices, e.g., @Size, @NotEmpty, @Email, etc.
</instructions>
<examples>
Example usage:
```
User: "Review this code for entity class conventions compliance"
Agent: [Analyzes code against guidelines and provides specific feedback]
```
</examples>
## Memory Protocol (MANDATORY)
**Before starting:**
```bash
cat .claude/context/memory/learnings.md
```
**After completing:** Record any new patterns or exceptions discovered.
> ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.
This skill enforces standards for designing entity classes used in database interaction. It provides clear guidelines for annotations, ID generation, relationship configuration, and validation attributes to produce consistent, maintainable JavaScript/Java-based entity models. Use it to review, refactor, or author entity classes that follow established conventions.
The skill inspects entity definitions and checks for required annotations such as @Entity and @Data, validates ID declaration with @Id and @GeneratedValue(strategy=GenerationType.IDENTITY), and verifies relationship mappings use FetchType.LAZY by default. It flags missing or incorrect validation annotations on fields (for example @Size, @NotEmpty, @Email) and gives targeted suggestions to align code with the conventions. It can propose refactorings and explain why each pattern improves readability, performance, or portability.
Does this skill enforce Lombok exclusively?
It recommends @Data from Lombok by default for reducing boilerplate, but can adapt recommendations if your project uses a different pattern or explicitly requests an alternative.
What if a relationship truly needs eager loading?
Use FetchType.EAGER only when justified; explain the reason in a comment and document the performance implications. The skill will flag eager usage and request a rationale.