Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问clear审计通过

inline-documentation内联文档

Agent Skill

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

总安装

544

周安装

22

GitHub Stars

6

下载量

171
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/troykelly/claude-skills --skill inline-documentation

简介

用于辅助文档、README、Markdown 和内容稿件的整理与改写。

  • 适合提炼结构、补齐章节、统一术语或检查链接。
  • 保留项目已有事实和路径,不把未确认信息写成确定结论。
  • 涉及对外文案时需控制语气,避免过度营销或夸大能力。
  • inline-documentation 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Inline Documentation

Overview

Document code assuming docs will be generated from it.

Core principle: Future developers (including you) will read this code. Help them.

Announce at use: "I'm adding complete inline documentation for this code."

What to Document

Always Document

ElementDocumentation Required
Public functions/methodsFull JSDoc/docstring
Public classesClass-level documentation
Public interfaces/typesDescription of purpose
Exported constantsWhat they control
Complex logicWhy, not what
Non-obvious decisionsExplain reasoning

Skip Documentation For

ElementWhy
Private trivial helpersSelf-evident
Single-line gettersObvious from name
Standard patternsWell-known idioms
Test filesTests are documentation

TypeScript/JavaScript (JSDoc)

Function Documentation

/**
 * Calculates the total price including tax and discounts.
 *
 * @description Applies discounts before tax calculation.
 * Discounts are applied in order of magnitude (largest first).
 *
 * @param items - Line items to calculate
 * @param taxRate - Tax rate as decimal (e.g., 0.08 for 8%)
 * @param discounts - Optional discount codes to apply
 * @returns Total price after discounts and tax
 *
 * @throws {ValidationError} If taxRate is negative
 * @throws {InvalidDiscountError} If discount code is invalid
 *
 * @example
 * ```typescript
 * const total = calculateTotal(
 *   [{ price: 100 }, { price: 50 }],
 *   0.08,
 *   ['SAVE10']
 * );
 * // Returns: 145.80 (150 - 10% discount = 135, + 8% tax)
 * ```
 */
function calculateTotal(
  items: LineItem[],
  taxRate: number,
  discounts?: string[]
): number {
  // Implementation
}

Class Documentation

/**
 * Manages user authentication and session lifecycle.
 *
 * @description Handles login, logout, session refresh, and
 * multi-device session management. Uses JWT for stateless
 * authentication with Redis for session invalidation tracking.
 *
 * @example
 * ```typescript
 * const auth = new AuthService(config);
 * const session = await auth.login(credentials);
 * await auth.logout(session.id);
 * ```
 */
class AuthService {
  /**
   * Creates an AuthService instance.
   *
   * @param config - Authentication configuration
   * @param config.jwtSecret - Secret for signing JWTs
   * @param config.sessionTtl - Session time-to-live in seconds
   */
  constructor(private config: AuthConfig) { }

  /**
   * Authenticates a user and creates a session.
   *
   * @param credentials - User credentials
   * @returns Session object with tokens
   * @throws {InvalidCredentialsError} If authentication fails
   */
  async login(credentials: Credentials): Promise<Session> { }
}

Interface Documentation

/**
 * Configuration for the caching layer.
 *
 * @description Controls cache behavior including TTL,
 * invalidation strategy, and storage backend selection.
 */
interface CacheConfig {
  /** Time-to-live in seconds. Default: 3600 */
  ttl: number;

  /** Maximum items to cache. Default: 1000 */
  maxSize: number;

  /**
   * Storage backend to use.
   * - 'memory': In-process LRU cache
   * - 'redis': Distributed Redis cache
   */
  backend: 'memory' | 'redis';

  /** Redis connection string (required if backend is 'redis') */
  redisUrl?: string;
}

Python (Docstrings)

Function Documentation

