Token导航 LogoToken导航

Agent Skill · 研究检索

code-documentation(代码文档)

用于辅助文档、README、Markdown、说明文和内容稿件的整理与改写。它适合让 Agent 提炼结构、补齐章节、统一术语、检查链接或把零散材料整理成可读文档。使用时应保留项目已有事实、命令和路径,不要把未确认的信息写成确定结论;涉及对外文案时,还需要控制语气,避免过度营销或夸大能力。

code-documentation 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为需要联网;许可证信息还不明确,第三方扫描已通过,按安装量在研究检索类的 73,675 个 Skill 里排第 64,557。

总安装 297周安装 12GitHub Stars 7下载 93核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:code-documentation(代码文档)
来源仓库:https://github.com/ilude/claude-code-config
仓库路径:skills/code-documentation
安装命令:
npx skills add https://github.com/ilude/claude-code-config --skill code-documentation
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/ilude/claude-code-config --skill code-documentation

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

优先顺序: 清晰的代码 - 通过命名和结构不言自明 好的评论 - 必要时解释原因 文档 - API 文档、公共接口的文档字符串 没有评论 - 比撒谎或混乱的坏评论好 请记住:注释无法使代码不言自明。谨慎而明智地使用它们。

要点 目标 方法 减少评论 改进命名、提取功能、简化逻辑 提高清晰度 使用不言自明的代码结构,清晰的变量名称 文档 API 使用 docstrings/JSDoc 作为公共接口 解释为什么 仅评论业务逻辑、算法、解决方法 保持准确性 代码更改时更新注释,或删除它们 每周安装量 12 存储库 ilude/claude-代码配置 GitHub 之星 7 第一次看到 2026 年 1 月 23 日 安全审计 Gen Agent Trust Hub 通行证 套接字通行证 斯尼克通行证

来源仓库内路径:skills/code-documentation

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/ilude/claude-code-config --skill code-document…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要需要联网,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

code-documentation 怎么安装?

在终端执行 npx skills add https://github.com/ilude/claude-code-config --skill code-documentation。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

code-documentation 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

code-documentation 需要什么权限?

权限级别是需要联网。该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

code-documentation 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

code-documentation 用的人多吗?

公开数据是累计安装 297 次,近一周安装 12 次,下载 93 次,GitHub 7 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

code-documentation 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
code-documentation

代码文档 · 本页

2977需要联网未明确通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Code Documentation & Self-Explanatory Code

Auto-activate when: User discusses comments, documentation, docstrings, code clarity, code quality, API docs, JSDoc, Python docstrings, or asks about commenting strategies.

Core Principle

Write code that speaks for itself. Comment only when necessary to explain WHY, not WHAT.

Most code does not need comments. Well-written code with clear naming and structure is self-documenting.

The best comment is the one you don't need to write because the code is already obvious.


The Commenting Philosophy

When to Comment

✅ DO comment when explaining:

  • WHY something is done (business logic, design decisions)
  • Complex algorithms and their reasoning
  • Non-obvious trade-offs or constraints
  • Workarounds for bugs or limitations
  • API contracts and public interfaces
  • Regex patterns and what they match
  • Performance considerations or optimizations
  • Constants and magic numbers
  • Gotchas or surprising behaviors

❌ DON'T comment when:

  • The code is obvious and self-explanatory
  • The comment repeats the code (redundant)
  • Better naming would eliminate the need
  • The comment would become outdated quickly
  • It's decorative or organizational noise
  • It states what a standard language construct does

Comment Anti-Patterns

❌ 1. Obvious Comments

BAD:

counter = 0  # Initialize counter to zero
counter += 1  # Increment counter by one
user_name = input("Enter name: ")  # Get user name from input

Better: No comment needed - the code is self-explanatory.


❌ 2. Redundant Comments

BAD:

def get_user_name(user):
    return user.name  # Return the user's name

def calculate_total(items):
    # Loop through items and sum the prices
    total = 0
    for item in items:
        total += item.price
    return total

Better:

def get_user_name(user):
    return user.name

def calculate_total(items):
    return sum(item.price for item in items)

❌ 3. Outdated Comments

BAD:

# Calculate tax at 5% rate
tax = price * 0.08  # Actually 8%, comment is wrong

