Code Comment Generator

入门development最低上下文:16K

Adds clear, accurate inline comments and API doc blocks to existing code without changing behavior. Generates docstrings and structured comments (JSDoc, Google/NumPy style, Javadoc, Rustdoc) that explain intent, parameters, return values, side effects, and edge cases, while avoiding noisy comments that merely restate the code.

使用场景

  • Adding docstrings to undocumented functions and classes
  • Generating JSDoc/Javadoc/Rustdoc API documentation blocks
  • Explaining complex algorithms with intent-focused comments
  • Documenting parameters, return values, and side effects
  • Standardizing comment style across a codebase

示例提示词

Add high-quality docstrings and inline comments to the following Python function without
changing its behavior. Use Google-style docstrings and only comment non-obvious logic.

```python
def merge_intervals(intervals):
    intervals.sort(key=lambda x: x[0])
    merged = []
    for s, e in intervals:
        if merged and s <= merged[-1][1]:
            merged[-1][1] = max(merged[-1][1], e)
        else:
            merged.append([s, e])
    return merged
```

推荐模型

兼容工具

claude-codecursorgithub-copilotkiroany

模态

输入: code, text
输出: code

相关 Skills

作者

OpenModels Community

@openmodelsrun