Agent skill

Unit Test Bean Validation

by giuseppe-trisciuoglio in giuseppe-trisciuoglio/developer-kit

Provides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator.

MITAuto-check: notesTesting & QA

Install Unit Test Bean Validation

skills CLI
$ npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-bean-validation -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install giuseppe-trisciuoglio/developer-kit unit-test-bean-validation --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/giuseppe-trisciuoglio/developer-kit.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/developer-kit-java/skills/unit-test-bean-validation .claude/skills/unit-test-bean-validation && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
unit-test-bean-validation
GitHub stars
357
Token cost
~1.8k tokens
SKILL.md length
509 words
Files
3 (incl. references)
Skills in repo
115
Repo updated
First seen
Licence
MIT

At a glance

Provides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator.

  • Works in 8 steps: Add dependencies: Include… → Create base test class: Build Validator… → Test valid cases first: Verify objects… → …
  • Writing validation tests
  • SKILL.md covers Overview, When to Use, Instructions and Examples, plus 5 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Unit Test Bean Validation is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator. Generates custom validator tests, constraint violation assertions, validation groups, and parameterized validation tests. Validates data integrity logic without Spring context. Use when writing validation tests, bean validation tests, or testing custom constraint validators.

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 3 other files, including reference files (for example `references/advanced-patterns.md` and `references/custom-validators.md`).

It sits in Testing & QA, covering Unit testing and ORMs and data access. The repository describes itself as: Modular plugin marketplace for Claude Code and agentic CLIs, with validated, spec-driven skills, agents, commands, and workflows for Java, TypeScript, Python, PHP, AWS, and AI. The licence is MIT.

When your agent uses it

  • Writing validation tests
  • Bean validation tests
  • Testing custom constraint validators

Example prompts

  • “Use the unit-test-bean-validation skill to provide patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min…”
  • “/unit-test-bean-validation”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Bash, Glob, Grep

Workflow steps

8 steps, taken from the first numbered list in SKILL.md.

  1. Add dependencies: Include jakarta.validation-api and hibernate-validator in test scope
  2. Create base test class: Build Validator once in @BeforeEach using Validation.buildDefaultValidatorFactory()
  3. Test valid cases first: Verify objects pass without violations
  4. Test invalid cases: Assert constraint violations include correct property path and message
  5. Extract violation details: Use getPropertyPath(), getMessage(), getInvalidValue()
  6. Test custom validators: See references/custom-validators.md for patterns
  7. Use parameterized tests: Test multiple inputs efficiently with @ParameterizedTest
  8. Group validation tests: Use validation groups for conditional rules (see references/advanced-patterns.md)

What it can do on your machine

Read from SKILL.md and the folder at commit fe73fb3. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Bash
    • Glob
    • Grep

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are java and xml).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • jakarta.ee
    • hibernate.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Unit Test Bean Validation loads about 1.8k tokens when it runs, and up to ~3.4k if it reads all its reference files. Until then it costs about 114 tokens; SKILL.md has 509 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~114
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Bash, Glob, Grep

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from giuseppe-trisciuoglio/developer-kit at commit fe73fb3, republished under its MIT licence (© giuseppe-trisciuoglio). 509 words, ~1,794 tokens.

Download SKILL.mdSave it as .claude/skills/unit-test-bean-validation/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
unit-test-bean-validation
description
Provides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator. Generates custom validator tests, constraint violation assertions, validation groups, and parameterized validation tests. Validates data integrity logic without Spring context. Use when writing validation tests, bean validation tests, or testing custom constraint validators.
allowed-tools
Read, Write, Bash, Glob, Grep

Unit Testing Jakarta Bean Validation

Overview

This skill provides executable patterns for unit testing Jakarta Bean Validation annotations and custom validators using JUnit 5. Covers built-in constraints (@NotNull, @Email, @Min, @Max, @Size), custom @Constraint implementations, cross-field validation, and validation groups. Tests run in isolation without Spring context.

When to Use

  • Writing unit tests for Jakarta Bean Validation or JSR-380 constraints
  • Testing custom @Constraint validators and constraint violation messages
  • Testing bean validation logic in DTOs and request objects
  • Verifying cross-field validation (e.g., password matching)
  • Testing conditional validation with validation groups
  • Fast validation tests without Spring Boot context