# DEPRECATED: Use new_api_function() instead
def old_function():  # Still being used, comment is misleading
    pass

Better: Keep comments in sync with code, or remove them entirely.


❌ 4. Noise Comments

BAD:

# Start of function
def calculate():
    # Declare variable
    result = 0
    # Return result
    return result
# End of function

Better: Remove all of these comments.


❌ 5. Dead Code & Changelog Comments

BAD:

# Don't comment out code - use version control
# def old_function():
#     return "deprecated"

# Don't maintain history in comments
# Modified by John on 2023-01-15
# Fixed bug reported by Sarah on 2023-02-03

Better: Delete the code. Git has the history.


Good Comment Examples

✅ Complex Business Logic

# Apply progressive tax brackets: 10% up to $10k, 20% above
# This matches IRS publication 501 for 2024
def calculate_progressive_tax(income):
    if income <= 10000:
        return income * 0.10
    else:
        return 1000 + (income - 10000) * 0.20

✅ Non-obvious Algorithms

# Using Floyd-Warshall for all-pairs shortest paths
# because we need distances between all nodes.
# Time: O(n³), Space: O(n²)
for k in range(vertices):
    for i in range(vertices):
        for j in range(vertices):
            dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

✅ Regex Patterns

# Match email format: username@domain.extension
# Allows letters, numbers, dots, hyphens in username
# Requires valid domain and 2+ char extension
email_pattern = r'^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$'

✅ API Constraints or Gotchas

# GitHub API rate limit: 5000 requests/hour for authenticated users
# We implement exponential backoff to handle rate limiting
await rate_limiter.wait()
response = await fetch(github_api_url)

✅ Workarounds for Bugs

# HACK: Workaround for bug in library v2.1.0
# Remove after upgrading to v2.2.0
# See: https://github.com/library/issues/123
if library_version == "2.1.0":
    apply_workaround()

Decision Framework

Before writing a comment, ask yourself:

Step 1: Is the code self-explanatory?

  • If YES → No comment needed
  • If NO → Continue to step 2

Step 2: Would a better variable/function name eliminate the need?

  • If YES → Refactor the code instead
  • If NO → Continue to step 3

Step 3: Does this explain WHY, not WHAT?

  • If explaining WHAT → Refactor code to be clearer
  • If explaining WHY → Good comment candidate

Step 4: Will this help future maintainers?

  • If YES → Write the comment
  • If NO → Skip it

Special Cases for Comments

Public APIs and Docstrings

Python Docstrings
def calculate_compound_interest(
    principal: float,
    rate: float,
    time: int,
    compound_frequency: int = 1
) -> float:
    """
    Calculate compound interest using the standard formula.

    Args:
        principal: Initial amount invested
        rate: Annual interest rate as decimal (e.g., 0.05 for 5%)
        time: Time period in years
        compound_frequency: Times per year interest compounds (default: 1)

    Returns:
        Final amount after compound interest

    Raises:
        ValueError: If any parameter is negative

    Example:
        >>> calculate_compound_interest(1000, 0.05, 10)
        1628.89
    """
    if principal < 0 or rate < 0 or time < 0:
        raise ValueError("Parameters must be non-negative")

    # Compound interest formula: A = P(1 + r/n)^(nt)
    return principal * (1 + rate / compound_frequency) ** (compound_frequency * time)
JavaScript/TypeScript JSDoc
/**
 * Fetch user data from the API.
 *
 * @param {string} userId - The unique user identifier
 * @param {Object} options - Configuration options
 * @param {boolean} options.includeProfile - Include profile data (default: true)
 * @param {number} options.timeout - Request timeout in ms (default: 5000)
 *
 * @returns {Promise<User>} User object with requested fields
 *
 * @throws {Error} If userId is invalid or request fails
 *
 * @example
 * const user = await fetchUser('123', { includeProfile: true });
 */
async function fetchUser(userId, options = {}) {
  // Implementation
}

Constants and Configuration

# Based on network reliability studies (95th percentile)
MAX_RETRIES = 3

# AWS Lambda timeout is 15s, leaving 5s buffer for cleanup
API_TIMEOUT = 10000  # milliseconds

# Cache duration optimized for balance between freshness and load
# See: docs/performance-tuning.md
CACHE_TTL = 300  # 5 minutes

