MR
Mayur Rathi
@github
⭐ 34.1k GitHub stars

Java-Refactoring-Remove-Parameter

Java-Refactoring-Remove-Parameter是一款code方向的AI技能,核心价值是Refactoring using Remove Parameter in Java Language,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。

Refactoring using Remove Parameter in Java Language

Last verified on: 2026-05-30
mkdir -p ./skills/java-refactoring-remove-parameter && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/java-refactoring-remove-parameter/SKILL.md -o ./skills/java-refactoring-remove-parameter/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# 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:

java
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:

java
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:

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

Code After Refactoring 2:

java
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**

🎯 Best For

  • Tech leads planning refactors
  • Developers modernizing legacy code
  • Claude users
  • GitHub Copilot users
  • Software engineers

💡 Use Cases

  • Migrating from class components to hooks
  • Breaking apart monolithic functions
  • Code quality improvement
  • Best practice enforcement

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Java-Refactoring-Remove-Parameter to Your Work

    Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.

  4. 4

    Review and Refine

    Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.

❓ Frequently Asked Questions

Does this handle breaking changes?

Refactoring skills identify breaking changes but always run your test suite after applying suggestions.

Is Java-Refactoring-Remove-Parameter compatible with Cursor and VS Code?

Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.

Do I need specific dependencies for Java-Refactoring-Remove-Parameter?

Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.

How do I install Java-Refactoring-Remove-Parameter?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/java-refactoring-remove-parameter/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Refactoring without tests

Never refactor critical paths without a comprehensive test suite to catch regressions.

Skipping validation

Always test AI-generated code changes, even for simple refactors.

Missing dependency updates

Check if the skill requires updated dependencies or new packages.

🔗 Related Skills