Instructions

  1. Add dependencies: Include jakarta.validation-api and hibernate-validator in test scope
  2. Create base test class: Build Validator once in @BeforeEach using Validation.buildDefaultValidatorFactory()
  3. Test valid cases first: Verify objects pass without violations
  4. Test invalid cases: Assert constraint violations include correct property path and message
  5. Extract violation details: Use getPropertyPath(), getMessage(), getInvalidValue()
  6. Test custom validators: See references/custom-validators.md for patterns
  7. Use parameterized tests: Test multiple inputs efficiently with @ParameterizedTest
  8. Group validation tests: Use validation groups for conditional rules (see references/advanced-patterns.md)

Examples

Maven Setup
xml
<dependency>
  <groupId>jakarta.validation</groupId>
  <artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
  <groupId>org.hibernate.validator</groupId>
  <artifactId>hibernate-validator</artifactId>
  <scope>test</scope>
</dependency>
<dependency>
  <groupId>org.assertj</groupId>
  <artifactId>assertj-core</artifactId>
  <scope>test</scope>
</dependency>
Common Test Setup
java
import jakarta.validation.*;
import jakarta.validation.ConstraintViolation;
import jakarta.validation.path.Path;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.*;

class BaseValidationTest {
  protected Validator validator;

  @BeforeEach
  void setUpValidator() {
    validator = Validation.buildDefaultValidatorFactory().getValidator();
  }
}
Testing Basic Constraints
java
class UserDtoTest extends BaseValidationTest {

  @Test
  void shouldPassValidationWithValidUser() {
    UserDto user = new UserDto("Alice", "alice@example.com", 25);
    assertThat(validator.validate(user)).isEmpty();
  }

  @Test
  void shouldFailWhenNameIsNull() {
    UserDto user = new UserDto(null, "alice@example.com", 25);
    assertThat(validator.validate(user))
      .extracting(ConstraintViolation::getMessage)
      .contains("must not be blank");
  }

  @Test
  void shouldFailWhenEmailIsInvalid() {
    UserDto user = new UserDto("Alice", "invalid-email", 25);
    Set<ConstraintViolation<UserDto>> violations = validator.validate(user);
    assertThat(violations)
      .extracting(ConstraintViolation::getPropertyPath)
      .extracting(Path::toString)
      .contains("email");
  }

  @Test
  void shouldFailWhenAgeIsBelowMinimum() {
    UserDto user = new UserDto("Alice", "alice@example.com", -1);
    assertThat(validator.validate(user))
      .extracting(ConstraintViolation::getMessage)
      .contains("must be greater than or equal to 0");
  }

  @Test
  void shouldFailWhenMultipleConstraintsViolated() {
    UserDto user = new UserDto(null, "invalid", -5);
    assertThat(validator.validate(user)).hasSize(3);
  }
}
Testing Custom Validators

For custom constraint patterns, see references/custom-validators.md:

  • Creating @Constraint annotations
  • Implementing ConstraintValidator
  • Cross-field validation (password matching)
  • Stateless validator best practices
Testing Validation Groups

For validation groups and parameterized tests, see references/advanced-patterns.md:

  • Defining validation group interfaces
  • Conditional validation with groups parameter
  • @ParameterizedTest with @ValueSource and @CsvSource
  • Debugging failed validation tests

Best Practices

  • Test both valid and invalid: Every constraint needs both passing and failing test cases
  • Assert violation details: Verify property path, message, and constraint type
  • Test edge cases: null, empty string, whitespace-only, boundary values
  • Keep validators stateless: Custom validators must not maintain state
  • Use clear messages: Constraint messages should be user-friendly
  • Group related tests: Extend BaseValidationTest to share validator setup
  • Test error messages: Ensure messages match requirements
Show full SKILL.md (201 more words)Show less

Common Pitfalls

  • Forgetting to test null values (most constraints ignore null by default)
  • Not verifying the property path in constraint violations
  • Testing validation at service/controller level instead of unit level
  • Creating overly complex custom validators
  • Missing @NotNull for mandatory fields combined with other constraints