Annotations for TODOs and Warnings

# TODO: Replace with proper authentication after security review
# Issue: #456
def temporary_auth(user):
    return True

# WARNING: This function modifies the original array instead of creating a copy
def sort_in_place(arr):
    arr.sort()
    return arr

# FIXME: Memory leak in production - investigate connection pooling
# Ticket: JIRA-789
def get_connection():
    return create_connection()

# PERF: Consider caching this result if called frequently in hot path
def expensive_calculation(data):
    return complex_algorithm(data)

# SECURITY: Validate input to prevent SQL injection before using in query
def build_query(user_input):
    sanitized = escape_sql(user_input)
    return f"SELECT * FROM users WHERE name = '{sanitized}'"
Common Annotation Keywords
  • TODO: - Work that needs to be done
  • FIXME: - Known bugs that need fixing
  • HACK: - Temporary workarounds
  • NOTE: - Important information or context
  • WARNING: - Critical information about usage
  • PERF: - Performance considerations
  • SECURITY: - Security-related notes
  • BUG: - Known bug documentation
  • REFACTOR: - Code that needs refactoring
  • DEPRECATED: - Soon-to-be-removed code

Refactoring Over Commenting

Instead of Commenting Complex Code...

BAD: Complex code with comment

# Check if user is admin or has special permissions
if user.role == "admin" or (user.permissions and "special" in user.permissions):
    grant_access()

...Extract to Named Function

GOOD: Self-explanatory through naming

def user_has_admin_access(user):
    return user.role == "admin" or has_special_permission(user)

def has_special_permission(user):
    return user.permissions and "special" in user.permissions

if user_has_admin_access(user):
    grant_access()

Language-Specific Examples

JavaScript

// Good: Explains WHY we debounce
// Debounce search to reduce API calls (500ms wait after last keystroke)
const debouncedSearch = debounce(searchAPI, 500);

// Bad: Obvious
let count = 0;  // Initialize count to zero
count++;  // Increment count

// Good: Explains algorithm choice
// Using Set for O(1) lookup instead of Array.includes() which is O(n)
const seen = new Set(ids);

Python

# Good: Explains the algorithm choice
# Using binary search because data is sorted and we need O(log n) performance
index = bisect.bisect_left(sorted_list, target)

# Bad: Redundant
def get_total(items):
    return sum(items)  # Return the sum of items

# Good: Explains why we're doing this
# Extract to separate function for type checking in mypy
def validate_user(user):
    if not user or not user.id:
        raise ValueError("Invalid user")
    return user

TypeScript

// Good: Explains the type assertion
// TypeScript can't infer this is never null after the check
const element = document.getElementById('app') as HTMLElement;

// Bad: Obvious
const sum = a + b;  // Add a and b

// Good: Explains non-obvious behavior
// spread operator creates shallow copy; use JSON for deep copy
const newConfig = { ...config };

Comment Quality Checklist

Before committing, ensure your comments:

  • Explain WHY, not WHAT
  • Are grammatically correct and clear
  • Will remain accurate as code evolves
  • Add genuine value to code understanding
  • Are placed appropriately (above the code they describe)
  • Use proper spelling and professional language
  • Follow team conventions for annotation keywords
  • Could not be replaced by better naming or structure
  • Are not obvious statements about language features
  • Reference tickets/issues when applicable

Summary

Priority order:

  1. Clear code - Self-explanatory through naming and structure
  2. Good comments - Explain WHY when necessary
  3. Documentation - API docs, docstrings for public interfaces
  4. No comments - Better than bad comments that lie or clutter

Remember: Comments are a failure to make the code self-explanatory. Use them sparingly and wisely.


Key Takeaways

GoalApproach
Reduce commentsImprove naming, extract functions, simplify logic
Improve clarityUse self-explanatory code structure, clear variable names
Document APIsUse docstrings/JSDoc for public interfaces
Explain WHYComment only business logic, algorithms, workarounds
Maintain accuracyUpdate comments when code changes, or remove them

平台分布

Codex

36.94%
按下载量换算34

Claude

30.44%
按下载量换算28

Cursor

19.17%
按下载量换算18

Gemini CLI

9.43%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills