remove-comments

Original🇨🇳 Chinese
Translated

Remove code comments via natural language guidance, suitable for simple scenarios in languages such as Python, JavaScript, TypeScript (.ts/.tsx), Java, C/C++, Go, HTML, etc.

5installs
Added on

NPX Install

npx skill4agent add forge-town/skills remove-comments

SKILL.md Content (Chinese)

View Translation Comparison →

Code Comment Remover

Task Objectives

  • 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

  1. Read the code file and identify the programming language
  2. Identify and remove comments based on the language type (see language-specific guidelines for details)
  3. Output the cleaned code while preserving its format and logical integrity
  4. Verify the result to ensure there are no syntax errors

Language Processing Guidelines

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
    http://
    , path
    //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

  • Reference Documentation: See references/examples.md (contains detailed comment removal examples for each language)