Java Design Patterns Reference
decebals/claude-code-java
A practical Java reference for Builder, Factory, Singleton, Strategy, Observer and other patterns, with a table matching problems to patterns.
Update Java test classes and methods to work with new code versions after refactoring or modifications.
$ npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install ArabelaTso/Skills-4-SE java-test-updater --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/java-test-updater .claude/skills/java-test-updater && rm -rf skills-srcUse ~/.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/
Install the "java-test-updater" agent skill from https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/java-test-updater into .claude/skills/java-test-updater/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "java-test-updater", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/java-test-updaterType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install ArabelaTso/Skills-4-SE java-test-updater --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skills/java-test-updater .agents/skills/java-test-updater && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "java-test-updater" agent skill from https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/java-test-updater into .agents/skills/java-test-updater/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "java-test-updater", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install ArabelaTso/Skills-4-SE java-test-updater --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skills/java-test-updater .cursor/skills/java-test-updater && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "java-test-updater" agent skill from https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/java-test-updater into .cursor/skills/java-test-updater/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "java-test-updater", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/ArabelaTso/Skills-4-SE.git --path skills/java-test-updater--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install ArabelaTso/Skills-4-SE java-test-updater --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skills/java-test-updater .gemini/skills/java-test-updater && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "java-test-updater" agent skill from https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/java-test-updater into .gemini/skills/java-test-updater/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "java-test-updater", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install ArabelaTso/Skills-4-SE java-test-updaterInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .github/skills && cp -r skills-src/skills/java-test-updater .github/skills/java-test-updater && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "java-test-updater" agent skill from https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/java-test-updater into .github/skills/java-test-updater/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "java-test-updater", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install ArabelaTso/Skills-4-SE java-test-updater --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skills/java-test-updater .opencode/skills/java-test-updater && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "java-test-updater" agent skill from https://github.com/ArabelaTso/Skills-4-SE/tree/main/skills/java-test-updater into .opencode/skills/java-test-updater/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "java-test-updater", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
java-test-updaterUpdate Java test classes and methods to work with new code versions after refactoring or modifications.
Java Test Updater is an agent skill from ArabelaTso/Skills-4-SE. Update Java test classes and methods to work with new code versions after refactoring or modifications. Use when code changes break existing tests due to signature changes, refactoring, or behavior modifications. Takes old and new code versions plus old tests as input, and outputs updated tests that compile and pass against the new code. Handles method signature changes, class refactoring, assertion updates, and mock modifications.
Its SKILL.md is about 3k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.
It sits in Development, covering Refactoring. It works with Java. The repository describes itself as: A curated list of 180+ useful Claude Skills for Software Engineering and resources for customizing AI for SE workflows. The licence is Apache-2.0.
10 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit 4f38503. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
mvnFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Java Test Updater loads about 3k tokens when it runs. Until then it costs about 113 tokens; SKILL.md has 589 words of instructions outside code blocks.
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.
The automated check found no risky patterns in SKILL.md.
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.
The full file from ArabelaTso/Skills-4-SE at commit 4f38503, republished under its Apache-2.0 licence (© ArabelaTso). 589 words, ~2,966 tokens.
.claude/skills/java-test-updater/SKILL.md (or your agent's skills folder).Automatically update Java test code to align with changes in production code, ensuring tests compile and pass after refactoring, signature changes, or behavior modifications.
Compare old and new versions of the production code to identify changes:
Read both versions:
Categorize changes:
Example change analysis:
// Old version
public double calculateDiscount(double price) {
return price * 0.1;
}
// New version
public double calculateDiscount(double price, double discountRate) {
if (discountRate < 0 || discountRate > 1) {
throw new IllegalArgumentException("Invalid discount rate");
}
return price * discountRate;
}Identified changes:
discountRateRead and understand the old test code:
Identify test structure:
@Before, @BeforeEach, @After, @AfterEach)Map tests to code changes:
Example old test:
@Test
public void testCalculateDiscount() {
double price = 100.0;
double result = calculator.calculateDiscount(price);
assertEquals(10.0, result, 0.01);
}Modify test code to match new method signatures:
For added parameters:
// Old call
calculator.calculateDiscount(price)
// Updated call
calculator.calculateDiscount(price, 0.1) // Use appropriate default or test valueFor removed parameters:
// Old call
calculator.calculateDiscount(price, taxRate, shippingCost)
// Updated call (if taxRate removed)
calculator.calculateDiscount(price, shippingCost)For parameter type changes:
// Old call
calculator.process(userId) // userId was int
// Updated call (if userId changed to Long)
calculator.process(Long.valueOf(userId))For renamed methods:
// Old call
calculator.computeTotal()
// Updated call (if renamed to calculateTotal)
calculator.calculateTotal()For moved methods:
// Old call
calculator.validateInput(data)
// Updated call (if moved to validator class)
validator.validateInput(data)Adjust test assertions to match new behavior:
For changed return values:
// Old assertion (10% fixed discount)
assertEquals(10.0, result, 0.01);
// Updated assertion (variable discount rate)
assertEquals(8.0, calculator.calculateDiscount(100.0, 0.08), 0.01);For new exceptions:
// Add new test for exception
@Test
public void testInvalidDiscountRate() {
assertThrows(IllegalArgumentException.class, () -> {
calculator.calculateDiscount(100.0, -0.1);
});
}For changed behavior:
// Old assertion
assertTrue(result.isEmpty());
// Updated assertion (if behavior changed to return null instead)
assertNull(result);For modified object state:
// Old assertion
assertEquals(1, cart.getItemCount());
// Updated assertion (if implementation changed)
assertEquals(1, cart.getItems().size());Modify mock objects to match new interfaces:
For Mockito mocks with signature changes:
// Old mock setup
when(repository.findById(userId)).thenReturn(user);
// Updated mock setup (if return type changed to Optional)
when(repository.findById(userId)).thenReturn(Optional.of(user));For added parameters in mocked methods:
// Old mock
when(service.process(data)).thenReturn(result);
// Updated mock (if parameter added)
when(service.process(data, context)).thenReturn(result);
// Or use argument matchers
when(service.process(eq(data), any(Context.class))).thenReturn(result);For changed mock behavior:
// Old mock (method returned boolean)
when(validator.isValid(input)).thenReturn(true);
// Updated mock (method now throws exception instead)
doNothing().when(validator).validate(input);
// Or for invalid case:
doThrow(new ValidationException()).when(validator).validate(invalidInput);Create additional tests for new functionality or edge cases:
For new parameters:
@Test
public void testCalculateDiscountWithZeroRate() {
double result = calculator.calculateDiscount(100.0, 0.0);
assertEquals(0.0, result, 0.01);
}
@Test
public void testCalculateDiscountWithMaxRate() {
double result = calculator.calculateDiscount(100.0, 1.0);
assertEquals(100.0, result, 0.01);
}For new exceptions:
@Test
public void testNegativeDiscountRate() {
assertThrows(IllegalArgumentException.class, () -> {
calculator.calculateDiscount(100.0, -0.5);
});
}
@Test
public void testDiscountRateAboveOne() {
assertThrows(IllegalArgumentException.class, () -> {
calculator.calculateDiscount(100.0, 1.5);
});
}For new behavior:
@Test
public void testNewFeature() {
// Test newly added functionality
Result result = service.newMethod(input);
assertNotNull(result);
assertEquals(expectedValue, result.getValue());
}Modify test fixtures if dependencies changed:
For constructor changes:
// Old setup
@BeforeEach
void setUp() {
calculator = new Calculator();
}
// Updated setup (if constructor now requires dependencies)
@BeforeEach
void setUp() {
validator = new Validator();
calculator = new Calculator(validator);
}For new dependencies:
// Old setup
@Mock
private Repository repository;
// Updated setup (if new dependency added)
@Mock
private Repository repository;
@Mock
private CacheService cacheService;
@BeforeEach
void setUp() {
service = new Service(repository, cacheService);
}Ensure updated tests compile without errors:
Check for compilation issues:
Common compilation fixes:
// Add missing imports
import java.util.Optional;
import static org.mockito.ArgumentMatchers.any;
// Fix type mismatches
Long userId = 123L; // Instead of int userId = 123;
// Update generic types
List<String> items = new ArrayList<>(); // Instead of raw ListCompile tests:
# Maven
mvn test-compile
# Gradle
./gradlew testClassesExecute tests to ensure they pass:
Run all updated tests:
# Maven
mvn test -Dtest=CalculatorTest
# Gradle
./gradlew test --tests CalculatorTestAnalyze test results:
If tests fail:
Ensure updated tests maintain quality standards:
Check test coverage:
Verify test independence:
Review test clarity:
Old code:
public String formatName(String firstName, String lastName) {
return firstName + " " + lastName;
}New code:
public String formatName(String firstName, String lastName, String title) {
return title + " " + firstName + " " + lastName;
}Old test:
@Test
public void testFormatName() {
String result = formatter.formatName("John", "Doe");
assertEquals("John Doe", result);
}Updated test:
@Test
public void testFormatName() {
String result = formatter.formatName("John", "Doe", "Mr.");
assertEquals("Mr. John Doe", result);
}
@Test
public void testFormatNameWithEmptyTitle() {
String result = formatter.formatName("John", "Doe", "");
assertEquals(" John Doe", result);
}Old code:
public class UserService {
public boolean validateEmail(String email) {
return email.contains("@");
}
}New code:
public class UserService {
private EmailValidator validator;
// validateEmail moved to EmailValidator
}
public class EmailValidator {
public boolean isValid(String email) {
return email.contains("@");
}
}Old test:
@Test
public void testValidateEmail() {
assertTrue(userService.validateEmail("user@example.com"));
}Updated test:
@Mock
private EmailValidator emailValidator;
@BeforeEach
void setUp() {
userService = new UserService(emailValidator);
}
@Test
public void testEmailValidation() {
when(emailValidator.isValid("user@example.com")).thenReturn(true);
// Test userService method that uses emailValidator
}
// Or create separate test for EmailValidator
@Test
public void testEmailValidatorIsValid() {
EmailValidator validator = new EmailValidator();
assertTrue(validator.isValid("user@example.com"));
}Old code:
public User findUser(Long id) {
return repository.findById(id); // Returns User or null
}New code:
public Optional<User> findUser(Long id) {
return repository.findById(id); // Returns Optional<User>
}Old test:
@Test
public void testFindUser() {
User user = service.findUser(123L);
assertNotNull(user);
assertEquals("John", user.getName());
}Updated test:
@Test
public void testFindUser() {
Optional<User> userOpt = service.findUser(123L);
assertTrue(userOpt.isPresent());
assertEquals("John", userOpt.get().getName());
}
@Test
public void testFindUserNotFound() {
Optional<User> userOpt = service.findUser(999L);
assertFalse(userOpt.isPresent());
}© ArabelaTso, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skills/java-test-updater of ArabelaTso/Skills-4-SE.
Open the folder on GitHubat commit 4f38503
Java Test Updater 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.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Java Test Updater this skillArabelaTso/Skills-4-SE | 253 | — | ~3k | Automated safety check: Pass | Apache-2.0 | |
| Java Design Patterns Referencedecebals/claude-code-java | 751 | 1 repos | ~4.4k | Automated safety check: Pass | MIT | |
| Bootui Java Developmentjdubois/boot-ui | 307 | — | ~1.3k | Automated safety check: Pass | Apache-2.0 | |
| Goinference-gateway/inference-gateway | 214 | — | ~2.4k | Automated safety check: Pass | Apache-2.0 | |
| Java 21 Developer Guide for Grailsapache/grails-core | 2.9k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Spring Data Developmentarangodb/spring-data | 116 | — | ~620 | Automated safety check: Pass | Apache-2.0 |
decebals/claude-code-java
A practical Java reference for Builder, Factory, Singleton, Strategy, Observer and other patterns, with a table matching problems to patterns.
jdubois/boot-ui
A skill your agent uses when implementing, debugging, refactoring, or testing existing BootUI Java code, including framework-neutral engine logic, Spring MVC and WebFlux adapters, Quarkus runtime…
inference-gateway/inference-gateway
Idiomatic Go - package and interface design, error wrapping, table-driven tests, generics, the modern standard library (slices/maps/cmp/errors.Join), current syntax, and logging discipline.
apache/grails-core
Guide for writing modern Java 21 in a Grails and Groovy codebase: records, sealed classes, pattern matching, text blocks and how Java works alongside Groovy.
arangodb/spring-data
Maintain and extend the arangodb/spring-data repository. An agent skill from arangodb/spring-data.
dtprj/dongting
IntelliJ IDEA MCP for Java code analysis, testing, refactoring, and project navigation.
ArabelaTso/Skills-4-SE
Generate prioritized CVE watchlists and actionable security recommendations for repositories.
ArabelaTso/Skills-4-SE
Automatically migrate Python web applications between frameworks (Flask → FastAPI, Django → FastAPI).
ArabelaTso/Skills-4-SE
Generate test cases using metamorphic testing by applying transformations based on metamorphic properties.
ArabelaTso/Skills-4-SE
Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures.
ArabelaTso/Skills-4-SE
Automatically migrate Spring MVC applications to Spring Boot.
ArabelaTso/Skills-4-SE
Instrument programs (Python, C/C++, Java) to capture snapshots of key program states at runtime, including variables, memory, and call stacks.
Works with
Categories
Update Java test classes and methods to work with new code versions after refactoring or modifications. Java Test Updater is an agent skill from ArabelaTso/Skills-4-SE. Update Java test classes and methods to work with new code versions after refactoring or modifications.
Java Test Updater fits situations like: code changes break existing tests due to signature changes; behavior modifications.
Run `npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a claude-code`. Or copy the skill folder (skills/java-test-updater in ArabelaTso/Skills-4-SE) into .claude/skills/java-test-updater in your project. Claude Code loads it when a task matches its description.
Run `npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a codex`. Or copy the skill folder (skills/java-test-updater in ArabelaTso/Skills-4-SE) into .agents/skills/java-test-updater in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ArabelaTso/Skills-4-SE --skill java-test-updater -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/java-test-updater, .gemini/skills/java-test-updater, .github/skills/java-test-updater and .opencode/skills/java-test-updater in your project.
Going by SKILL.md and its folder, Java Test Updater needs the command-line tools its instructions call (mvn).
SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.
Java Test Updater is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 3k tokens (SKILL.md is roughly 12k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Java Test Updater: Java Design Patterns Reference (decebals/claude-code-java, 751 stars), Bootui Java Development (jdubois/boot-ui, 307 stars), Go (inference-gateway/inference-gateway, 214 stars) and Java 21 Developer Guide for Grails (apache/grails-core, 2.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
ArabelaTso (a GitHub user) maintains it in ArabelaTso/Skills-4-SE, which has 253 GitHub stars. The repository holds 150 skills in this directory. The repository was last updated on August 21, 2026.
Source: ArabelaTso/Skills-4-SE on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.