본문으로 건너뛰기
Skillpedia
일반 코딩40k · #7259

java-refactoring-remove-parameter

하는 일

이 도구는 함수에 전달되는 불필요한 정보를 제거해 Java 코드를 정리하도록 돕습니다. 코드를 이해하고 쓰기 쉽게 만듭니다.

사용하는 경우

  • ✓함수가 사용하지 않는 데이터를 받을 때.
  • ✓인수가 너무 많은 함수를 단순하게 만들 때.
  • ✓코드를 더 명확하게 정리할 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/java-refactoring-remove-parameter/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/java-refactoring-remove-parameter/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“'selectBackendForGroupCommit' 함수에서 사용되지 않는 'isCloud' 매개변수를 제거해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 Java 함수를 분석해 사용되지 않는 매개변수를 찾습니다. 그런 다음 이 매개변수를 제거하고 코드를 업데이트해 여전히 올바르게 작동하도록, 하지만 더 깔끔하게 만듭니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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

자주 묻는 질문

매개변수를 제거하면 왜 코드가 좋아지나요?

불필요한 매개변수를 제거하면 읽고, 이해하고, 테스트하기 쉬워집니다. 관리할 정보가 줄어들기 때문입니다.

변경 후에도 코드가 작동할까요?

네, 목표는 사용되지 않는 것만 제거하는 것이므로 기능은 그대로 유지됩니다.

이것이 프로그램의 다른 부분에 영향을 줄까요?

수정된 함수가 다른 곳에서 호출되고 있다면, AI가 그 호출도 조정해 모든 것이 계속 함께 작동하도록 합니다.

상세 정보

작성자의 원본 설명

Refactoring using Remove Parameter in Java Language

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7259
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