Constraints and Warnings

  • Null handling: Most constraints ignore null by default — combine @NotNull with other constraints for mandatory fields
  • Thread safety: Validator instances are thread-safe and can be shared
  • Message localization: Test with different locales if i18n is required
  • Cascading validation: Use @Valid on nested objects for recursive validation
  • Custom validators: Must be stateless and return true for null values
  • Test isolation: Validation unit tests should not depend on Spring context or database

Troubleshooting

ValidatorFactory not found: Ensure jakarta.validation-api and hibernate-validator are on test classpath.

Custom validator not invoked: Verify @Constraint(validatedBy = YourValidator.class) annotation is correct.

Null values pass validation: This is expected behavior — constraints ignore null unless @NotNull is present.

Wrong violation count: Use hasSize() to verify exact count, check all fields in the object.

Property path incorrect: Ensure the field, not the getter, has the constraint annotation.

References

© giuseppe-trisciuoglio, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (references) in plugins/developer-kit-java/skills/unit-test-bean-validation of giuseppe-trisciuoglio/developer-kit.

  • SKILL.md
  • references/advanced-patterns.md
  • references/custom-validators.md

Open the folder on GitHubat commit fe73fb3

Compare with similar skills

Unit Test Bean Validation next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Unit Test Bean Validation compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Unit Test Bean Validation this skillgiuseppe-trisciuoglio/developer-kit357—~1.8kAutomated safety check: NotesMIT
Backend Testingbiersoeckli/QuickStack361—~670Automated safety check: PassGPL-3.0
Breeze TestingLanternOps/breeze132—~668Automated safety check: PassAGPL-3.0
Docs LookupProgrammerAnthony/Expert-Coding-Harness235—~640Automated safety check: PassMIT
PythonMadAppGang/claude-code285—~2.8kAutomated safety check: NotesMIT
TDD WorkflowhellangleZ/burn-in-cceverywhere-ralph11211 repos~2.4kAutomated safety check: PassNone

Similar skills

  • Backend Testing

    biersoeckli/QuickStack

    Create and review QuickStack backend unit and integration tests using the project's Vitest, Prisma, SQLite, and k3s conventions.

    361 GitHub stars~670 tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Breeze Testing

    LanternOps/breeze

    Writing guidelines for Breeze RMM tests — API route (Vitest + Drizzle mocks), Go agent, shared validators, and the required coverage checklist for every new feature.

    132 GitHub stars~668 tokensUpdated today
    Testing & QAAuto-check passed
  • Docs Lookup

    ProgrammerAnthony/Expert-Coding-Harness

    通过 Context7 MCP 获取库和框架的实时最新文档,而非依赖训练数据,防止 API 幻觉。适用于查询任何库或框架的用法、配置、示例代码。触发词:怎么用、怎么配置、API参考、文档、示例代码、用法、接口、库文档、框架文档、documentation、docs、how to use、API…

    235 GitHub stars~640 tokensUpdated 5 mo ago
    Frontend & DesignAuto-check passed
  • Python

    MadAppGang/claude-code

    A skill your agent uses when building FastAPI applications, implementing async endpoints, setting up Pydantic schemas, working with SQLAlchemy, or writing pytest tests for Python backend services.

    285 GitHub stars~2.8k tokensUpdated 6 mo ago
    Backend & APIsAuto-check: notes
  • TDD Workflow

    hellangleZ/burn-in-cceverywhere-ralph

    A skill your agent uses when writing new features, fixing bugs, or refactoring code.

    112 GitHub starsUsed in 11 repos~2.4k tokens
    Testing & QAAuto-check passed
  • Testing OpenLogi UI

    AprilNEA/OpenLogi

    Verifies OpenLogi's native GPUI interface with focused tests, the component gallery and a mock agent, choosing the evidence that fits each change.

    23k GitHub stars~1.1k tokensUpdated today
    Testing & QAAuto-check passed

More from giuseppe-trisciuoglio/developer-kit

