remove-comments
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese代码注释删除器
Code Comment Remover
任务目标
Task Objectives
- 本 Skill 用于:通过智能体的语言理解能力删除代码文件中的注释
- 触发条件:用户提到"删除注释"、"清理注释"、"去注释"、"remove comments"等
- 适用场景:简单代码的注释清理,复杂代码建议使用专业工具
- This Skill is used to remove comments from code files through the agent's language understanding capabilities
- Trigger conditions: When the user mentions "remove comments", "clean up comments", "strip comments", "remove comments", etc.
- Applicable scenarios: Comment cleanup for simple code; it is recommended to use professional tools for complex code
操作步骤
Operation Steps
- 读取代码文件并识别编程语言
- 根据语言类型识别并删除注释(详见各语言指导)
- 输出清理后的代码,保持格式和逻辑完整
- 验证结果,确保无语法错误
- Read the code file and identify the programming language
- Identify and remove comments based on the language type (see language-specific guidelines for details)
- Output the cleaned code while preserving its format and logical integrity
- Verify the result to ensure there are no syntax errors
语言处理指导
Language Processing Guidelines
详细的注释规则和示例请参考 references/examples.md,以下是核心要点:
- Python:删除 单行注释和
#'''多行注释""" - JavaScript/TypeScript/TSX/Java/C/C++/Go:删除 单行注释和
//多行注释,TSX 需额外删除/* */JSX 注释{/* */} - HTML/XML:删除 注释
<!-- -->
重要原则:
- 保护字符串中的注释符号(如 URL 、路径
http://)//server - 保持代码缩进和格式
- 不影响代码逻辑
For detailed comment rules and examples, please refer to references/examples.md. The key points are as follows:
- Python: Remove single-line comments and
#/'''multi-line comments""" - JavaScript/TypeScript/TSX/Java/C/C++/Go: Remove single-line comments and
//multi-line comments; for TSX, additionally remove/* */JSX comments{/* */} - HTML/XML: Remove comments
<!-- -->
Important Principles:
- Protect comment symbols within strings (e.g., URL , path
http://)//server - Preserve code indentation and format
- Do not affect code logic
注意事项
Notes
⚠️ 局限性:智能体处理可能不如专门的代码解析工具精确
⚠️ 字符串保护:注意不误删字符串中的注释符号
⚠️ 复杂情况:嵌套注释、条件注释等复杂情况可能需要人工检查
✅ 适用场景:简单的代码清理、学习用途的代码简化
建议:处理重要代码前先备份,验证结果后再使用
⚠️ Limitations: Agent processing may not be as accurate as specialized code parsing tools
⚠️ String Protection: Be careful not to accidentally delete comment symbols within strings
⚠️ Complex Scenarios: Complex situations such as nested comments and conditional comments may require manual inspection
✅ Applicable Scenarios: Simple code cleanup, code simplification for learning purposes
Recommendation: Back up important code before processing, and verify the result before use
资源索引
Resource Index
- 参考文档:见 references/examples.md(包含各语言的详细注释删除示例)
- Reference Documentation: See references/examples.md (contains detailed comment removal examples for each language)