PluginBench
Skill
Official
Review
Audit score 70

java-refactoring-remove-parameter

github/awesome-copilot

Prompts an AI agent to remove unused or redundant parameters from Java methods.

What is java-refactoring-remove-parameter?

This skill instructs an AI coding agent to apply the 'Remove Parameter' refactoring technique to Java methods, eliminating unused or redundant parameters while preserving functionality. It uses two worked examples to guide the agent and outputs a complete, compilable Java 17 method with comments explaining each removed parameter.

  • Analyzes provided Java methods to identify unused or redundant parameters
  • Removes qualifying parameters from method definitions and all internal call sites
  • Preserves original method functionality while improving readability, testability, and maintainability
  • Outputs a complete, compilable Java 17 method in a single code block
  • Adds a one-line comment above each modified method explaining which parameter was removed and why

How to install java-refactoring-remove-parameter

npx skills add https://github.com/github/awesome-copilot --skill java-refactoring-remove-parameter
Prerequisites
  • A coding agent environment that supports installed SKILL.md packages (e.g., Claude Code, Cursor)
  • Java source code (targeting Java 17 compatibility) to supply as input for refactoring
Claude Code
Cursor
Windsurf
Cline

How to use java-refactoring-remove-parameter

  1. 1.Install the skill into your coding agent (e.g., Claude Code or Cursor).
  2. 2.Invoke the skill and paste the Java method(s) you want analyzed under 'Code to be Refactored'.
  3. 3.The agent analyzes each method for unused or redundant parameters (those derivable from fields, constants, or other calls).
  4. 4.The agent removes qualifying parameters from the method definition and all internal call sites.
  5. 5.Review the returned single Java code block, which includes a one-line comment above each modified method explaining the removed parameter and reason.

Use cases

Good for
  • Cleaning up Java methods that carry parameters no longer used in their body
  • Simplifying method signatures where a parameter's value can be derived from existing fields or other method calls
  • Preparing legacy Java code for easier testing and maintenance by reducing parameter clutter
  • Reviewing pull requests by generating a before/after refactored version with documented rationale for each change
Who it's for
  • Java developers performing code cleanup or technical debt reduction
  • Code reviewers wanting a standardized refactoring suggestion for parameter bloat
  • Teams enforcing clean code practices in Java codebases

java-refactoring-remove-parameter FAQ

What Java version does this target?

The skill instructs the agent to always return complete, compilable Java 17 methods.

Will this change method behavior?

No, the instructions explicitly require that no functionality be removed from the original method, only unused/redundant parameters.

Does it refactor an entire codebase automatically?

No, you provide the specific Java code to be refactored and the skill analyzes and refactors that code via prompted instructions to the AI agent.

How are removed parameters documented?

The skill requires a one-line comment above each modified method indicating which parameter was removed and why.

Full instructions (SKILL.md)

Source of truth, from github/awesome-copilot.


name: java-refactoring-remove-parameter description: 'Refactoring using Remove Parameter in Java Language'

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