Code Comment Generator

beginnerdevelopmentMin 16K context

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.

Use Cases

  • 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

Example Prompt

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
```

Recommended Models

Compatible Tools

claude-codecursorgithub-copilotkiroany

Modalities

Input: code, text
Output: code

Related Skills

Author

OpenModels Community

@openmodelsrun