def calculate_total(
    items: list[LineItem],
    tax_rate: float,
    discounts: list[str] | None = None
) -> float:
    """Calculate the total price including tax and discounts.

    Applies discounts before tax calculation. Discounts are applied
    in order of magnitude (largest first).

    Args:
        items: Line items to calculate.
        tax_rate: Tax rate as decimal (e.g., 0.08 for 8%).
        discounts: Optional discount codes to apply.

    Returns:
        Total price after discounts and tax.

    Raises:
        ValidationError: If tax_rate is negative.
        InvalidDiscountError: If discount code is invalid.

    Example:
        >>> total = calculate_total(
        ...     [LineItem(price=100), LineItem(price=50)],
        ...     0.08,
        ...     ['SAVE10']
        ... )
        >>> total
        145.80  # 150 - 10% = 135, + 8% tax
    """
    pass

Class Documentation

class AuthService:
    """Manages user authentication and session lifecycle.

    Handles login, logout, session refresh, and multi-device
    session management. Uses JWT for stateless authentication
    with Redis for session invalidation tracking.

    Attributes:
        config: Authentication configuration.
        redis: Redis client for session tracking.

    Example:
        >>> auth = AuthService(config)
        >>> session = await auth.login(credentials)
        >>> await auth.logout(session.id)
    """

    def __init__(self, config: AuthConfig) -> None:
        """Create an AuthService instance.

        Args:
            config: Authentication configuration including
                JWT secret and session TTL.
        """
        pass

Inline Comments

When to Use

// Complex algorithms
function dijkstra(graph: Graph, start: Node): Map<Node, number> {
  // Use priority queue for O(E log V) complexity
  // instead of linear search O(V²)
  const queue = new PriorityQueue<Node>();

  // Initialize all distances to infinity except start
  const distances = new Map<Node, number>();

  // ... implementation with strategic comments
}

Explain Why, Not What

// BAD: Explains what (obvious from code)
// Increment counter by 1
counter++;

// GOOD: Explains why (not obvious)
// Retry count starts at 1 because initial attempt doesn't count
counter++;

Link to Context

// Per RFC 7519, JWT expiry is in seconds since epoch
const exp = Math.floor(Date.now() / 1000) + ttlSeconds;

// See issue #234 for why we can't use the simpler approach
const result = complexWorkaround();

Mark Non-Obvious Behavior

// IMPORTANT: Order matters here - auth must run before rate limit
app.use(authMiddleware);
app.use(rateLimitMiddleware);

// WARNING: This modifies the input array in place
items.sort((a, b) => a.priority - b.priority);

Documentation Checklist

For each public element:

Functions/Methods

  • Brief description (first line)
  • Detailed description (if complex)
  • All parameters documented
  • Return value documented
  • Exceptions documented
  • Example provided (if non-obvious usage)

Classes

  • Class purpose described
  • Usage example provided
  • All public methods documented
  • Public properties documented

Interfaces/Types

  • Purpose described
  • Each property documented
  • Valid values noted (for enums/unions)

Anti-Patterns

Anti-PatternCorrect Approach
No documentationDocument all public APIs
Stale documentationUpdate docs with code changes
Obvious commentsOnly document non-obvious
Missing examplesAdd examples for complex APIs
Copy-paste docsWrite specific documentation

Generating Documentation

TypeScript

# Using TypeDoc
npx typedoc src/index.ts --out docs

# Using TSDoc
npx @microsoft/api-extractor run

Python

# Using Sphinx
sphinx-apidoc -o docs/source src/
sphinx-build docs/source docs/build

# Using pdoc
pdoc --html src/ -o docs/

Integration

This skill is applied by:

  • issue-driven-development - Step 7
  • comprehensive-review - Documentation criterion

This skill ensures:

  • Maintainable code
  • Onboarding ease
  • Generated documentation quality
  • API discoverability

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

31.48%
按下载量换算54

Antigravity

23.53%
按下载量换算40

Gemini CLI

19.05%
按下载量换算33

Cursor

12.91%
按下载量换算22

kiro-cli

8.02%
按下载量换算14

windsurf

3.62%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills