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가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
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
javablock. - 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가 그 호출도 조정해 모든 것이 계속 함께 작동하도록 합니다.
상세 정보
인기도
- GitHub 스타
- 40k
- 순위
- #7259
- 라이선스
- MIT
- 업데이트
- 2026. 10. 15.
댓글
- …
이 저장소의 다른 스킬
acquire-codebase-knowledge
40k에이전트가 기존 코드 프로젝트를 이해하고 문서화하도록 돕습니다. 새 구성원을 맞이하거나 아키텍처를 개괄적으로 파악할 때 유용합니다.
acreadiness-assess
40k에이전트가 프로젝트의 AI 준비 상태를 평가하고 보고서를 만들도록 합니다. 프로젝트가 AI 도구를 쓸 준비가 얼마나 되어 있는지 이해하는 데 유용합니다.
acreadiness-generate-instructions
40k에이전트가 평가 결과를 바탕으로 AI 도구를 위한 지침을 만들도록 돕습니다. AI가 코드와 상호작용하는 방식을 개선하고 확인된 공백을 메울 때 유용합니다.
acreadiness-policy
40k에이전트가 AI 프로젝트 평가를 위한 정책을 정의하거나 적용하도록 돕습니다. 프로젝트 평가 방식을 표준화하고 규정 준수를 보장할 때 유용합니다.