java-refactoring-remove-parameter
यह क्या करती है
यह tool आपके Java कोड से functions को दिए गए बेकार data (parameters) को हटाकर कोड को साफ़ करने में मदद करता है। इससे कोड को समझना और इस्तेमाल करना आसान हो जाता है।
कब इस्तेमाल करें
- ✓जब किसी function को ऐसा data मिलता है जिसका वह उपयोग नहीं करता।
- ✓जिन functions में बहुत अधिक arguments हों, उन्हें सरल बनाने के लिए।
- ✓कोड को साफ़ और समझने लायक बनाने के लिए उसे व्यवस्थित करते समय।
Skill का लिंक
https://github.com/github/awesome-copilot/blob/main/skills/java-refactoring-remove-parameter/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“'selectBackendForGroupCommit' function से 'isCloud' parameter हटा दो, क्योंकि उसका उपयोग नहीं हो रहा है।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
AI आपके Java functions का विश्लेषण करके वे parameters ढूँढता है जिनका उपयोग नहीं हो रहा। फिर वह इन्हें हटा देता है और कोड को इस तरह अपडेट करता है कि वह सही तरीके से काम करता रहे, लेकिन ज़्यादा साफ़ तरीके से।
तकनीकी सामग्री (मूल 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
अक्सर पूछे जाने वाले सवाल
बेकार parameters हटाने से कोड कैसे सुधरता है?
अनावश्यक parameters हटाने से कोड को पढ़ना, समझना और test करना आसान होता है, क्योंकि संभालने के लिए कम जानकारी होती है।
क्या बदलाव के बाद भी कोड काम करेगा?
हाँ, लक्ष्य केवल वही हटाना है जिसका उपयोग नहीं हो रहा, ताकि कोड की कार्यक्षमता वही रहे।
क्या इसका असर मेरे प्रोग्राम के दूसरे हिस्सों पर पड़ेगा?
अगर बदले गए function को कहीं और call किया गया है, तो AI उन calls को भी ठीक कर देगा ताकि सब कुछ एक साथ काम करता रहे।
जानकारी
लोकप्रियता
- GitHub स्टार
- 40k
- रैंकिंग में स्थान
- #7259
- लाइसेंस
- MIT
- अपडेट की गई
- 15/10/2026
कमेंट
- …
इस repository की और skills
acquire-codebase-knowledge
40kआपके एजेंट को किसी मौजूदा code प्रोजेक्ट को समझने और उसका documentation बनाने में मदद करता है। यह नए लोगों को प्रोजेक्ट से जोड़ने या architecture का सार जानने में उपयोगी है।
acreadiness-assess
40kआपके एजेंट को किसी प्रोजेक्ट की AI के लिए तैयारी जाँचने और रिपोर्ट बनाने देता है। यह समझने में उपयोगी है कि प्रोजेक्ट AI tools इस्तेमाल करने के लिए कितना तैयार है।
acreadiness-generate-instructions
40kआपके एजेंट को assessment के आधार पर AI tools के लिए निर्देश बनाने में मदद करता है। यह बताता है कि AI कोड के साथ बेहतर कैसे काम करे और पहचानी गई कमियाँ कैसे दूर हों।
acreadiness-policy
40kआपके एजेंट को AI प्रोजेक्ट assessment के लिए नीतियाँ तय करने या लागू करने में मदद करता है। यह प्रोजेक्ट्स के मूल्यांकन को मानक बनाने और compliance सुनिश्चित करने में उपयोगी है।
मिलती-जुलती skills
diffs
394kयह आपके एजेंट को बदलावों का असली diff बनाने देती है, जिसे व्यूअर लिंक या इमेज फ़ाइल के रूप में साझा किया जा सकता है, हाथ से लिखे सारांश के बजाय।
coding-agent
394kयह आपके एजेंट को बड़े कोडिंग काम Codex, Claude Code या OpenCode को बैकग्राउंड वर्कर के रूप में सौंपने, फिर उसकी प्रगति जांचने में मदद करती है।
gh-issues
394kयह आपके एजेंट को GitHub issues खोजने, उनमें से काम करने लायक चुनने, और सुधार के साथ pull requests खोलने में मदद करती है, जिसमें समीक्षा टिप्पणियों का फ़ॉलो-अप भी शामिल है।