JA

java-refactoring-remove-parameter

Provides patterns and examples for refactoring Java code via parameter removal.

Install

mkdir -p .claude/skills/java-refactoring-remove-parameter && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15287" && unzip -o skill.zip -d .claude/skills/java-refactoring-remove-parameter && rm skill.zip

Installs to .claude/skills/java-refactoring-remove-parameter

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Refactoring using Remove Parameter in Java Language
51 charsno explicit “when” trigger
Beginner

Key capabilities

  • Identify unused or redundant parameters in Java methods
  • Remove unnecessary parameters from method definitions
  • Remove unnecessary parameters from internal method calls
  • Ensure refactored methods remain compilable and functional
  • Improve readability and maintainability of Java code

How it works

The skill analyzes Java methods to identify and remove unused or redundant parameters from both the method definition and its internal calls. It ensures the refactored code remains functional.

Inputs & outputs

You give it
Java method code with potentially unused parameters
You get back
Refactored Java method code with specified parameters removed

When to use java-refactoring-remove-parameter

  • Refactor java methods
  • Simplify method signatures
  • Clean up technical debt

About this skill

Refactoring Java Methods with Remove Parameter

Role

You are an expert in refactoring Java methods.

Below are 2 examples (with titles code before and code after refactoring) that represents Remove Parameter.

Code Before Refactoring 1:

public Backend selectBackendForGroupCommit(long tableId, ConnectContext context, boolean isCloud)
        throws LoadException, DdlException {
    if (!Env.getCurrentEnv().isMaster()) {
        try {
            long backendId = new MasterOpExecutor(context)
                    .getGroupCommitLoadBeId(tableId, context.getCloudCluster(), isCloud);
            return Env.getCurrentSystemInfo().getBackend(backendId);
        } catch (Exception e) {
            throw new LoadException(e.getMessage());
        }
    } else {
        return Env.getCurrentSystemInfo()
                .getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster(), isCloud));
    }
}

Code After Refactoring 1:

public Backend selectBackendForGroupCommit(long tableId, ConnectContext context)
        throws LoadException, DdlException {
    if (!Env.getCurrentEnv().isMaster()) {
        try {
            long backendId = new MasterOpExecutor(context)
                    .getGroupCommitLoadBeId(tableId, context.getCloudCluster());
            return Env.getCurrentSystemInfo().getBackend(backendId);
        } catch (Exception e) {
            throw new LoadException(e.getMessage());
        }
    } else {
        return Env.getCurrentSystemInfo()
                .getBackend(selectBackendForGroupCommitInternal(tableId, context.getCloudCluster()));
    }
}

Code Before Refactoring 2:

NodeImpl( long id, long firstRel, long firstProp )
{
     this( id, false );
}

Code After Refactoring 2:

NodeImpl( long id)
{
     this( id, false );
}

Task

Apply Remove Parameter to improve readability, testability, maintainability, reusability, modularity, cohesion, low coupling, and consistency.

Always return a complete and compilable method (Java 17).

Perform intermediate steps internally:

  • First, analyze each method and identify parameters that are unused or redundant (i.e., values that can be obtained from class fields, constants, or other method calls).
  • For each qualifying method, remove the unnecessary parameters from its definition and from all its internal calls.
  • Ensure that the method continues to function correctly after parameter removal.
  • Output only the refactored code inside a single java block.
  • Do not remove any functionality from the original method.
  • Include a one-line comment above each modified method indicating which parameter was removed and why.

Code to be Refactored:

Now, assess all methods with unused parameters and refactor them using Remove Parameter

When not to use it

  • When refactoring languages other than Java
  • When parameters are actively used or essential for method functionality
  • When the goal is not to simplify method signatures

Limitations

  • Applies only to Java language
  • Cannot remove parameters that are functional
  • Requires returning a complete and compilable method

How it compares

This skill applies a specific refactoring technique ('Remove Parameter') to Java code, providing a targeted approach to simplify method signatures and improve code quality, unlike general code cleanup.

Compared to similar skills

java-refactoring-remove-parameter side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
java-refactoring-remove-parameter (this skill)05moNo flagsBeginner
jakarta-namespace26moReviewIntermediate
spring-boot-migration16moReviewAdvanced
clarity-over-cleverness03moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

jakarta-namespace

benchflow-ai

Migrate Java EE javax.* imports to Jakarta EE jakarta.* namespace. Use when upgrading to Spring Boot 3.x, migrating javax.persistence, javax.validation, javax.servlet imports, or fixing compilation errors after Jakarta EE transition. Covers package mappings, batch sed commands, and verification steps.

25

spring-boot-migration

benchflow-ai

Migrate Spring Boot 2.x applications to Spring Boot 3.x. Use when updating pom.xml versions, removing deprecated JAXB dependencies, upgrading Java to 17/21, or using OpenRewrite for automated migration. Covers dependency updates, version changes, and migration checklist.

11

clarity-over-cleverness

loiane

Apply clarity-over-cleverness rewrites — prefer code a junior engineer can read at a glance over compact-but-clever code. Use during `/build`'s simplify step and during `/code-simplify` (alias "simplify the code"). Never weakens behavior; suite must remain green.

00

ssr

JetBrains

Guide for using Structural Search and Replace in IntelliJ. Use when creating or modifying SSR inspections or search patterns.

00

spring-boot-config-refactor

sklintyg

Refactor a Spring Boot application's configuration from legacy application.properties and scattered @Value usage to structured YAML and immutable @ConfigurationProperties records. Use this when migrating messy configuration, standardizing property naming, introducing app-prefixed custom properties,

00

hexagonal-architecture

jssmy

Design, implement, and refactor Ports & Adapters systems with clear domain boundaries, dependency inversion, and testable use-case orchestration across TypeScript, Java, Kotlin, and Go services. Use for: new features needing long-term maintainability, decoupling domain logic from frameworks/DB/HTTP,

00

Search skills

Search the agent skills registry