Token导航 LogoToken导航TokenDH.com
开发只读github未标认证来源可访问许可证需确认审计通过

code-commenting代码注释

Agent Skill

code-commenting 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

194

周安装

8

GitHub Stars

公开资料未说明

下载量

63
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/marclelamy/skills --skill code-commenting

简介

提供简洁分层注释规范,解释代码角色与上下文而非重复逻辑。

  • 每个新文件添加头部注释块,说明作用域与约束条件。
  • 强调纯函数、职责单一性等设计原则的文档化。
  • 适用于团队协作中统一注释风格与知识传递。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。
  • code-commenting 属于开发类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Code Commenting

Concise, layered commenting that explains *why* and *what role* code plays — never restates what the code already says.

File-level header

Every new file gets a /** */ block at the top, before imports. Two to four lines max.

Pattern:

/**
 * Short name or role of this file.
 *
 * One or two sentences of context: what it does, where it fits,
 * and any non-obvious constraints or scope limits.
 */

Good — concise, adds context:

/**
 * Reducer for node result state transitions.
 *
 * Pure function — takes the current result state and an action, returns the
 * next state. Used by `useWorkflowV2NodeTest` to update result state as
 * stream events arrive during a test run.
 */

Good — flags temporary / MVP scope:

/**
 * Creates the default in-memory document for the workflow v2 MVP.
 *
 * Returns a single `llm` node with default config — no persistence yet.
 * This will be replaced by a real load-from-database path in a future slice.
 */

Bad — too verbose, repeats what imports say:

/**
 * This file contains the createInitialWorkflowV2Document function.
 * It imports WorkflowV2Document from the types directory and
 * workflowV2LlmNodeDefinition from the definitions directory.
 * It creates a document with nodes and edges arrays...
 */

When to use a longer header

If a file has a catalog of variants (actions, event types, enum values), list them in the header so readers can scan without scrolling:

/**
 * Reducer for node result state transitions.
 *
 * Actions:
 *   node-start      — Appends a new "running" result entry
 *   node-status     — Updates the latest entry's status
 *   node-sync-parts — Replaces the latest entry's parts array (used for streaming)
 *   node-completed  — Marks the latest entry as completed
 *   node-failed     — Marks the latest entry as failed with an error
 */

'use client' files

Place the header after the directive, before imports:

'use client'

/**
 * Single-node test execution hook for workflow v2.
 * ...
 */

import { useCallback } from 'react'

Type & schema comments

Simple / self-documenting — single-line /** */

/** Lifecycle status of a single node execution: pending → running → completed | failed. */
export const workflowV2NodeResultStatusSchema = z.enum([...])
/** A directed edge connecting one node's output handle to another node's input handle. */
export const workflowV2DocumentEdgeSchema = z.object({...})

Complex / non-obvious — multi-line /** */

Use when the schema's role isn't clear from its name, or when it has runtime behavior worth calling out:

/**
 * Resolved inputs the node received at execution time, keyed by target handle.
 * Empty for single-node test runs; populated during multi-node workflow execution.
 */
export const workflowV2InputGroupsSchema = z.record(...)
/**
 * Per-node result state: an append-only results array plus an optional pointer
 * to which result is "active" (defaults to latest when undefined).
 */
export const workflowV2NodeResultStateSchema = z.object({...})

When NOT to comment a type/schema

  • If the name fully explains it (e.g. workflowV2NodeErrorSchema with message, code fields)
  • Inferred type exports — group them under a single section comment instead:
/**
 * Inferred types from Zod schemas.
 */
export type WorkflowV2NodeResultStatus = z.infer<typeof workflowV2NodeResultStatusSchema>
export type WorkflowV2NodeError = z.infer<typeof workflowV2NodeErrorSchema>

Never do @property lists for types

If the fields are named well, don't restate them:

// BAD — redundant
/**
 * @property modelId      — The model to use for generation
 * @property prompt        — The user prompt sent to the model
 * @property systemPrompt  — Optional system-level instructions
 * @property temperature   — Sampling temperature
 */
