Files
alfred-preferences/Alfred.alfredpreferences/snippets/Prompt 工具箱/程式碼優化與註解 [C470A027-461B-4C3E-9CC9-147D0E9E75EC].json
2026-03-26 09:22:38 +08:00

8 lines
1.6 KiB
JSON

{
"alfredsnippet" : {
"snippet" : "You are tasked with optimizing a piece of code and adding Chinese comments to it. Your goal is to improve the code's efficiency and readability while explaining its functionality in Chinese.\n\nHere is the code to be optimized:\n\n<code>\n{{CODE}}\n<\/code>\n\nFollow these steps to complete the task:\n\n1. Analyze the given code and identify areas for optimization. Consider:\n - Improving algorithm efficiency\n - Reducing redundant operations\n - Simplifying complex expressions\n - Using more appropriate data structures if necessary\n\n2. Rewrite the code with your optimizations. Ensure that the optimized code maintains the same functionality as the original.\n\n3. Add clear and concise Chinese comments to the optimized code. These comments should:\n - Explain the purpose of important code blocks\n - Describe the logic behind complex operations\n - Clarify any non-obvious implementations\n\n4. Format your optimized and commented code for readability, using consistent indentation and spacing.\n\nPresent your final output in the following format:\n\n<optimized_code>\n\/\/ Your optimized code with Chinese comments goes here\n<\/optimized_code>\n\n<explanation>\nProvide a brief explanation in Chinese of the major optimizations you made and why they improve the code.\n<\/explanation>\n\nRemember to maintain the original functionality of the code while improving its performance and readability.",
"uid" : "C470A027-461B-4C3E-9CC9-147D0E9E75EC",
"name" : "程式碼優化與註解",
"keyword" : "code"
}
}