All 115 skills in this repo
  • Nestjs Drizzle Crud Generator

    giuseppe-trisciuoglio/developer-kit

    Generates complete CRUD modules for NestJS applications with Drizzle ORM.

    357 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Actuator

    giuseppe-trisciuoglio/developer-kit

    Provides patterns to configure Spring Boot Actuator for production-grade monitoring, health probes, secured management endpoints, and Micrometer metrics across JVM services.

    357 GitHub stars~2.2k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Crud Patterns

    giuseppe-trisciuoglio/developer-kit

    Provides and generates complete CRUD workflows for Spring Boot 3 services.

    357 GitHub stars~2.5k tokensUpdated 1 mo ago
    Auto-check: notes
  • Spring Boot Security JWT

    giuseppe-trisciuoglio/developer-kit

    Provides JWT authentication and authorization patterns for Spring Boot 3.5.x covering token generation with JJWT, Bearer/cookie authentication, database/OAuth2 integration, and RBAC/permission-based…

    357 GitHub stars~3.9k tokensUpdated 1 mo ago
    Auto-check: notes
  • AWS CLI Beast

    giuseppe-trisciuoglio/developer-kit

    Provides advanced AWS CLI patterns for managing EC2, Lambda, S3, DynamoDB, RDS, VPC, IAM, and CloudWatch.

    357 GitHub stars~1.7k tokensUpdated 1 mo ago
    Auto-check: notes
  • PR Review Comments

    giuseppe-trisciuoglio/developer-kit

    Posts review findings from a JSON file as inline comments on a GitHub Pull Request, attaching each comment to its file and line.

    357 GitHub stars~1k tokensUpdated 1 mo ago
    Auto-check: notes

Categories

Questions about Unit Test Bean Validation

What does Unit Test Bean Validation do?

Provides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator. Unit Test Bean Validation is an agent skill from giuseppe-trisciuoglio/developer-kit. Provides patterns for unit testing Jakarta Bean Validation (JSR-380), including @Valid, @NotNull, @Min, @Max, @Email constraints with Hibernate Validator.

When should I use Unit Test Bean Validation?

Unit Test Bean Validation fits situations like: writing validation tests; bean validation tests; testing custom constraint validators.

How do I install Unit Test Bean Validation in Claude Code?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-bean-validation -a claude-code`. Or copy the skill folder (plugins/developer-kit-java/skills/unit-test-bean-validation in giuseppe-trisciuoglio/developer-kit) into .claude/skills/unit-test-bean-validation in your project. Claude Code loads it when a task matches its description.

How do I install Unit Test Bean Validation in Codex?

Run `npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-bean-validation -a codex`. Or copy the skill folder (plugins/developer-kit-java/skills/unit-test-bean-validation in giuseppe-trisciuoglio/developer-kit) into .agents/skills/unit-test-bean-validation in your project. Codex loads it when a task matches its description.

Can I use Unit Test Bean Validation in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add giuseppe-trisciuoglio/developer-kit --skill unit-test-bean-validation -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/unit-test-bean-validation, .gemini/skills/unit-test-bean-validation, .github/skills/unit-test-bean-validation and .opencode/skills/unit-test-bean-validation in your project.

What does Unit Test Bean Validation need to run?

SKILL.md names no scripts, command-line tools or credentials: Unit Test Bean Validation is instructions for the agent only. Its frontmatter pre-approves these tools: Read, Write, Bash, Glob, Grep.

Does Unit Test Bean Validation access the network?

SKILL.md names 2 domains. As links in the text: jakarta.ee and hibernate.org. This is read from the text; nothing was executed.

Is Unit Test Bean Validation safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Unit Test Bean Validation use?

Unit Test Bean Validation is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Unit Test Bean Validation use?

About 1.8k tokens (SKILL.md is roughly 7.2k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 1.6k tokens, read only when the agent opens those files.

What are the alternatives to Unit Test Bean Validation?

Skills that share tags, products or a category with Unit Test Bean Validation: Backend Testing (biersoeckli/QuickStack, 361 stars), Breeze Testing (LanternOps/breeze, 132 stars), Docs Lookup (ProgrammerAnthony/Expert-Coding-Harness, 235 stars) and Python (MadAppGang/claude-code, 285 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Unit Test Bean Validation?

giuseppe-trisciuoglio (a GitHub user) maintains it in giuseppe-trisciuoglio/developer-kit, which has 357 GitHub stars. The repository holds 115 skills in this directory. The repository was last updated on September 10, 2026.

Source: giuseppe-trisciuoglio/developer-kit on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.