export const configSchema = z.object({
    modelId: z.string().min(1),
    prompt: z.string(),
    ...
})

// GOOD — one-liner is enough
/** User-editable config fields for an `llm` node. */
export const configSchema = z.object({...})

Function & helper comments

Exported functions — single-line /** */

/** Looks up a node definition by type. Throws if the type is not registered. */
export function getWorkflowV2NodeDefinition(nodeType: WorkflowV2NodeType) {...}

Private helpers — single-line /** */

/** Immutably updates the most recent result entry in the state. */
function patchLatestResult(state, updater) {...}
/** Maps result status → badge color variant. */
function getStatusBadgeVariant(status: string | null) {...}
/** Extracts a displayable string from any Part type for the result preview. */
function formatResultPart(part: Part) {...}

Small utility constructors

/** Helper to build a structured node error from message + optional metadata. */
function createNodeError(message: string, errorType?: string, code?: number) {...}

Inline comments (//)

Use sparingly — only when the *why* or *what happens next* isn't obvious from reading the code.

Good uses

Before a key callback or hook wiring:

// Dispatches a result action for a node and keeps the ref in sync with React state.
const applyNodeAction = useCallback(...)

// Wires into the shared SSE generation endpoint and maps stream events to result actions.
const { makeRequest, isStreaming } = useAIRequest(...)

// Validates config, builds a RequestV2, and kicks off the stream for a single node.
const runNodeTest = useCallback(async (nodeId: string) => {...})

Before a derived computation:

// Derive model dropdown options from the global models list; fall back to guest default.
const textModelOptions = useMemo(...)

// Map document nodes → React Flow nodes, attaching result state and handlers as data.
const nodes = useMemo(...)

Bad uses — don't comment the obvious

// BAD
// Set the state
setState(newValue)

// Check if node exists
if (!node) return

// Return the results
return { nodeResultStateById, runNodeTest }

Constants & module-level values

Only comment if the purpose isn't obvious:

// No comment needed — name says it all
const EMPTY_NODE_RESULT_STATE: WorkflowV2NodeResultState = { results: [] }

// Comment needed — explains a non-obvious registration
/** Register custom node types — React Flow uses this to resolve `type: 'workflowV2Node'`. */
const nodeTypes: NodeTypes = { workflowV2Node: WorkflowV2Node }

React component files

  1. File header — what the component renders, any scope limits
  2. Helper functions above the component — one-line /** */ each
  3. Key useMemo / useCallback blocks — inline // comment
  4. JSX — no comments unless there's a non-obvious workaround
/**
 * Workflow v2 node component — rendered by React Flow for each node on the canvas.
 *
 * Currently hardcoded for the `llm` node type. Will be generalized when
 * additional node types are added.
 */

/** Maps result status → badge color variant. */
function getStatusBadgeVariant(status: string | null) {...}

/** Joins all parts of the active result into a single string for display. */
function getResultText(resultState: WorkflowV2NodeResultState) {...}

export function WorkflowV2Node({ data }: NodeProps<WorkflowV2FlowNode>) {...}

Summary checklist

LayerFormatWhen
File header/** */ multi-lineEvery new file
Schema / type/** */ single or multiWhen name alone isn't enough
Inferred type group/** Inferred types... */Group of z.infer exports
Exported function/** */ single-lineAlways
Private helper/** */ single-lineWhen purpose isn't obvious from name
Inline callback/memo// single-lineBefore key wiring points
Constants/** */ single-lineOnly if non-obvious
JSXNoneUnless there's a workaround

Golden rule: If removing the comment would make a reader pause and re-read the code to understand its role, keep the comment. If the code already says the same thing, delete it.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

35.36%
按下载量换算22

Claude

31.01%
按下载量换算20

Cursor

17.51%
按下载量换算11

Gemini CLI

9.56%
按下载量换算6

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

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

来源信息

继续浏览同类 Skills