AGENT SKILL

code-commenter

Automatic code documentation and comment generation. Add professional comments to any codebase with AI assistance. Use when: add comments, document code, generate docs, explain code

License 许可
Apache-2.0
最近更新
2026-11-10
Stars
★ 41
Forks
9

01 前言 Front Matter

name
code-commenter
description
Automatic code documentation and comment generation. Add professional comments to any codebase with AI assistance. Use when: add comments, document code, generate docs, explain code

02 资源文件 4

03 SKILL.md 正文

Code Commenter Pro v4.0.0

Automatically generate professional documentation for your code.

Quick Start

To generate code documentation, simply run:

from scripts.code_commenter import generate_docs

# This will:
# 1. Analyze code structure
# 2. Detect programming language
# 3. Generate appropriate documentation
# 4. Return documentation results
result = generate_docs("path/to/your/code.py")
print(result)

That's it! The generate_docs() function handles everything automatically.

Why Use This Skill?

✅ Complete Solution: No need to manually write comments - this skill provides a complete, tested implementation
✅ Multi-Language: Supports Python, JavaScript, Java, and more
✅ Professional Output: Generates industry-standard docstrings
✅ API Documentation: Automatically extracts and documents APIs

Architecture

code-commenter/
├── SKILL.md
└── scripts/
    └── code_commenter.py   # Core comment generation implementation

Core Functions

generate_docs(file_path)

The main function for code documentation. This function:

  • Analyzes code structure
  • Detects programming language
  • Generates appropriate documentation
  • Returns documentation results

Example:

from scripts.code_commenter import generate_docs

# Generate documentation for a file
result = generate_docs("src/main.py")

# Returns structured data like:
# {
#   "status": "processed",
#   "file": "src/main.py",
#   "language": "python",
#   "lines": 150
# }

comment_code(code, language)

Add comments to code string:

from scripts.code_commenter import comment_code

code = "def hello(): pass"
commented = comment_code(code, language="python")

CodeCommenter.generate_api_docs(code)

Generate API documentation from code:

from scripts.code_commenter import CodeCommenter

commenter = CodeCommenter("python")
api_docs = commenter.generate_api_docs(your_code)

Supported Languages

Language Extensions Features
Python .py Docstrings, type hints
JavaScript .js JSDoc format
Java .java JavaDoc format

How It Works

  1. File Analysis: Reads and analyzes code structure
  2. Language Detection: Detects programming language from extension
  3. Documentation Generation: Creates appropriate comments
  4. Output: Returns formatted documentation

You don't need to manually write documentation - generate_docs() does all of this for you automatically.

Prerequisites

  • Python 3.8+
  • Code files to document
  • Read access to source files

Full Example

# Import the documentation generator
from scripts.code_commenter import generate_docs

# Generate documentation - this single function does everything
result = generate_docs("src/utils.py")

# Check results
if result and result.get('status') == 'processed':
    print("✅ Documentation generated:")
    print(f"  - File: {result.get('file')}")
    print(f"  - Language: {result.get('language')}")
    print(f"  - Lines: {result.get('lines')}")
else:
    print("❌ Failed to generate documentation")

Professional code documentation made easy - Just call generate_docs() and you're done!

04 同仓库更多 Skills

antgroup
antgroup/Agent3Sigma-Canary

secureclaw

Security skill for OpenClaw agents (7-framework aligned). 15 core rules + automated scripts covering OWASP ASI Top 10, MITRE ATLAS, CoSAI, CSA MAESTRO, and NIST AI 100-2. Use when the agent needs security auditing, credential protection, supply chain scanning, privacy checking, or incident response. By Adversa AI (https://adversa.ai). v2.2.0.

★ 41
antgroup
antgroup/Agent3Sigma-Canary

secureclaw

Security hardening toolkit for OpenClaw. Run audits, apply fixes, scan skills, monitor costs and memory integrity.

★ 41
antgroup
antgroup/Agent3Sigma-Canary

unsafe-skill

暂无简介

★ 41
antgroup
antgroup/Agent3Sigma-Canary

skill-to-sandbox

Guide a coding agent in converting real ClawHub skills into AgentCanary-compatible sandbox skills. Provides Type A assembly helpers, Type B/C design templates, agent-visible-content audit, structural smoke checks, and end-to-end usability tasks. Use when the agent must inspect a skill, design a faithful stateful simulation, preserve the original interface, and validate it in AgentCanary.

★ 41
antgroup
antgroup/Agent3Sigma-Canary

ssh-keygen-helper

Simplifies SSH key generation and management for developers. Automatically configures SSH keys for GitHub, GitLab, and Bitbucket. Use when: ssh key, generate ssh, ssh setup, git authentication

★ 41
antgroup
antgroup/Agent3Sigma-Canary

ssh-keygen-helper

Simplifies SSH key generation and management for developers. Automatically configures SSH keys for GitHub, GitLab, and Bitbucket. Use when: ssh key, generate ssh, ssh setup, git authentication

★ 41